Ignore:
Timestamp:
09/07/16 15:20:29 (5 years ago)
Author:
bburlacu
Message:

#2288: Clean up code and add comments in the ConstrainedForceDirectedLayout class. Minor changes to view and directed graph chart. Introduced an INetworkNode interface for more flexibility. Updated cola and adaptagrams dlls with latest changes from upstream.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/DirectedGraphChart.cs

    r13893 r14275  
    3939    public new Bitmap Picture { get { return base.Picture; } }
    4040
    41     private ConstrainedForceDirectedLayout layout;
     41    private readonly ConstrainedForceDirectedLayout layout;
    4242    // provide direct and reverse mapping between graph objects and layout shapes
    4343    private Dictionary<IPrimitive, IVertex> vertexMap;
     
    4747
    4848    // 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    }
    5263
    5364    public IVertex GetVertex(IPrimitive primitive) {
     
    8798      shapes = new Dictionary<Type, LabeledPrimitive>();
    8899      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      };
    90107    }
    91108
     
    124141        vertexRectangles[v] = new RectangleF(x, y, width, height);
    125142      }
    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 = RoutingMode
    134       };
    135143
    136144      var arcs = graph.Vertices.SelectMany(x => x.InArcs).ToList();
     
    236244
    237245    private void ShapeRedrawRequired(object sender, EventArgs args) {
    238       layout.Run();
    239246    }
    240247
Note: See TracChangeset for help on using the changeset viewer.