Changeset 10650 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeTile.cs
- Timestamp:
- 03/24/14 16:59:22 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeTile.cs
r10524 r10650 41 41 42 42 public ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> LayoutEngine { get; set; } 43 public SymbolicExpressionTreeTile(IChart chart) : base(chart) { } 43 private Dictionary<IPrimitive, ISymbolicExpressionTreeNode> primitiveMap; 44 45 public SymbolicExpressionTreeTile(IChart chart) 46 : base(chart) { 47 primitiveMap = new Dictionary<IPrimitive, ISymbolicExpressionTreeNode>(); 48 } 44 49 public SymbolicExpressionTreeTile(IChart chart, ISymbolicExpressionTree tree) 45 : base(chart) {50 : this(chart) { 46 51 SymbolicExpressionTree = tree; 47 52 PreferredNodeWidth = 80; … … 50 55 private void GeneratePrimitives(double preferredNodeWidth, double preferredNodeHeight) { 51 56 Clear(); 52 LayoutEngine.Initialize(SymbolicExpressionTree.Root, node => node.Subtrees); 53 LayoutEngine.CalculateLayout(); 57 ISymbolicExpressionTreeNode root = SymbolicExpressionTree.Root; 58 if (root.Symbol is ProgramRootSymbol && root.SubtreeCount == 1) { root = root.GetSubtree(0); } 59 var visualNodes = LayoutEngine.CalculateLayout(root); 54 60 55 var primitivesMap = new Dictionary<ISymbolicExpressionTreeNode, IPrimitive>(); // both Ellipse and Rectangle are derived from the RectangularPrimitiveBase56 61 var font = new Font(FontFamily.GenericSansSerif, 10, GraphicsUnit.Pixel); 57 62 58 var visualNodes = LayoutEngine.GetVisualNodes().ToList();59 63 var visualNodeMap = visualNodes.ToDictionary(x => x.Content, x => x); 60 64 … … 71 75 72 76 this.Add(rectangularPrimitive); 73 primitivesMap.Add(node, rectangularPrimitive);74 77 } 75 78
Note: See TracChangeset
for help on using the changeset viewer.