Changeset 10730
- Timestamp:
- 04/08/14 17:23:51 (11 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified 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; -
TabularUnified branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs ¶
r10650 r10730 196 196 // new node has been selected, clean up 197 197 Chart.UpdateEnabled = false; 198 if (ModifierKeys != Keys.Shift) 198 if (ModifierKeys != Keys.Shift) { 199 199 // clear colors 200 200 ClearPrimitives(); 201 } 201 202 // use a rectangle to highlight the currently selected genealogy graph node 202 203 var gNode = SelectedVisualNode.Data; … … 222 223 #endregion 223 224 224 private void DrawLineage(VisualGenealogyGraphNode node, Func<VisualGenealogyGraphNode, IEnumerable<VisualGenealogyGraphArc>> arcSelector, Func<VisualGenealogyGraphArc, VisualGenealogyGraphNode> nodeSelector) {225 private static void DrawLineage(VisualGenealogyGraphNode node, Func<VisualGenealogyGraphNode, IEnumerable<VisualGenealogyGraphArc>> arcSelector, Func<VisualGenealogyGraphArc, VisualGenealogyGraphNode> nodeSelector) { 225 226 if (node.Brush != null) return; 226 227 node.Brush = new SolidBrush(node.Data.GetColor()); 227 var arcs = arcSelector(node); 228 if (arcs == null) return; 229 228 var arcs = arcSelector(node).ToList(); 230 229 foreach (var arc in arcs) { 231 230 var source = arc.Source.Data; … … 235 234 arc.Pen.Brush = new LinearGradientBrush(start, end, source.GetColor(), target.GetColor()); 236 235 arc.Pen.Color = Color.Transparent; 237 // arc.Pen.FontBrush = new SolidBrush(Color.DarkGray);236 // if (arc == arcs[0]) { arc.Pen.Width = 2; } // mark connection to the root parent 238 237 DrawLineage(nodeSelector(arc), arcSelector, nodeSelector); 239 238 } -
TabularUnified branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/VisualGenealogyGraphNode.cs ¶
r10271 r10730 70 70 } 71 71 72 public override void SetPosition(PointD low Left, PointD upRight) {73 base.SetPosition(low Left, upRight);72 public override void SetPosition(PointD lowerLeft, PointD upperRight) { 73 base.SetPosition(lowerLeft, upperRight); 74 74 foreach (var a in IncomingArcs) a.UpdatePosition(); 75 75 foreach (var a in OutgoingArcs) a.UpdatePosition(); … … 83 83 Point p = Chart.TransformWorldToPixel(new PointD(LowerLeft.X, LowerLeft.Y + Size.Height)); 84 84 Size s = Chart.TransformWorldToPixel(Size); 85 if (Brush != null) 85 if (Brush != null) { 86 86 graphics.FillEllipse(Brush, p.X, p.Y, s.Width, s.Height); 87 graphics.DrawEllipse(Pen, p.X, p.Y, s.Width, s.Height); 88 if (Data.IsElite) { 89 graphics.DrawEllipse(Pen, p.X + 2, p.Y + 2, s.Width - 4, s.Height - 4); 87 graphics.DrawEllipse(Pen, p.X, p.Y, s.Width, s.Height); 88 if (Data.IsElite) { 89 graphics.DrawEllipse(Pen, p.X + 2, p.Y + 2, s.Width - 4, s.Height - 4); 90 } 90 91 } 91 92 } -
TabularUnified branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/FragmentGraphView.cs ¶
r10729 r10730 7 7 using HeuristicLab.EvolutionTracking; 8 8 using HeuristicLab.MainForm; 9 using HeuristicLab.Visualization; 9 10 10 11 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { … … 59 60 60 61 private void Draw() { 61 var root = Content.Nodes.First(); 62 62 var chart = symbolicExpressionChartControl.Chart; 63 var nodes = Content.Nodes.ToList(); 64 var root = nodes[0]; 63 65 var fragmentRoot = tileDictionary[root]; 64 66 int maxTileWidth = 0, maxTileHeight = 0; 65 foreach (var tile in Content.Nodes.Select(x => tileDictionary[x].Tile)) { 67 var tiles = nodes.Select(x => tileDictionary[x].Tile).ToList(); 68 69 foreach (var tile in tiles) { 66 70 var size = tile.Size; 67 71 if (maxTileWidth < size.Width) maxTileWidth = size.Width; … … 80 84 tile.Position = new Point(visualNode.X, visualNode.Y); 81 85 symbolicExpressionChartControl.Add(tile); 86 } 87 88 // add connections between the tiles 89 foreach (var node in nodes) { 90 var aTile = tileDictionary[node].Tile; 91 var aSize = aTile.Size; 92 var aPos = aTile.Position; 93 94 var lowerLeftMarker = new FixedSizeCircle(chart, aTile.Position, 5, new Pen(Color.Red), new SolidBrush(Color.Transparent)); 95 var upperRightMarker = new FixedSizeCircle(chart, new PointD(aPos.X + aSize.Width, aPos.Y + aSize.Height), 5, 96 new Pen(Color.Blue), new SolidBrush(Color.Transparent)); 97 symbolicExpressionChartControl.Add(lowerLeftMarker); symbolicExpressionChartControl.Add(upperRightMarker); 98 99 foreach (var child in node.Children) { 100 var bTile = tileDictionary[child].Tile; 101 var bSize = bTile.Size; 102 var bPos = bTile.Position; 103 104 var line = new Line(chart, new PointD(aPos.X + aSize.Width / 2.0, aPos.Y + aSize.Height), new PointD(bPos.X + bSize.Width / 2.0, bPos.Y)); 105 symbolicExpressionChartControl.Add(line); 106 } 82 107 } 83 108 // symbolicExpressionChartControl.FlipVertical(); -
TabularUnified branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymboldDataAnalysisGenealogyView.cs ¶
r10725 r10730 82 82 symbolicExpressionTreeChart.Tree = tree; 83 83 84 if (graphNode.InArcs != null) {84 if (graphNode.InArcs.Any()) { 85 85 var fragment = (IFragment<ISymbolicExpressionTreeNode>)graphNode.InArcs.Last().Data; 86 86 treeChart_HighlightSubtree(fragment.Root);
Note: See TracChangeset
for help on using the changeset viewer.