Changeset 10302 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4
- Timestamp:
- 01/08/14 13:58:54 (11 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Formatters/SymbolicExpressionTreeLatexFormatter.cs
r10269 r10302 1 1 using System.Collections.Generic; 2 using System.Linq; 2 3 using System.Text; 3 4 using HeuristicLab.Common; … … 12 13 {"StartSymbol","RPB"} 13 14 }; 14 private ReingoldTilfordLayoutEngine layoutEngine; 15 private readonly ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode> layoutEngine; 16 private readonly SymbolicExpressionTreeLayoutAdapter layoutAdapter; 17 15 18 16 19 public SymbolicExpressionTreeLatexFormatter() { 17 layoutEngine = new ReingoldTilfordLayoutEngine ();20 layoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode>(); 18 21 } 19 22 20 23 protected SymbolicExpressionTreeLatexFormatter(SymbolicExpressionTreeLatexFormatter original, Cloner cloner) 21 24 : base(original, cloner) { 22 layoutEngine = new ReingoldTilfordLayoutEngine(); 25 layoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode>(); 26 layoutAdapter = new SymbolicExpressionTreeLayoutAdapter(); 23 27 } 24 28 … … 28 32 29 33 public string Format(ISymbolicExpressionTree symbolicExpressionTree) { 30 layoutEngine.SymbolicExpressionTree = symbolicExpressionTree; 34 var layoutNodes = layoutAdapter.Convert(symbolicExpressionTree).ToList(); 35 layoutEngine.Reset(); 36 layoutEngine.Root = layoutNodes[0]; 37 foreach (var ln in layoutNodes) 38 layoutEngine.AddNode(ln.Content, ln); 31 39 var nodeCoordinates = layoutEngine.GetNodeCoordinates(); 32 40 var sb = new StringBuilder(); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj
r10269 r10302 186 186 <Compile Include="Creators\RampedHalfAndHalfTreeCreator.cs" /> 187 187 <Compile Include="Formatters\SymbolicExpressionTreeGraphvizFormatter.cs" /> 188 <Compile Include="Formatters\SymbolicExpressionTreeLatexFormatter.cs" /> 188 189 <Compile Include="Interfaces\IFragment.cs" /> 189 190 <Compile Include="Interfaces\ILayoutAdapter.cs" />
Note: See TracChangeset
for help on using the changeset viewer.