Changeset 14275 for branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/DirectedGraphChart.cs
- Timestamp:
- 09/07/16 15:20:29 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/DirectedGraphChart.cs
r13893 r14275 39 39 public new Bitmap Picture { get { return base.Picture; } } 40 40 41 private ConstrainedForceDirectedLayout layout;41 private readonly ConstrainedForceDirectedLayout layout; 42 42 // provide direct and reverse mapping between graph objects and layout shapes 43 43 private Dictionary<IPrimitive, IVertex> vertexMap; … … 47 47 48 48 // graph layout options 49 public double IdealEdgeLength { get; set; } 50 public bool PerformEdgeRouting { get; set; } 51 public Routing RoutingMode { get; set; } 49 public double DefaultEdgeLength { 50 get { return layout.DefaultEdgeLength; } 51 set { layout.DefaultEdgeLength = value; } 52 } 53 54 public bool PerformEdgeRouting { 55 get { return layout.PerformEdgeRouting; } 56 set { layout.PerformEdgeRouting = value; } 57 } 58 59 public Routing RoutingMode { 60 get { return layout.EdgeRoutingMode; } 61 set { layout.EdgeRoutingMode = value; } 62 } 52 63 53 64 public IVertex GetVertex(IPrimitive primitive) { … … 87 98 shapes = new Dictionary<Type, LabeledPrimitive>(); 88 99 SmoothingMode = SmoothingMode.HighQuality; // set antialiasing for nicer rendering 89 IdealEdgeLength = 50; 100 101 layout = new ConstrainedForceDirectedLayout { 102 LayoutWidth = (int)Chart.Size.Width, 103 LayoutHeight = (int)Chart.Size.Height, 104 MinHorizontalSpacing = 0, 105 MinVerticalSpacing = 0, 106 }; 90 107 } 91 108 … … 124 141 vertexRectangles[v] = new RectangleF(x, y, width, height); 125 142 } 126 layout = new ConstrainedForceDirectedLayout {127 DefaultEdgeLength = IdealEdgeLength,128 PerformEdgeRouting = PerformEdgeRouting,129 LayoutWidth = (int)Chart.Size.Width,130 LayoutHeight = (int)Chart.Size.Height,131 MinHorizontalSpacing = 0,132 MinVerticalSpacing = 0,133 EdgeRoutingMode = RoutingMode134 };135 143 136 144 var arcs = graph.Vertices.SelectMany(x => x.InArcs).ToList(); … … 236 244 237 245 private void ShapeRedrawRequired(object sender, EventArgs args) { 238 layout.Run();239 246 } 240 247
Note: See TracChangeset
for help on using the changeset viewer.