com.mindfusion.diagramming
Class OneWayLayout

java.lang.Object
  extended by com.mindfusion.diagramming.AbstractLayout
      extended by com.mindfusion.diagramming.OneWayLayout

public class OneWayLayout
extends AbstractLayout

Implements a one-way graph layout algorithm. The one-way layout ensures that links enter into nodes from the same general direction and exit them from the opposite side. If the graph contains cycles, some links bend around the nodes to keep the enter/exit direction consistent. The algorithm aims to minimize the number of such links.


Constructor Summary
OneWayLayout()
          Initializes a new instance of the OneWayLayout class with the default settings.
 
Method Summary
 boolean arrange(Diagram diagram, DiagramItemList items)
          Applies the layout to the specified diagram.
protected  XDimension2D.Double getDefaultMarginValue()
          Gets the default value of the Margins property.
 float getNodeDistance()
          Gets the minimum spacing between adjacent nodes in the final layout.
 int getOrientation()
          Gets the orientation of the arranged graph.
 boolean getRoundedLinks()
          Gets a value indicating whether the layout should smooth link bends.
 void setNodeDistance(float value)
          Sets the minimum spacing between adjacent nodes in the final layout.
 void setOrientation(int value)
          Sets the orientation of the arranged graph.
 void setRoundedLinks(boolean value)
          Sets a value indicating whether the layout should smooth link bends.
 
Methods inherited from class com.mindfusion.diagramming.AbstractLayout
arrange, getAnchoring, getKeepGroupLayout, getLayoutLink, getLayoutNode, getMargins, getMultipleGraphsPlacement, getProgress, removeMidleSegmentPoint, setAnchoring, setKeepGroupLayout, setLayoutLink, setLayoutNode, setMargins, setMultipleGraphsPlacement, setProgress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OneWayLayout

public OneWayLayout()
Initializes a new instance of the OneWayLayout class with the default settings.

Method Detail

arrange

public boolean arrange(Diagram diagram,
                       DiagramItemList items)
Applies the layout to the specified diagram.

Specified by:
arrange in class AbstractLayout
Parameters:
diagram - The Diagram that should be arranged.
items - A collection of nodes and links from diagram that define the subgraph to arrange.
Returns:
true if the diagram has been arranged successfully; otherwise, false.

getDefaultMarginValue

protected XDimension2D.Double getDefaultMarginValue()
Gets the default value of the Margins property.


getRoundedLinks

public boolean getRoundedLinks()
Gets a value indicating whether the layout should smooth link bends.


setRoundedLinks

public void setRoundedLinks(boolean value)
Sets a value indicating whether the layout should smooth link bends.


getOrientation

public int getOrientation()
Gets the orientation of the arranged graph.

Returns:
One of the Orientation constants.

setOrientation

public void setOrientation(int value)
Sets the orientation of the arranged graph.

Parameters:
value - One of the Orientation constants.

getNodeDistance

public float getNodeDistance()
Gets the minimum spacing between adjacent nodes in the final layout.


setNodeDistance

public void setNodeDistance(float value)
Sets the minimum spacing between adjacent nodes in the final layout.