Changeset 10728 for branches/HeuristicLab.EvolutionTracking
- Timestamp:
- 04/07/14 17:05:31 (11 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeTile.cs
r10685 r10728 35 35 /// </summary> 36 36 public class SymbolicExpressionTreeTile : Group { 37 public doublePreferredNodeWidth { get; set; }38 public doublePreferredNodeHeight { get; set; }37 public int PreferredNodeWidth { get; set; } 38 public int PreferredNodeHeight { get; set; } 39 39 40 40 public Size Size { … … 119 119 var actualRoot = Root; 120 120 if (Root.Symbol is ProgramRootSymbol && Root.SubtreeCount == 1) { actualRoot = Root.GetSubtree(0); } 121 122 LayoutEngine.NodeWidth = PreferredNodeWidth; 123 LayoutEngine.NodeHeight = PreferredNodeHeight; 124 121 125 var visualNodes = LayoutEngine.CalculateLayout(actualRoot); 122 126 … … 139 143 this.Add(rectangularPrimitive); 140 144 141 // int x = Position.X, y = Position.Y;142 // if (x > rectangularPrimitive.LowerLeft.X) {143 // x = (int)Math.Floor(rectangularPrimitive.LowerLeft.X);144 // }145 // if (y > rectangularPrimitive.LowerLeft.Y) {146 // y = (int)Math.Floor(rectangularPrimitive.LowerLeft.Y);147 // }148 // Position = new Point(x, y);149 // int w = Size.Width, h = Size.Height;150 151 152 145 if (rectangularPrimitive.Size.Width.IsAlmost(0) || rectangularPrimitive.Size.Height.IsAlmost(0)) { 153 146 throw new Exception("Primitive size cannot be zero."); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/FragmentGraphView.cs
r10685 r10728 54 54 55 55 var fragmentRoot = tileDictionary[root]; 56 int maxTileWidth = 0, maxTileHeight = 0; 57 foreach (var tile in Content.Nodes.Select(x => tileDictionary[x].Tile)) { 58 var size = tile.Size; 59 if (maxTileWidth < size.Width) maxTileWidth = size.Width; 60 if (maxTileHeight < size.Height) maxTileHeight = size.Height; 61 } 62 layoutEngine.NodeWidth = maxTileWidth; 63 layoutEngine.NodeHeight = maxTileHeight; 64 layoutEngine.HorizontalSpacing = PreferredSpacing; 65 layoutEngine.VerticalSpacing = PreferredSpacing; 66 56 67 var visualNodes = layoutEngine.CalculateLayout(fragmentRoot); 57 68 … … 62 73 symbolicExpressionChartControl.Add(tile); 63 74 } 75 // symbolicExpressionChartControl.FlipVertical(); 64 76 symbolicExpressionChartControl.UpdateEnabled = true; 65 77 symbolicExpressionChartControl.EnforceUpdate(); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
r10655 r10728 231 231 <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon> 232 232 </Compile> 233 <Compile Include="SymbolicDataAnalysisExpressionGenealogyGraphChart.cs"> 234 <SubType>UserControl</SubType> 235 </Compile> 233 <Compile Include="SymbolicDataAnalysisExpressionGenealogyGraphChart.cs" /> 236 234 <Compile Include="SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs"> 237 235 <DependentUpon>SymbolicDataAnalysisExpressionGenealogyGraphChart.cs</DependentUpon> -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionLineageExplorerView.cs
r10655 r10728 81 81 symbolicExpressionChartControl.UpdateEnabled = false; 82 82 symbolicExpressionChartControl.Add(tile); 83 symbolicExpressionChartControl.FlipVertical();83 // symbolicExpressionChartControl.FlipVertical(); 84 84 symbolicExpressionChartControl.UpdateEnabled = true; 85 85 symbolicExpressionChartControl.EnforceUpdate(); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicExpressionChartControl.Designer.cs
r10655 r10728 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 components = new System.ComponentModel.Container(); 26 ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); 27 this.SuspendLayout(); 28 // 29 // SymbolicExpressionChartControl 30 // 31 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 27 32 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 33 this.DoubleBuffered = true; 34 this.Name = "SymbolicExpressionChartControl"; 35 this.Controls.SetChildIndex(this.pictureBox, 0); 36 ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); 37 this.ResumeLayout(false); 38 28 39 } 29 40 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicExpressionChartControl.cs
r10655 r10728 1 1 using System.Collections.Generic; 2 2 using System.Drawing; 3 using System.Drawing.Drawing2D; 4 using System.Linq; 3 5 using System.Windows.Forms; 4 6 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views; … … 25 27 26 28 public void Draw(Graphics graphics) { 29 graphics.SmoothingMode = SmoothingMode.HighQuality; 27 30 Chart.Group.Draw(graphics); 28 31 } … … 38 41 39 42 public void FlipVertical() { 40 foreach (var primitive in Chart.Group.Primitives) { 41 var tile = primitive as SymbolicExpressionTreeTile; 42 if (tile != null) { 43 foreach (var p in tile.Primitives) { 44 FlipPrimitive(p); 45 } 46 } else { 47 FlipPrimitive(primitive); 48 } 43 foreach (var p in Chart.Group.Primitives.OfType<SymbolicExpressionTreeTile>().SelectMany(x => x.Primitives)) { 44 FlipPrimitive(p); 49 45 } 50 46 } … … 67 63 68 64 var selectedPrimitives = Chart.GetAllPrimitives(point); 69 // first primitive in the list should be the tile, the second one should be the actual primitive representing a tree node 70 var tile = (SymbolicExpressionTreeTile)selectedPrimitives[0]; 71 var selectedPrimitive = (RectangularPrimitiveBase)selectedPrimitives[1]; 72 var tree = tile.SymbolicExpressionTree; // use the tree to get the genealogy graph node and the fragments used for tracing building blocks 65 if (!selectedPrimitives.Any()) return; 73 66 74 var pen = new Pen(Color.Blue); 75 using (var g = Graphics.FromImage(pictureBox.Image)) { 76 g.DrawRectangle(pen, (float)selectedPrimitive.LowerLeft.X, (float)selectedPrimitive.LowerLeft.Y, (float)selectedPrimitive.Size.Width, (float)selectedPrimitive.Size.Height); 67 foreach (var primitive in selectedPrimitives) { 68 if (primitive is SymbolicExpressionTreeTile) continue; 69 primitive.Pen = new Pen(Color.Blue); 70 primitive.Pen.Brush = new SolidBrush(Color.Blue); 77 71 } 72 EnforceUpdate(); 78 73 } 79 74 }
Note: See TracChangeset
for help on using the changeset viewer.