Changeset 10681 for branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4
- Timestamp:
- 03/31/14 13:38:42 (11 years ago)
- Location:
- branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views merged: 10492,10521-10522,10545,10561,10564
- Property svn:mergeinfo changed
-
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
r10419 r10681 117 117 <Private>False</Private> 118 118 </Reference> 119 <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 120 <SpecificVersion>False</SpecificVersion> 121 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath> 122 <Private>False</Private> 123 </Reference> 119 124 <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 120 125 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath> -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs
r9708 r10681 19 19 */ 20 20 #endregion 21 21 22 22 23 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { … … 137 138 // 138 139 // btnOptimizeConstants 139 // 140 this.btnOptimizeConstants.A nchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));140 // 141 this.btnOptimizeConstants.AutoSize = true; 141 142 this.btnOptimizeConstants.Enabled = false; 142 this.btnOptimizeConstants.Location = new System.Drawing.Point(104, 3); 143 this.btnOptimizeConstants.Image = HeuristicLab.Common.Resources.VSImageLibrary.Performance; 144 this.btnOptimizeConstants.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; 145 this.btnOptimizeConstants.Location = new System.Drawing.Point(105, 3); 143 146 this.btnOptimizeConstants.Name = "btnOptimizeConstants"; 144 this.btnOptimizeConstants.Size = new System.Drawing.Size( 97, 23);147 this.btnOptimizeConstants.Size = new System.Drawing.Size(80, 24); 145 148 this.btnOptimizeConstants.TabIndex = 2; 146 149 this.btnOptimizeConstants.Text = "Optimize"; 150 this.btnOptimizeConstants.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 151 this.btnOptimizeConstants.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 147 152 this.btnOptimizeConstants.UseVisualStyleBackColor = true; 148 153 this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click); … … 150 155 // btnSimplify 151 156 // 157 this.btnSimplify.AutoSize = true; 158 this.btnSimplify.Enabled = true; 159 this.btnSimplify.Image = HeuristicLab.Common.Resources.VSImageLibrary.FormulaEvaluator; 160 this.btnSimplify.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; 152 161 this.btnSimplify.Location = new System.Drawing.Point(3, 3); 153 162 this.btnSimplify.Name = "btnSimplify"; 154 this.btnSimplify.Size = new System.Drawing.Size( 95, 23);163 this.btnSimplify.Size = new System.Drawing.Size(80, 24); 155 164 this.btnSimplify.TabIndex = 1; 156 165 this.btnSimplify.Text = "Simplify"; 166 this.btnSimplify.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 167 this.btnSimplify.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 157 168 this.btnSimplify.UseVisualStyleBackColor = true; 158 169 this.btnSimplify.Click += new System.EventHandler(this.btnSimplify_Click); -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r9708 r10681 52 52 Content.ModelChanged += Content_Changed; 53 53 Content.ProblemDataChanged += Content_Changed; 54 treeChart.Repainted += treeChart_Repainted; 54 55 } 55 56 protected override void DeregisterContentEvents() { … … 57 58 Content.ModelChanged -= Content_Changed; 58 59 Content.ProblemDataChanged -= Content_Changed; 60 treeChart.Repainted -= treeChart_Repainted; 59 61 } 60 62 … … 70 72 } 71 73 74 private void treeChart_Repainted(object sender, EventArgs e) { 75 if (nodeImpacts != null && nodeImpacts.Count > 0) 76 PaintNodeImpacts(); 77 } 78 72 79 private void UpdateView() { 73 80 if (Content == null || Content.Model == null || Content.ProblemData == null) return; … … 75 82 treeChart.Tree = tree.Root.SubtreeCount > 1 ? new SymbolicExpressionTree(tree.Root) : new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0)); 76 83 77 var replacementValues = CalculateReplacementValues(tree); 84 var impactAndReplacementValues = CalculateImpactAndReplacementValues(tree); 85 nodeImpacts = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1); 86 var replacementValues = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item2); 78 87 foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) { 79 88 foldedNodes[pair.Key] = MakeConstantTreeNode(pair.Value); 80 89 } 81 82 nodeImpacts = CalculateImpactValues(tree);83 90 PaintNodeImpacts(); 84 91 } … … 86 93 protected abstract Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree); 87 94 protected abstract Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree); 95 protected abstract Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>> CalculateImpactAndReplacementValues(ISymbolicExpressionTree tree); 88 96 protected abstract void UpdateModel(ISymbolicExpressionTree tree); 89 97 … … 96 104 97 105 private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) { 98 var visualNode = (Visual SymbolicExpressionTreeNode)sender;99 var symbExprTreeNode = (SymbolicExpressionTreeNode)visualNode. SymbolicExpressionTreeNode;106 var visualNode = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender; 107 var symbExprTreeNode = (SymbolicExpressionTreeNode)visualNode.Content; 100 108 if (symbExprTreeNode == null) return; 101 109 var tree = Content.Model.SymbolicExpressionTree; … … 125 133 double max = impacts.Max(); 126 134 double min = impacts.Min(); 127 foreach ( ISymbolicExpressionTreeNodetreeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {128 Visual SymbolicExpressionTreeNodevisualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);135 foreach (var treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) { 136 VisualTreeNode<ISymbolicExpressionTreeNode> visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode); 129 137 130 138 if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) { -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs
r9708 r10681 33 33 internal sealed partial class InteractiveSymbolicExpressionTreeChart : SymbolicExpressionTreeChart { 34 34 private ISymbolicExpressionTreeNode tempNode; // node in clipboard (to be cut/copy/pasted etc) 35 private Visual SymbolicExpressionTreeNodecurrSelected; // currently selected node35 private VisualTreeNode<ISymbolicExpressionTreeNode> currSelected; // currently selected node 36 36 private enum EditOp { NoOp, CopySubtree, CutSubtree } 37 37 private EditOp lastOp = EditOp.NoOp; … … 65 65 pasteToolStripMenuItem.Visible = false; 66 66 } else { 67 var node = currSelected. SymbolicExpressionTreeNode;67 var node = currSelected.Content; 68 68 insertNodeToolStripMenuItem.Visible = true; 69 69 changeNodeToolStripMenuItem.Visible = true; … … 77 77 pasteToolStripMenuItem.Enabled = tempNode != null && insertNodeToolStripMenuItem.Enabled 78 78 && !(lastOp == EditOp.CutSubtree 79 && tempNode.IterateNodesBreadth().Contains(currSelected. SymbolicExpressionTreeNode));79 && tempNode.IterateNodesBreadth().Contains(currSelected.Content)); 80 80 } 81 81 } 82 82 83 83 protected override void OnSymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs e) { 84 currSelected = (Visual SymbolicExpressionTreeNode)sender; ;84 currSelected = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender; ; 85 85 if (currSelected != null) { 86 86 currSelected.LineColor = Color.FromArgb(130, currSelected.LineColor); … … 104 104 105 105 private void insertNodeToolStripMenuItem_Click(object sender, EventArgs e) { 106 if (currSelected == null || currSelected. SymbolicExpressionTreeNodeis SymbolicExpressionTreeTerminalNode) return;107 var parent = currSelected. SymbolicExpressionTreeNode;106 if (currSelected == null || currSelected.Content is SymbolicExpressionTreeTerminalNode) return; 107 var parent = currSelected.Content; 108 108 109 109 using (var dialog = new InsertNodeDialog()) { … … 138 138 if (currSelected == null) return; 139 139 140 var node = (ISymbolicExpressionTreeNode)currSelected. SymbolicExpressionTreeNode.Clone();141 var originalNode = currSelected. SymbolicExpressionTreeNode;140 var node = (ISymbolicExpressionTreeNode)currSelected.Content.Clone(); 141 var originalNode = currSelected.Content; 142 142 143 143 ISymbolicExpressionTreeNode newNode = null; … … 180 180 } 181 181 } 182 tempNode = currSelected. SymbolicExpressionTreeNode;182 tempNode = currSelected.Content; 183 183 foreach (var node in tempNode.IterateNodesPostfix()) { 184 184 var visualNode = GetVisualSymbolicExpressionTreeNode(node); … … 194 194 } 195 195 private void removeNodeToolStripMenuItem_Click(object sender, EventArgs e) { 196 var node = currSelected. SymbolicExpressionTreeNode;196 var node = currSelected.Content; 197 197 if (node == tempNode) tempNode = null; 198 198 ModifyTree(Tree, node.Parent, node, null, removeSubtree: false); … … 200 200 } 201 201 private void removeSubtreeToolStripMenuItem_Click(object sender, EventArgs e) { 202 var node = currSelected. SymbolicExpressionTreeNode;202 var node = currSelected.Content; 203 203 if (node.IterateNodesPostfix().Contains(tempNode)) tempNode = null; 204 204 ModifyTree(Tree, node.Parent, node, null, removeSubtree: true); … … 209 209 if (!(lastOp == EditOp.CopySubtree || lastOp == EditOp.CutSubtree)) return; 210 210 // check if the copied/cut node (stored in the tempNode) can be inserted as a child of the current selected node 211 var node = currSelected. SymbolicExpressionTreeNode;211 var node = currSelected.Content; 212 212 if (node is ConstantTreeNode || node is VariableTreeNode) return; 213 213 // check if the currently selected node can accept the copied node as a child … … 218 218 if (tempNode.IterateNodesBreadth().Contains(node)) 219 219 throw new ArgumentException();// cannot cut/paste a node into itself 220 ModifyTree(Tree, tempNode.Parent, tempNode, null); //remove node from its original parent 220 ModifyTree(Tree, tempNode.Parent, tempNode, null); //remove node from its original parent 221 221 ModifyTree(Tree, node, null, tempNode); //insert it as a child to the new parent 222 222 break; -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame
r10364 r10681 32 32 [PluginDependency("HeuristicLab.Collections", "3.3")] 33 33 [PluginDependency("HeuristicLab.Common", "3.3")] 34 [PluginDependency("HeuristicLab.Common.Resources", "3.3")] 34 35 [PluginDependency("HeuristicLab.Core", "3.3")] 35 36 [PluginDependency("HeuristicLab.Core.Views", "3.3")] -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TextualSymbolicDataAnalysisModelView.designer.cs
r9708 r10681 48 48 this.SuspendLayout(); 49 49 // 50 // expressionTreeView50 // symbolicExpressionTreeView 51 51 // 52 52 this.symbolicExpressionTreeView.AllowDrop = true; … … 54 54 this.symbolicExpressionTreeView.Content = null; 55 55 this.symbolicExpressionTreeView.Dock = System.Windows.Forms.DockStyle.Fill; 56 this.symbolicExpressionTreeView.Font = new System.Drawing.Font("Consolas", 8.25F); 56 57 this.symbolicExpressionTreeView.Location = new System.Drawing.Point(0, 0); 57 this.symbolicExpressionTreeView.Name = " expressionTreeView";58 this.symbolicExpressionTreeView.Name = "symbolicExpressionTreeView"; 58 59 this.symbolicExpressionTreeView.ReadOnly = false; 59 60 this.symbolicExpressionTreeView.Size = new System.Drawing.Size(352, 413); 60 61 this.symbolicExpressionTreeView.TabIndex = 0; 61 62 // 62 // SymbolicExpressionModelView63 // TextualSymbolicDataAnalysisModelView 63 64 // 64 65 this.AllowDrop = true; 65 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);66 66 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 67 67 this.Controls.Add(this.symbolicExpressionTreeView); 68 this.Name = " SymbolicExpressionModelView";68 this.Name = "TextualSymbolicDataAnalysisModelView"; 69 69 this.Size = new System.Drawing.Size(352, 413); 70 70 this.ResumeLayout(false);
Note: See TracChangeset
for help on using the changeset viewer.