Class AggregateLayout<V,E>

java.lang.Object
edu.uci.ics.jung.algorithms.layout.AggregateLayout<V,E>
Type Parameters:
V - the vertex type
E - the edge type
All Implemented Interfaces:
com.google.common.base.Function<V,Point2D>, Layout<V,E>, IterativeContext, Function<V,Point2D>

public class AggregateLayout<V,E> extends Object implements Layout<V,E>, IterativeContext
A Layout implementation that combines multiple other layouts so that they may be manipulated as one layout. The relaxer thread will step each layout in sequence.
  • Field Details

  • Constructor Details

    • AggregateLayout

      public AggregateLayout(Layout<V,E> delegate)
      Creates an instance backed by the specified delegate.
      Parameters:
      delegate - the layout to which this instance is delegating
  • Method Details

    • getDelegate

      public Layout<V,E> getDelegate()
      Returns:
      the delegate
    • setDelegate

      public void setDelegate(Layout<V,E> delegate)
      Parameters:
      delegate - the delegate to set
    • put

      public void put(Layout<V,E> layout, Point2D center)
      Adds the passed layout as a sublayout, and specifies the center of where this sublayout should appear.
      Parameters:
      layout - the layout algorithm to use as a sublayout
      center - the center of the coordinates for the sublayout
    • get

      public Point2D get(Layout<V,E> layout)
      Parameters:
      layout - the layout whose center is to be returned
      Returns:
      the center of the passed layout
    • remove

      public void remove(Layout<V,E> layout)
      Removes layout from this instance.
      Parameters:
      layout - the layout to remove
    • removeAll

      public void removeAll()
      Removes all layouts from this instance.
    • getGraph

      public Graph<V,E> getGraph()
      Specified by:
      getGraph in interface Layout<V,E>
      Returns:
      the graph that this Layout refers to
    • getSize

      public Dimension getSize()
      Specified by:
      getSize in interface Layout<V,E>
      Returns:
      the current size of the visualization's space
    • initialize

      public void initialize()
      Description copied from interface: Layout
      Initializes fields in the node that may not have been set during the constructor. Must be called before the iterations begin.
      Specified by:
      initialize in interface Layout<V,E>
    • isLocked

      public boolean isLocked(V v)
      Specified by:
      isLocked in interface Layout<V,E>
      Parameters:
      v - the vertex whose locked state is to be returned
      Returns:
      true if v is locked in any of the layouts, and false otherwise
    • lock

      public void lock(V v, boolean state)
      Locks this vertex in the main layout and in any sublayouts whose graph contains this vertex.
      Specified by:
      lock in interface Layout<V,E>
      Parameters:
      v - the vertex whose locked state is to be set
      state - true if the vertex is to be locked, and false if unlocked
    • reset

      public void reset()
      Specified by:
      reset in interface Layout<V,E>
    • setGraph

      public void setGraph(Graph<V,E> graph)
      Specified by:
      setGraph in interface Layout<V,E>
      Parameters:
      graph - the graph that this algorithm is to operate on
    • setInitializer

      public void setInitializer(com.google.common.base.Function<V,Point2D> initializer)
      Specified by:
      setInitializer in interface Layout<V,E>
      Parameters:
      initializer - a function that specifies initial locations for all vertices
    • setLocation

      public void setLocation(V v, Point2D location)
      Description copied from interface: Layout
      Changes the layout coordinates of v to location.
      Specified by:
      setLocation in interface Layout<V,E>
      Parameters:
      v - the vertex whose location is to be specified
      location - the coordinates of the specified location
    • setSize

      public void setSize(Dimension d)
      Specified by:
      setSize in interface Layout<V,E>
      Parameters:
      d - the space to use to lay out this graph
    • getLayouts

      public Map<Layout<V,E>,Point2D> getLayouts()
      Returns:
      a map from each Layout instance to its center point.
    • apply

      public Point2D apply(V v)
      Returns the location of the vertex. The location is specified first by the sublayouts, and then by the base layout if no sublayouts operate on this vertex.
      Specified by:
      apply in interface com.google.common.base.Function<V,E>
      Specified by:
      apply in interface Function<V,E>
      Returns:
      the location of the vertex
    • done

      public boolean done()
      Specified by:
      done in interface IterativeContext
      Returns:
      true iff the delegate layout and all sublayouts are done
    • step

      public void step()
      Call step on any sublayout that is also an IterativeContext and is not done
      Specified by:
      step in interface IterativeContext