Changeset 10752 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views
- Timestamp:
- 04/15/14 17:08:35 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeTile.cs
r10746 r10752 142 142 143 143 RectangularPrimitiveBase rectangularPrimitive; 144 var label = ShortenLabel(node); 144 145 if (node.SubtreeCount == 0) { 145 rectangularPrimitive = new Rectangle(Chart, lowerLeft, upperRight) { Font = font, Text = visualNode.Content.ToString()};146 rectangularPrimitive = new Rectangle(Chart, lowerLeft, upperRight) { Font = font, Text = label }; 146 147 } else { 147 rectangularPrimitive = new Ellipse(Chart, lowerLeft, upperRight) { Font = font, Text = visualNode.Content.ToString()};148 rectangularPrimitive = new Ellipse(Chart, lowerLeft, upperRight) { Font = font, Text = label }; 148 149 } 149 150 … … 202 203 base.Draw(graphics); 203 204 } 205 206 private string ShortenLabel(ISymbolicExpressionTreeNode node) { 207 var term = node as SymbolicExpressionTreeTerminalNode; 208 if (term != null) { 209 var parts = term.ToString().Split(' '); // split by space 210 if (parts.Length == 1) { 211 return parts[0].Substring(0, 5); 212 } else { 213 return parts[0].Substring(0, 5) + parts[1]; 214 } 215 } 216 return node.Symbol.ToString().Substring(0, 3); 217 } 204 218 } 205 219 }
Note: See TracChangeset
for help on using the changeset viewer.