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

## samples.preview_new_graphdraw.iterablelayouts
Class SpringLayout

    java.lang.Object
      samples.preview_new_graphdraw.iter.IterableLayout
          samples.preview_new_graphdraw.iter.UpdatableIterableLayout
              samples.preview_new_graphdraw.iterablelayouts.SpringLayout

All Implemented Interfaces:
  LayoutEmitter

Direct Known Subclasses:
  CrookedSpringLayout

public class SpringLayout
extends UpdatableIterableLayout

The SpringLayout package represents a visualization of a set of nodes. The SpringLayout, which is initialized with a Graph, assigns X/Y locations to each node. When called `relax()`, the SpringLayout moves the visualization forward one step.

Nested Class Summary
`protected static class` | `SpringLayout.SpringEdge`
`protected static class` | `SpringLayout.SpringVertex`

Field Summary
`protected static double` | `FORCE_CONSTANT`
`static int` | `RANGE`
`static int` | `STRETCH`

Fields inherited from class samples.preview_new_graphdraw.iter.IterableLayout
`currentLayout, returnableLayout`

Constructor Summary
`SpringLayout()`

Method Summary
`protected VisEdge` | `addVisEdge(Edge e)` Creates and returns a default VisEdge based on `e`.
`protected VisVertex` | `addVisVertex(Vertex v)` Creates and returns a default VisVertex based on `v`.
`void` | `calculate()` Relaxation step.
`protected void` | `calculateRepulsion(Set vertices)`
`protected VisEdge` | `createVisEdge(Edge ve, VisVertex front, VisVertex back)`
`protected VisVertex` | `createVisVertex(VisVertex ve)`
`protected Vertex` | `getAVertex(Edge e)`
`double` | `getLength(Edge e)`
`void` | `initializeLocationsFromLayout(EmittedLayout el)` Starts up this layout based on a previous layout.
`boolean` | `isFinite()` Says whether this algorthms' iterations will ever end.
`boolean` | `iterationsAreDone()` Gives the outlining algorithm a sense of how long to run.
`protected void` | `moveNodes(Set vertices)`
`protected void` | `relaxEdges(Set edges)`

Methods inherited from class samples.preview_new_graphdraw.iter.UpdatableIterableLayout
`cleanupReferences, getSymmetricDifference, removeEdge, removeVertex, updateGraph, updateGraphToMatch`

Methods inherited from class samples.preview_new_graphdraw.iter.IterableLayout
`advance, emit, getScreenSize, getVisEdge, getVisVertex`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### RANGE

    public static final int RANGE

See Also:
  Constant Field Values

### FORCE_CONSTANT

    protected static final double FORCE_CONSTANT

See Also:
  Constant Field Values

### STRETCH

    public static final int STRETCH

See Also:
  Constant Field Values

Constructor Detail

### SpringLayout

    public SpringLayout()

Method Detail

### createVisVertex

    protected VisVertex createVisVertex(VisVertex ve)

### createVisEdge

    protected VisEdge createVisEdge(Edge ve,
                                    VisVertex front,
                                    VisVertex back)

### initializeLocationsFromLayout

    public void initializeLocationsFromLayout(EmittedLayout el)

  Description copied from class: `IterableLayout`
  Starts up this layout based on a previous layout. It is reasonable to assume that this method will be called only once. After this method is complete, a CURRENT LAYOUT should be defined with the current states of the vertices, and a RETURNABLE LAYOUT should be defined for emit() to return. In general, emit() will just return this copy of the layout stored in returnableLayout, so this method and advance() are both respon sible for advancing correctly.

  Overrides:
    `initializeLocationsFromLayout` in class `IterableLayout`

### calculate

    public void calculate()

  Relaxation step. Moves all nodes a smidge.

  Specified by:
    `calculate` in class `IterableLayout`

### getAVertex

    protected Vertex getAVertex(Edge e)

### relaxEdges

    protected void relaxEdges(Set edges)

### calculateRepulsion

    protected void calculateRepulsion(Set vertices)

### moveNodes

    protected void moveNodes(Set vertices)

### getLength

    public double getLength(Edge e)

### iterationsAreDone

    public boolean iterationsAreDone()

  Description copied from class: `IterableLayout`
  Gives the outlining algorithm a sense of how long to run. The algorithm is responsible for setting its own thresholds. Note that this should return a meaningful value (probably "false") even before initialize has been called.

  Specified by:
    `iterationsAreDone` in class `IterableLayout`
  See Also:
    `IterableLayout.iterationsAreDone()`

### isFinite

    public boolean isFinite()

  Description copied from class: `IterableLayout`
  Says whether this algorthms' iterations will ever end. (If not, there's no real use to waiting.)

  Specified by:
    `isFinite` in class `IterableLayout`
  See Also:
    `IterableLayout.isFinite()`

### addVisEdge

    protected VisEdge addVisEdge(Edge e)

  Description copied from class: `UpdatableIterableLayout`
  Creates and returns a default VisEdge based on `e`. Note that if you have overridden removeEdge, then an entry MAY ALREADY EXIST! (This version does not check) // TODO THIS VERSION SHOUDL CHECK

  Overrides:
    `addVisEdge` in class `UpdatableIterableLayout`
  Parameters:
    `e` -
  Returns:
  See Also:
    `UpdatableIterableLayout.addVisEdge(edu.uci.ics.jung.graph.Edge)`

### addVisVertex

    protected VisVertex addVisVertex(Vertex v)

  Description copied from class: `UpdatableIterableLayout`
  Creates and returns a default VisVertex based on `v`. Default implementation places the new vertex at a RANDOM location. Override to place someplace more sensible. Note that if you have overridden removeEdge, then an entry MAY ALREADY EXIST! (This version does not check) // TODO THIS VERSION SHOUDL CHECK

  Overrides:
    `addVisVertex` in class `UpdatableIterableLayout`
  See Also:
    `UpdatableIterableLayout.addVisVertex(edu.uci.ics.jung.graph.Vertex)`

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