Changeset 10728 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicExpressionChartControl.cs
- Timestamp:
- 04/07/14 17:05:31 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.