Changeset 10517 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeTile.cs
- Timestamp:
- 02/26/14 02:19:58 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeTile.cs
r10514 r10517 25 25 using HeuristicLab.Visualization; 26 26 using HeuristicLab.Visualization.Primitives; 27 using Rectangle = HeuristicLab.Visualization.Rectangle;28 27 29 28 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views { … … 56 55 LayoutEngine.CalculateLayout(); 57 56 58 var primitivesMap = new Dictionary<LayoutNode<ISymbolicExpressionTreeNode>, LabeledPrimitive>(); // both Ellipse and Rectangle are derived from the RectangularPrimitiveBase57 var primitivesMap = new Dictionary<LayoutNode<ISymbolicExpressionTreeNode>, IPrimitive>(); // both Ellipse and Rectangle are derived from the RectangularPrimitiveBase 59 58 var font = new Font(FontFamily.GenericSansSerif, 10, GraphicsUnit.Pixel); 60 59 61 60 foreach (var node in layoutNodes) { 62 LabeledPrimitive labeledPrimitive; 63 if (node.Children == null || node.Children.Count == 0) { 64 var rectangle = new Rectangle(Chart, node.X, node.Y, node.X + preferredNodeWidth, node.Y + preferredNodeHeight); 65 var textPrimitive = new TextPrimitive(Chart, rectangle.LowerLeft, rectangle.UpperRight) { 66 Font = font, 67 Text = node.Content.ToString() 68 }; 69 labeledPrimitive = new LabeledPrimitive(Chart, rectangle, textPrimitive); 61 var lowerLeft = new PointD(node.X, node.Y); 62 var upperRight = new PointD(node.X + preferredNodeWidth, node.Y + preferredNodeHeight); 63 64 RectangularPrimitiveBase rectangularPrimitive; 65 if (node.IsLeaf) { 66 rectangularPrimitive = new LabeledRectangle(Chart, lowerLeft, upperRight) { Font = font, Text = node.Content.ToString() }; 70 67 } else { 71 var ellipse = new Ellipse(Chart, node.X, node.Y, node.X + preferredNodeWidth, node.Y + preferredNodeHeight); 72 var textPrimitive = new TextPrimitive(Chart, ellipse.LowerLeft, ellipse.UpperRight) { 73 Font = font, 74 Text = node.Content.ToString() 75 }; 76 labeledPrimitive = new LabeledPrimitive(Chart, ellipse, textPrimitive); 68 rectangularPrimitive = new LabeledEllipse(Chart, lowerLeft, upperRight) { Font = font, Text = node.Content.ToString() }; 77 69 } 78 this.Add(labeledPrimitive); 79 primitivesMap.Add(node, labeledPrimitive); 70 71 this.Add(rectangularPrimitive); 72 primitivesMap.Add(node, rectangularPrimitive); 80 73 } 81 74
Note: See TracChangeset
for help on using the changeset viewer.