Package | com.yworks.yfiles.layout.organic |
Class | public class InteractiveOrganicLayouter |
Inheritance | InteractiveOrganicLayouter YObject Object |
Implements | Layouter |
See also
Property | Defined By | ||
---|---|---|---|
automaticStructureUpdateEnabled : Boolean
Determines whether this algorithm performs automatic structure updates. | InteractiveOrganicLayouter | ||
lastWakeupTime : LongImpl [read-only]
Returns the time when the last wake-up has occurred
| InteractiveOrganicLayouter | ||
maxTime : uint
Getter:
Return the maximal time the layouter will run (in milliseconds). | InteractiveOrganicLayouter | ||
outputRestriction : OutputRestriction
Getter:
Returns the current OutputRestriction instance set for this instance. | InteractiveOrganicLayouter | ||
preferredEdgeLength : Number [write-only]
Sets the preferred edge length. | InteractiveOrganicLayouter | ||
preferredNodeDistance : Number [write-only]
Sets the preferred node distance. | InteractiveOrganicLayouter | ||
quality : Number
Getter:
The quality time ratio set. | InteractiveOrganicLayouter | ||
running : Boolean [read-only]
Returns whether the layouter is running at the moment. | InteractiveOrganicLayouter | ||
sleeping : Boolean [read-only]
Returns whether the layouter is sleeping. | InteractiveOrganicLayouter | ||
stopped : Boolean [read-only]
Returns whether the layouter has been stopped. | InteractiveOrganicLayouter | ||
workingRatio : Number
Getter:
Returns the actual working ratio. | InteractiveOrganicLayouter |
Method | Defined By | ||
---|---|---|---|
InteractiveOrganicLayouter(init:Boolean = true)
Create a new instance of the InteractiveOrganicLayouter. | InteractiveOrganicLayouter | ||
addStructureUpdate(runnable:Runnable):void
Adds a structural update to the queue. | InteractiveOrganicLayouter | ||
canLayout(graph:LayoutGraph):Boolean
Returns whether this layouter can layout the given graph. | InteractiveOrganicLayouter | ||
commitPositions():void
This method writes the calculated positions (represented by the internal data structure of this layouter) to the LayoutGraph. This method must only be called while the layouter is running running. final InteractiveOrganicLayouter layouter = new InteractiveOrganicLayouter(); new Thread( new Runnable() { public void run() { layouter.doLayout( copiedGraph ); } } ).start(); new javax.swing.Timer( 24, new ActionListener() { public void actionPerformed( ActionEvent e ) { layouter.commitPositions(); } } ).start(); There may occur synchronization issues, if doLayout() is not called using a CopiedLayoutGraph. | InteractiveOrganicLayouter | ||
commitPositionsSmoothly(maxMovement:Number, factor:Number):Number
This method transfers the calculated positions (represented by the internal data structure of this layouter) to the LayoutGraph. This method must only be called while the layouter is running running. The positions are not transferred directly. | InteractiveOrganicLayouter | ||
doLayout(graph:LayoutGraph):void
Calculates the layout for the graph. | InteractiveOrganicLayouter | ||
enableOnlyCore():void
Makes sure that the core of this layouter will not use the usual com.yworks.yfiles.layout.LayoutStage s, like com.yworks.yfiles.layout.ComponentLayouter, com.yworks.yfiles.layout.ParallelEdgeLayouter, etc. | InteractiveOrganicLayouter | ||
equals(o:Object):Boolean | YObject | ||
Return the actual center of the node
| InteractiveOrganicLayouter | ||
getCenterX(node:Node):Number
Return the actual center of the node. | InteractiveOrganicLayouter | ||
getCenterY(node:Node):Number
Return the actual center of the node. | InteractiveOrganicLayouter | ||
getClass():Class [override] | InteractiveOrganicLayouter | ||
Gets the stress for the given node. | InteractiveOrganicLayouter | ||
hashCode():int | YObject | ||
[static]
Create a new instance of the InteractiveOrganicLayouter. | InteractiveOrganicLayouter | ||
Sets the center for the node. | InteractiveOrganicLayouter | ||
setCenterX(node:Node, x:Number):void
Sets the center of the node. | InteractiveOrganicLayouter | ||
setCenterY(node:Node, y:Number):void
Sets the center of the node. | InteractiveOrganicLayouter | ||
setInertia(node:Node, inertia:Number):void
Set the inertia for the node. | InteractiveOrganicLayouter | ||
setPreferredEdgeLength(edge:Edge, newEdgeLength:Number):void
Sets the preferred edge length for the given edge. | InteractiveOrganicLayouter | ||
Sets the radius for the given node
| InteractiveOrganicLayouter | ||
Sets the stress for the given node. | InteractiveOrganicLayouter | ||
Creates a context object that provides methods to continue (com.yworks.yfiles.layout.organic.InteractiveOrganicLayouter_SingleThreadContext.doLayout()) and stop (com.yworks.yfiles.layout.organic.InteractiveOrganicLayouter_SingleThreadContext.stopLayout()) the layout calculation. | InteractiveOrganicLayouter | ||
stop():void
Stops the layouter. | InteractiveOrganicLayouter | ||
stopAndWait():void
Stops a previously started (startLayout()) layout Thread and blocks until the layout is completed. | InteractiveOrganicLayouter | ||
syncStructure():void
This method synchronizes the CopiedLayoutGraph given as parameter to doLayout() with the original graph. | InteractiveOrganicLayouter | ||
wakeUp():void
This method may be called if something has "changed" and the layouter shall restart/continue layout calculation. | InteractiveOrganicLayouter |
Method | Defined By | ||
---|---|---|---|
Initializes this object. | InteractiveOrganicLayouter |
automaticStructureUpdateEnabled | property |
automaticStructureUpdateEnabled:Boolean
Determines whether this algorithm performs automatic structure updates.
If set to true
this algorithm will register a listener on the graph to be laid out to automatically update internal data structures as soon as the structure of the original graph changes.
The default is false
.
public function get automaticStructureUpdateEnabled():Boolean
public function set automaticStructureUpdateEnabled(value:Boolean):void
lastWakeupTime | property |
lastWakeupTime:LongImpl
[read-only] Returns the time when the last wake-up has occurred
public function get lastWakeupTime():LongImpl
maxTime | property |
maxTime:uint
Getter: Return the maximal time the layouter will run (in milliseconds).
Setter: Sets the maximal time the layouter will run. After this time it will sleep - independent of the actual result. public function get maxTime():uint
public function set maxTime(value:uint):void
outputRestriction | property |
outputRestriction:OutputRestriction
Getter: Returns the current OutputRestriction instance set for this instance. The default is com.yworks.yfiles.layout.organic.OutputRestriction.NONE.
Setter: Sets a restriction on the output generated by this layouter public function get outputRestriction():OutputRestriction
public function set outputRestriction(value:OutputRestriction):void
See also
preferredEdgeLength | property |
preferredEdgeLength:Number
[write-only] Sets the preferred edge length. The edges should not become smaller than this amount.
public function set preferredEdgeLength(value:Number):void
preferredNodeDistance | property |
preferredNodeDistance:Number
[write-only] Sets the preferred node distance.
public function set preferredNodeDistance(value:Number):void
quality | property |
quality:Number
Getter: The quality time ratio set.
Setter: Sets the quality ratio (value between 0.0 and 1.0) The higher this value is, the better will be the quality for the resulting layout but also the needed time. public function get quality():Number
public function set quality(value:Number):void
running | property |
running:Boolean
[read-only] Returns whether the layouter is running at the moment.
public function get running():Boolean
sleeping | property |
sleeping:Boolean
[read-only] Returns whether the layouter is sleeping. A sleeping layouter can be awakened using wakeUp() and will continue its work.
public function get sleeping():Boolean
See also
stopped | property |
stopped:Boolean
[read-only] Returns whether the layouter has been stopped.
public function get stopped():Boolean
workingRatio | property |
workingRatio:Number
Getter: Returns the actual working ratio. The working ratio is the planned ratio of working time to waiting time.
Setter: Sets the working ratio. The working ratio represents the amount of processor time the layouter tries to grab. If the working ratio is set to 1 the layouter will try to run as fast as possible. Lower values will lead to small breaks after each round. public function get workingRatio():Number
public function set workingRatio(value:Number):void
See also
InteractiveOrganicLayouter | () | Constructor |
public function InteractiveOrganicLayouter(init:Boolean = true)
Create a new instance of the InteractiveOrganicLayouter.
Parametersinit:Boolean (default = true ) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods.
This parameter can safely be ignored/omitted when calling the constructor.
|
addStructureUpdate | () | method |
public function addStructureUpdate(runnable:Runnable):void
Adds a structural update to the queue. The given Runnable will be queued and executed at a specific time. Within this Runnable structural changes (like edge/node removals or adds) may be done. They are synchronized with the layouter. This method should only be used when changes to the structure of the graph are done. Every structural change involves a rebuild of the internal data structure. So "lightweight" changes like modifications of the positions of the nodes should be done using the corresponding methods setCenter().
Parameters
runnable:Runnable |
See also
canLayout | () | method |
public function canLayout(graph:LayoutGraph):Boolean
Returns whether this layouter can layout the given graph.
Parameters
graph:LayoutGraph |
Boolean — true if the graph may be laid out, false otherwise.
|
commitPositions | () | method |
public function commitPositions():void
This method writes the calculated positions (represented by the internal data structure of this layouter) to the LayoutGraph. This method must only be called while the layouter is running running.
final InteractiveOrganicLayouter layouter = new InteractiveOrganicLayouter(); new Thread( new Runnable() { public void run() { layouter.doLayout( copiedGraph ); } } ).start(); new javax.swing.Timer( 24, new ActionListener() { public void actionPerformed( ActionEvent e ) { layouter.commitPositions(); } } ).start();There may occur synchronization issues, if doLayout() is not called using a CopiedLayoutGraph.
See also
commitPositionsSmoothly | () | method |
public function commitPositionsSmoothly(maxMovement:Number, factor:Number):Number
This method transfers the calculated positions (represented by the internal data structure of this layouter) to the LayoutGraph. This method must only be called while the layouter is running running.
The positions are not transferred directly. Instead the nodes are moved towards the calculated position in each step. "Good" values for this method may be about 50 for the maxMovement and about 0.15 as factor (when the positions are updates about 25 times a second).Parameters
maxMovement:Number — the maximal distance a node is moved
| |
factor:Number — determines the node movement (movement = factor * distance between calculated and actual location)
|
Number — the biggest movement. This value can be used to estimate the difference between calculated layout and actual positions. If the return value is "0" the calculated layout has been transferred completely.
|
See also
doLayout | () | method |
public function doLayout(graph:LayoutGraph):void
Calculates the layout for the graph. The calculated layout is *NOT AUTOMATICALLY APPLIED*. The graph has to be updated with the actual calculated positions automatically.
Attention: It is recommended to use a CopiedLayoutGraph to buffer the original graph. If automaticStructureUpdateEnabled is set to true, structural changes to the original graph are automatically transferred to the copy.InteractiveOrganicLayouter layouter = new InteractiveOrganicLayouter(); Graph2D originalGraph = new Graph2D(); CopiedLayoutGraph copy = new CopiedLayoutGraph( originalGraph ); layouter.setAutomaticStructureUpdateEnabled( true ); layouter.doLayout( copy );If an instance of CopiedLayoutGraph is laid out, the setters and getters having a node or edge as parameter may be used with instances from the original graph *or* the copied graph. This call will not return until stop() is called.
Parameters
graph:LayoutGraph — the graph that is laid out
|
See also
enableOnlyCore | () | method |
public function enableOnlyCore():void
Makes sure that the core of this layouter will not use the usual com.yworks.yfiles.layout.LayoutStage s, like com.yworks.yfiles.layout.ComponentLayouter, com.yworks.yfiles.layout.ParallelEdgeLayouter, etc. If you really need this feature, override this method and return silently.
See also
getCenter | () | method |
public function getCenter(node:Node):YPoint
Return the actual center of the node
Parameters
node:Node |
YPoint — the center of the node or null if the layouter does not know anything about the node.
|
getCenterX | () | method |
public function getCenterX(node:Node):Number
Return the actual center of the node.
Parameters
node:Node |
Number — the center of the node.
|
getCenterY | () | method |
public function getCenterY(node:Node):Number
Return the actual center of the node.
Parameters
node:Node |
Number — the center of the node.
|
getClass | () | method |
override public function getClass():Class
ReturnsClass |
getStress | () | method |
public function getStress(node:Node):Number
Gets the stress for the given node. The higher the stress of a node is, the farther this node will be moved.
Parameters
node:Node |
Number |
initInteractiveOrganicLayouter | () | method |
protected final function initInteractiveOrganicLayouter():void
Initializes this object. See the documentation of the corresponding factory method newInteractiveOrganicLayouter()
for details.
See also
newInteractiveOrganicLayouter | () | method |
public static function newInteractiveOrganicLayouter():InteractiveOrganicLayouter
Create a new instance of the InteractiveOrganicLayouter.
ReturnsInteractiveOrganicLayouter |
setCenter | () | method |
public function setCenter(node:Node, x:Number, y:Number):void
Sets the center for the node. This method does not affect the graph itself. Instead the internal data structure of the layouter is changed. This method may be used to update node positions due to user interaction (e.g. dragging).
Parameters
node:Node | |
x:Number | |
y:Number |
setCenterX | () | method |
public function setCenterX(node:Node, x:Number):void
Sets the center of the node.
Parameters
node:Node | |
x:Number |
setCenterY | () | method |
public function setCenterY(node:Node, y:Number):void
Sets the center of the node.
Parameters
node:Node | |
y:Number |
setInertia | () | method |
public function setInertia(node:Node, inertia:Number):void
Set the inertia for the node. The inertia represents how "easy" a node will move. Inertia "1.0": The node will not move Inertia "0.5": The node will only move half as wide as it would with an inertia of "0.0" Inertia "0.0": The node will move as fast as possible
Parameters
node:Node | |
inertia:Number |
setPreferredEdgeLength | () | method |
public function setPreferredEdgeLength(edge:Edge, newEdgeLength:Number):void
Sets the preferred edge length for the given edge.
Parameters
edge:Edge | |
newEdgeLength:Number |
setRadius | () | method |
public function setRadius(node:Node, radius:Number):void
Sets the radius for the given node
Parameters
node:Node | |
radius:Number |
setStress | () | method |
public function setStress(node:Node, stress:Number):void
Sets the stress for the given node. The higher the stress of a node is, the farther this node will be moved.
Parameters
node:Node | |
stress:Number — a value between 0 and 1
|
startLayoutSingleThreaded | () | method |
public function startLayoutSingleThreaded(graph:LayoutGraph):InteractiveOrganicLayouter_SingleThreadContext
Creates a context object that provides methods to continue (com.yworks.yfiles.layout.organic.InteractiveOrganicLayouter_SingleThreadContext.doLayout()) and stop (com.yworks.yfiles.layout.organic.InteractiveOrganicLayouter_SingleThreadContext.stopLayout()) the layout calculation. Note that simply calling this method will not perform any layout. Repeated calls to com.yworks.yfiles.layout.organic.InteractiveOrganicLayouter_SingleThreadContext.doLayout() need to be made in order for the layout calculation to be performed.
Parameters
graph:LayoutGraph — the graph that gets layouted.
|
InteractiveOrganicLayouter_SingleThreadContext — the context object to control layout calculation.
|
See also
stop | () | method |
public function stop():void
Stops the layouter. The layouter will stop after the actual round. This means that the layouter cannot be awakened again.
stopAndWait | () | method |
public function stopAndWait():void
Stops a previously started (startLayout()) layout Thread and blocks until the layout is completed.
See also
syncStructure | () | method |
public function syncStructure():void
This method synchronizes the CopiedLayoutGraph given as parameter to doLayout() with the original graph. This method
See also
wakeUp | () | method |
public function wakeUp():void
This method may be called if something has "changed" and the layouter shall restart/continue layout calculation. This is e.g. useful if the layouter is sleeping and some user interaction has occurred.