Module imp2d

Class Layout

All Implemented Interfaces:
Manageable, Shareable
Direct Known Subclasses:
CircleGraphLayout, EdgeBasedLayout, EnergyModelLayout, ForceBasedLayout, ForceBasedLayout2, GeneralPurposeLayout, HierarchyLayout, RandomLayout, SquareLayout, SugiyamaLayout, TouchLayout, TreeLayout

public abstract class Layout extends ShareableBase
This class is the abstract base class for two-dimensional graph layouts. A layout is performed for a View2D using the #invoke(View2D)-method, the actual work is done in an instance of Algorithm which is returned by createAlgorithm().

In order to simplify the task of layouting, the graph of the view's scene is transformed into a layout graph consisting of Node and Edge. The layout is then performed on the x- and y-fields of these nodes, which specify global coordinates. Finally, the layouted global coordinates are written back into the original graph.

Author:
Ole Kniemeyer
  • Field Details

    • $TYPE

      public static final Layout.Type $TYPE
    • fit$FIELD

      public static final SCOType.Field fit$FIELD
    • transformationSteps$FIELD

      public static final SCOType.Field transformationSteps$FIELD
  • Constructor Details

    • Layout

      public Layout()
  • Method Details

    • setParam

      public void setParam(int param)
    • getParam

      public int getParam()
    • createAlgorithm

      protected abstract Layout.Algorithm createAlgorithm()
      Creates an algorithm for this layout.
      Returns:
      a new Algorithm instance
    • invoke

      public Layout.Algorithm invoke(View2D view, Layout.Algorithm algo)
      This method is invoked by a View2D. It invokes the run-method of the algorithm of this layout, or of algo if this is not null. If this invocation returns true, the algorithm is returned by this method, otherwise it returns null. If the returned value is not null, the invoking View2D re-invokes this method with the returned value as algo.
      Parameters:
      view - invoking view
      algo - existing algorithm instance to use, or null
      Returns:
      a non-null instance if this method should be re-invoked by view, this is then passes as algo-parameter
    • setRedraw

      public void setRedraw(boolean value)
    • setTransformationSteps

      public void setTransformationSteps(int value)