Changeset 10730 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeTile.cs
- Timestamp:
- 04/08/14 17:23:51 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeTile.cs
r10729 r10730 38 38 public int PreferredNodeHeight { get; set; } 39 39 40 private Size size; 40 41 public Size Size { 41 get { 42 int xmin = 0, ymin = 0, xmax = 0, ymax = 0; 43 44 foreach (var p in Primitives.OfType<RectangularPrimitiveBase>()) { 45 if (xmin > p.LowerLeft.X) xmin = (int)Math.Floor(p.LowerLeft.X); 46 if (xmax < p.UpperRight.X) xmax = (int)Math.Ceiling(p.UpperRight.X); 47 if (ymin > p.LowerLeft.Y) ymin = (int)Math.Floor(p.LowerLeft.Y); 48 if (ymax < p.UpperRight.Y) ymax = (int)Math.Ceiling(p.UpperRight.Y); 49 } 50 51 return new Size(xmax - xmin, ymax - ymin); 52 } 42 private set { size = value; } 43 get { return size; } 53 44 } 54 45 … … 123 114 LayoutEngine.NodeHeight = PreferredNodeHeight; 124 115 125 var visualNodes = LayoutEngine.CalculateLayout(actualRoot) ;116 var visualNodes = LayoutEngine.CalculateLayout(actualRoot).ToList(); 126 117 127 118 var font = new Font(FontFamily.GenericSansSerif, 10, GraphicsUnit.Pixel); … … 157 148 } 158 149 } 159 160 // add a bounding rectangle and flip primitives vertically 150 int xmin = 0, ymin = 0, xmax = 0, ymax = 0; 151 foreach (var rpb in Primitives.OfType<RectangularPrimitiveBase>()) { 152 if (xmin > rpb.LowerLeft.X) xmin = (int)Math.Floor(rpb.LowerLeft.X); 153 if (xmax < rpb.UpperRight.X) xmax = (int)Math.Ceiling(rpb.UpperRight.X); 154 if (ymin > rpb.LowerLeft.Y) ymin = (int)Math.Floor(rpb.LowerLeft.Y); 155 if (ymax < rpb.UpperRight.Y) ymax = (int)Math.Ceiling(rpb.UpperRight.Y); 156 } 157 Size = new Size(xmax - xmin, ymax - ymin); 158 var width = Size.Width; 159 var height = Size.Height; 161 160 // draw a rectangle to mark the countour of this tile 162 var size = this.Size; 163 var height = size.Height; 164 var rectangle = new Rectangle(this.Chart, new PointD(0, 0), new PointD(size.Width, size.Height)) { 161 var rectangle = new Rectangle(this.Chart, new PointD(0, 0), new PointD(width, height)) { 165 162 Pen = new Pen(Color.Gray), 166 163 Brush = new SolidBrush(Color.Transparent) … … 168 165 this.Add(rectangle); 169 166 167 // flip primitives vertically 170 168 foreach (var primitive in Primitives) { 171 169 var rpb = primitive as RectangularPrimitiveBase; 172 170 if (rpb != null) { 173 171 rpb.SetPosition(rpb.LowerLeft.X, height - rpb.UpperRight.Y, rpb.UpperRight.X, height - rpb.LowerLeft.Y); 172 174 173 } else { 175 174 var line = primitive as LinearPrimitiveBase;
Note: See TracChangeset
for help on using the changeset viewer.