JGraph X 1.3.0.0

## com.mxgraph.layout
Class mxFastOrganicLayout

    java.lang.Object
      com.mxgraph.layout.mxGraphLayout
          com.mxgraph.layout.mxFastOrganicLayout

All Implemented Interfaces:
  mxIGraphLayout

    public class mxFastOrganicLayout

extends mxGraphLayout

Fast organic layout algorithm.

Field Summary
`protected boolean` `allowedToRun` Boolean flag that specifies if the layout is allowed to run.
`protected double[][]` `cellLocation` An array of locally stored co-ordinate positions for the vertices.
`protected boolean` `disableEdgeStyle` Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are modified by the result.
`protected double[]` `dispX` An array of locally stored X co-ordinate displacements for the vertices.
`protected double[]` `dispY` An array of locally stored Y co-ordinate displacements for the vertices.
`protected double` `forceConstant` The force constant by which the attractive forces are divided and the replusive forces are multiple by the square of.
`protected double` `forceConstantSquared` Cache of <forceConstant>^2 for performance.
`protected java.util.Hashtable<java.lang.Object,java.lang.Integer>` `indices` Maps from vertices to indices.
`protected double` `initialTemp` Start value of temperature.
`protected boolean[]` `isMoveable` Array of booleans representing the movable states of the vertices.
`protected int` `iteration` Current iteration count.
`protected int` `maxIterations` Total number of iterations to run the layout though.
`protected double` `minDistanceLimit` Minimal distance limit.
`protected double` `minDistanceLimitSquared` Cached version of <minDistanceLimit> squared.
`protected int[][]` `neighbours` Local copy of cell neighbours.
`protected double[]` `radius` The approximate radius of each cell, nodes only.
`protected double[]` `radiusSquared` The approximate radius squared of each cell, nodes only.
`protected boolean` `resetEdges` Specifies if all edge points of traversed edges should be removed.
`protected double` `temperature` Temperature to limit displacement at later stages of layout.
`protected boolean` `useInputOrigin` Specifies if the top left corner of the input cells should be the origin of the layout result.
`protected java.lang.Object[]` `vertexArray` An array of all vertices to be laid out.

Fields inherited from class com.mxgraph.layout.mxGraphLayout
`graph, useBoundingBox`

Constructor Summary
`mxFastOrganicLayout(mxGraph graph)` Constructs a new fast organic layout for the specified graph.

Method Summary
`protected void` `calcAttraction()` Calculates the attractive forces between all laid out nodes linked by edges
`protected void` `calcPositions()` Takes the displacements calculated for each cell and applies them to the local cache of cell positions.
`protected void` `calcRepulsion()` Calculates the repulsive forces between all laid out nodes
`void` `execute(java.lang.Object parent)` Executes the layout for the children of the specified parent.
`double` `getForceConstant()`
`double` `getInitialTemp()`
`int` `getMaxIterations()`
`double` `getMinDistanceLimit()`
`boolean` `isDisableEdgeStyle()`
`boolean` `isResetEdges()`
`boolean` `isUseInputOrigin()`
`boolean` `isVertexIgnored(java.lang.Object vertex)` Returns a boolean indicating if the given <mxCell> should be ignored as a vertex.
`void` `moveCell(java.lang.Object cell, double x, double y)` Notified when a cell is being moved in a parent that has automatic layout to update the cell state (eg.
`protected void` `reduceTemperature()` Reduces the temperature of the layout from an initial setting in a linear fashion to zero.
`void` `setDisableEdgeStyle(boolean value)`
`void` `setForceConstant(double value)`
`void` `setInitialTemp(double value)`
`void` `setMaxIterations(int value)`
`void` `setMinDistanceLimit(double value)`
`void` `setResetEdges(boolean value)`
`void` `setUseInputOrigin(boolean value)`

Methods inherited from class com.mxgraph.layout.mxGraphLayout
`getConstraint, getConstraint, getGraph, getVertexBounds, isEdgeIgnored, isUseBoundingBox, isVertexMovable, setEdgePoints, setEdgeStyleEnabled, setUseBoundingBox, setVertexLocation`

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

Field Detail

### useInputOrigin

    protected boolean useInputOrigin

  Specifies if the top left corner of the input cells should be the origin of the layout result. Default is true.

### resetEdges

    protected boolean resetEdges

  Specifies if all edge points of traversed edges should be removed. Default is true.

### disableEdgeStyle

    protected boolean disableEdgeStyle

  Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are modified by the result. Default is true.

### forceConstant

    protected double forceConstant

  The force constant by which the attractive forces are divided and the replusive forces are multiple by the square of. The value equates to the average radius there is of free space around each node. Default is 50.

### forceConstantSquared

    protected double forceConstantSquared

  Cache of <forceConstant>^2 for performance.

### minDistanceLimit

    protected double minDistanceLimit

  Minimal distance limit. Default is 2. Prevents of dividing by zero.

### minDistanceLimitSquared

    protected double minDistanceLimitSquared

  Cached version of <minDistanceLimit> squared.

### initialTemp

    protected double initialTemp

  Start value of temperature. Default is 200.

### temperature

    protected double temperature

  Temperature to limit displacement at later stages of layout.

### maxIterations

    protected int maxIterations

  Total number of iterations to run the layout though.

### iteration

    protected int iteration

  Current iteration count.

### vertexArray

    protected java.lang.Object[] vertexArray

  An array of all vertices to be laid out.

### dispX

    protected double[] dispX

  An array of locally stored X co-ordinate displacements for the vertices.

### dispY

    protected double[] dispY

  An array of locally stored Y co-ordinate displacements for the vertices.

### cellLocation

    protected double[][] cellLocation

  An array of locally stored co-ordinate positions for the vertices.

### radius

    protected double[] radius

  The approximate radius of each cell, nodes only.

### radiusSquared

    protected double[] radiusSquared

  The approximate radius squared of each cell, nodes only.

### isMoveable

    protected boolean[] isMoveable

  Array of booleans representing the movable states of the vertices.

### neighbours

    protected int[][] neighbours

  Local copy of cell neighbours.

### allowedToRun

    protected boolean allowedToRun

  Boolean flag that specifies if the layout is allowed to run. If this is set to false, then the layout exits in the following iteration.

### indices

    protected java.util.Hashtable<java.lang.Object,java.lang.Integer> indices

  Maps from vertices to indices.

Constructor Detail

### mxFastOrganicLayout

    public mxFastOrganicLayout(mxGraph graph)

  Constructs a new fast organic layout for the specified graph.

Method Detail

### isVertexIgnored

    public boolean isVertexIgnored(java.lang.Object vertex)

  Returns a boolean indicating if the given <mxCell> should be ignored as a vertex. This returns true if the cell has no connections.

  Overrides:
    `isVertexIgnored` in class `mxGraphLayout`
  Parameters:
    `vertex` - Object that represents the vertex to be tested.
  Returns:
    Returns true if the vertex should be ignored.

### isUseInputOrigin

    public boolean isUseInputOrigin()

### setUseInputOrigin

    public void setUseInputOrigin(boolean value)

  Parameters:
    `value` -

### isResetEdges

    public boolean isResetEdges()

### setResetEdges

    public void setResetEdges(boolean value)

  Parameters:
    `value` -

### isDisableEdgeStyle

    public boolean isDisableEdgeStyle()

### setDisableEdgeStyle

    public void setDisableEdgeStyle(boolean value)

  Parameters:
    `value` -

### getMaxIterations

    public int getMaxIterations()

### setMaxIterations

    public void setMaxIterations(int value)

  Parameters:
    `value` -

### getForceConstant

    public double getForceConstant()

### setForceConstant

    public void setForceConstant(double value)

  Parameters:
    `value` -

### getMinDistanceLimit

    public double getMinDistanceLimit()

### setMinDistanceLimit

    public void setMinDistanceLimit(double value)

  Parameters:
    `value` -

### getInitialTemp

    public double getInitialTemp()

### setInitialTemp

    public void setInitialTemp(double value)

  Parameters:
    `value` -

### reduceTemperature

    protected void reduceTemperature()

  Reduces the temperature of the layout from an initial setting in a linear fashion to zero.

### moveCell

    public void moveCell(java.lang.Object cell,
                         double x,
                         double y)

  Description copied from interface: `mxIGraphLayout`
  Notified when a cell is being moved in a parent that has automatic layout to update the cell state (eg. index) so that the outcome of the layout will position the vertex as close to the point (x, y) as possible.

  Specified by:
    `moveCell` in interface `mxIGraphLayout`
  Overrides:
    `moveCell` in class `mxGraphLayout`
  Parameters:
    `cell` - Cell which is being moved.
    `x` - X-coordinate of the new cell location.
    `y` - Y-coordinate of the new cell location.

### execute

    public void execute(java.lang.Object parent)

  Description copied from interface: `mxIGraphLayout`
  Executes the layout for the children of the specified parent.

  Parameters:
    `parent` - Parent cell that contains the children to be layed out.

### calcPositions

    protected void calcPositions()

  Takes the displacements calculated for each cell and applies them to the local cache of cell positions. Limits the displacement to the current temperature.

### calcAttraction

    protected void calcAttraction()

  Calculates the attractive forces between all laid out nodes linked by edges

### calcRepulsion

    protected void calcRepulsion()

  Calculates the repulsive forces between all laid out nodes

JGraph X 1.3.0.0

Copyright (c) 2008 Gaudenz Alder. All rights reserved.