Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.uci.ics.jung.visualization
Interface Layout

All Superinterfaces:
  VertexLocationFunction

All Known Subinterfaces:
  LayoutMutable, PersistentLayout

All Known Implementing Classes:
  AbstractLayout, FadingVertexLayout, FRLayout, LayoutDecorator, PersistentLayoutImpl, SpringLayout, TreeLayout

public interface Layout
extends VertexLocationFunction

A generalized interface is a mechanism for returning (x,y) coordinates from vertices. In general, most of these methods are used to both control and get information from the layout algorithm.

Some of the additional complexity comes from the desire to give allow users to click on particular nodes and "lock" them in place. Therefore, there are calls to query the nodes for the nearest to a particular location, and calls to label a node as locked.

Many layout algorithms are incremental, and place nodes based on their previous location. This system supports them; it progresses the visualization only if `isIncremental` is `true`.

The Layout concept is also prepared to deal with filtered subgraphs. Once the Layout was constructed with a Graph, it can accept calls to ``applyFilter(Graph)``, which set the set the current graph to a subset. The Layout is responsible for handling this new, smaller set by one of several strategies:

- Ignore the subset, and continue to place all the nodes. The renderer will only draw the subset.
- Lay out only the subset.

Author:
  danyelf

Method Summary
`void` | `advancePositions()` Advances an incremental visualization.
`void` | `applyFilter(Graph subgraph)` Sets this filtered graph to be the applicable graph.
`void` | `forceMove(Vertex picked, double x, double y)` Forces a node to be moved to location x,y
`Dimension` | `getCurrentSize()` Returns the current size of the visualization's space.
`Graph` | `getGraph()` Returns the full graph (the one that was passed in at construction time) that this Layout refers to.
`Point2D` | `getLocation(ArchetypeVertex v)`
`String` | `getStatus()` Returns the current status of the sytem, or null if there is no particular status to report.
`Vertex` | `getVertex(double x, double y)` Deprecated. Use PickSupport instead
`Vertex` | `getVertex(double x, double y, double maxDistance)` Deprecated. Use PickSupport instead
`Set` | `getVisibleEdges()` Deprecated. Use of this facility is discouraged and will be removed in future. For an alternative, see the `PluggableRenderer` method `setEdgeIncludePredicate`.
`Set` | `getVisibleVertices()` Deprecated. Use of this facility is discouraged and will be removed in future. For an alternative, see the `PluggableRenderer` method `setVertexIncludePredicate`.
`double` | `getX(Vertex v)` Returns the x coordinate of vertex v at this stage in the iteration.
`double` | `getY(Vertex v)` Returns the y coordinate of vertex v at this stage in the iteration.
`boolean` | `incrementsAreDone()` If this visualization is incremental, tells whether it has stabilized at a satisfactory spot yet.
`void` | `initialize(Dimension currentSize)` Initializes fields in the node that may not have been set during the constructor.
`boolean` | `isIncremental()` Indicates whether this visualization has an incremental mode.
`boolean` | `isLocked(Vertex v)` Returns `true` if the position of vertex `v` is locked.
`void` | `lockVertex(Vertex v)` Sets a flag which fixes this vertex in place.
`void` | `resize(Dimension d)` Resets the size of the visualization.
`void` | `restart()` Resets the vertex positions to their initial locations.
`void` | `unlockVertex(Vertex v)` Allows this vertex to be moved.

Methods inherited from interface edu.uci.ics.jung.visualization.VertexLocationFunction
`getVertexIterator`

Method Detail

### initialize

    public void initialize(Dimension currentSize)

  Initializes fields in the node that may not have been set during the constructor. Must be called before the iterations begin.

### getX

    public double getX(Vertex v)

  Returns the x coordinate of vertex v at this stage in the iteration.

  Parameters:
    `v` - The vertex being examined
  Returns:
    the x coordinate of that vertex

### getY

    public double getY(Vertex v)

  Returns the y coordinate of vertex v at this stage in the iteration.

  Parameters:
    `v` - The vertex being examined
  Returns:
    the y coordinate of that vertex

### getLocation

    public Point2D getLocation(ArchetypeVertex v)

  Specified by:
    `getLocation` in interface `VertexLocationFunction`

### applyFilter

    public void applyFilter(Graph subgraph)

  Sets this filtered graph to be the applicable graph. It is an error for the subgraph to not be a subgraph of the main graph.

  Parameters:
    `subgraph` - a filtered graph that is a subgraph of the Graph returned by `getGraph`

### getStatus

    public String getStatus()

  Returns the current status of the sytem, or null if there is no particular status to report. Useful for reporting things like number of iterations passed, temperature, and so on.

  Returns:
    the status, as a string

### restart

    public void restart()

  Resets the vertex positions to their initial locations.

### getVertex

    public Vertex getVertex(double x,
                            double y)

  Deprecated. Use PickSupport instead

  Finds the closest vertex to an input (x,y) coordinate. Useful for mouse clicks.

  Parameters:
    `x` - The x coordinate of the input
    `y` - The y coordinate of the input
  Returns:
    The nearest vertex. It is up to the user to check if it is satisfactorily close.

### getVertex

    public Vertex getVertex(double x,
                            double y,
                            double maxDistance)

  Deprecated. Use PickSupport instead

  Finds the closest vertex to an input (x,y) coordinate. Useful for mouse clicks.

  Parameters:
    `x` - The x coordinate of the input
    `y` - The y coordinate of the input
    `maxDistance` - The maximum acceptable distance. Beyond this, vertices are ignored.
  Returns:
    The nearest vertex. It is up to the user to check if it is satisfactorily close.

### getGraph

    public Graph getGraph()

  Returns the full graph (the one that was passed in at construction time) that this Layout refers to.

### resize

    public void resize(Dimension d)

  Resets the size of the visualization. One cannot count on a Visualizaton knowing its own size correctly until the following sequence has been called:

       Layout l = new XXXLayout( g )
       l.initialize();
       l.resize( this.getSize() );

  Parameters:
    `d` -

### advancePositions

    public void advancePositions()

  Advances an incremental visualization. Many visualizations are incremental--that is, they get better over time and recalculations. This moves it forward one step.

### isIncremental

    public boolean isIncremental()

  Indicates whether this visualization has an incremental mode. If so, it may be good to increment a bunch of times before showing. If not, the containing program may not wish to call increment.

### incrementsAreDone

    public boolean incrementsAreDone()

  If this visualization is incremental, tells whether it has stabilized at a satisfactory spot yet.

### lockVertex

    public void lockVertex(Vertex v)

  Sets a flag which fixes this vertex in place.

  Parameters:
    `v` - vertex
  See Also:
    `unlockVertex(Vertex)`, `isLocked(Vertex)`

### unlockVertex

    public void unlockVertex(Vertex v)

  Allows this vertex to be moved.

  Parameters:
    `v` - vertex
  See Also:
    `lockVertex(Vertex)`, `isLocked(Vertex)`

### isLocked

    public boolean isLocked(Vertex v)

  Returns `true` if the position of vertex `v` is locked.

  See Also:
    `lockVertex(Vertex)`, `unlockVertex(Vertex)`

### forceMove

    public void forceMove(Vertex picked,
                          double x,
                          double y)

  Forces a node to be moved to location x,y

  Parameters:
    `picked` -
    `x` -
    `y` -

### getVisibleEdges

    public Set getVisibleEdges()

  Deprecated. Use of this facility is discouraged and will be removed in future. For an alternative, see the `PluggableRenderer` method `setEdgeIncludePredicate`.

  Returns all currently showing edges

### getVisibleVertices

    public Set getVisibleVertices()

  Deprecated. Use of this facility is discouraged and will be removed in future. For an alternative, see the `PluggableRenderer` method `setVertexIncludePredicate`.

  Returns all currently visible vertices

### getCurrentSize

    public Dimension getCurrentSize()

  Returns the current size of the visualization's space.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD