| Package | flare.vis.operator.layout |
| Class | public class ForceDirectedLayout |
| Inheritance | ForceDirectedLayout Layout Operator |
Visualization.continuousUpdates = true
).
The running time of this layout algorithm is the greater of O(N log N) and O(E), where N is the number of nodes and E the number of edges. The addition of custom forces to the simulation may affect this.
The force directed layout is implemented using the physics simulator
provided by the flare.physics package. The
Simulation used to drive this layout can be set explicitly,
allowing any number of custom force directed layouts to be created
through the selection of IForce modules. Each node in the
layout is mapped to a Particle instance and each edge
to a Spring in the simulation. Once the simulation has been
initialized, you can retrieve these instances through the
node.props.particle and edge.props.spring
properties, respectively.
See also
| Property | Defined by | ||
|---|---|---|---|
| damping : Function
Function for assigning damping constant values to springs.
| ForceDirectedLayout | ||
| defaultParticleMass : Number The default mass value for node/particles.
| ForceDirectedLayout | ||
| defaultSpringLength : Number The default spring rest length for edge/springs.
| ForceDirectedLayout | ||
| defaultSpringTension : Number The default spring tension for edge/springs.
| ForceDirectedLayout | ||
![]() | enabled : Boolean Indicates if the operator is enabled or disabled.
| Operator | |
| enforceBounds : Boolean Flag indicating if the layout bounds should be enforced.
| ForceDirectedLayout | ||
| iterations : int The number of iterations to run the simulation per invocation
(default is 1, expecting continuous updates).
| ForceDirectedLayout | ||
![]() | layoutAnchor : Point The layout anchor, used by some layout instances to place an
initial item or determine a focal point.
| Layout | |
![]() | layoutBounds : Rectangle The layout bounds for the layout.
| Layout | |
![]() | layoutRoot : DataSprite
The layout root, the root node for tree layouts.
| Layout | |
![]() | layoutType : String = "null" The type of layout and axes.
| Layout | |
| mass : Function
Function for assigning mass values to particles.
| ForceDirectedLayout | ||
![]() | parameters : Object
Sets parameter values for this operator.
| Operator | |
| restLength : Function
Function for assigning rest length values to springs.
| ForceDirectedLayout | ||
| simulation : Simulation
[read-only] The physics simulation driving this layout.
| ForceDirectedLayout | ||
| tension : Function
Function for assigning tension values to springs.
| ForceDirectedLayout | ||
| ticksPerIteration : int The number of time ticks to advance the simulation on each
iteration (default is 1).
| ForceDirectedLayout | ||
![]() | visualization : Visualization
The visualization processed by this operator.
| Operator | |
| Method | Defined by | ||
|---|---|---|---|
|
ForceDirectedLayout(enforceBounds:Boolean = false, iterations:int = 1, sim:Simulation = null)
Creates a new ForceDirectedLayout.
| ForceDirectedLayout | ||
![]() |
applyParameters(op:IOperator, params:Object):void
[static]
Static method that applies parameter settings to an operator.
| Operator | |
![]() |
clearEdgePoints():void
Strips all EdgeSprites in a visualization of any control points.
| Layout | |
![]() |
Hides the axes.
| Layout | |
![]() |
operate(t:Transitioner = null):void
Performs an operation over the contents of a visualization.
| Layout | |
![]() |
setup():void
Setup method invoked whenever this operator's visualization
property is set.
| Operator | |
![]() |
Reveals the axes.
| Layout | |
![]() |
[static]
Updates all edges to be straight lines.
| Layout | |
| Method | Defined by | ||
|---|---|---|---|
![]() |
autoAnchor():void
Automatically-generate an anchor point.
| Layout | |
|
init():void
Initializes the Simulation for this ForceDirectedLayout
| ForceDirectedLayout | ||
|
layout():void
Calculates the spatial layout of visualized items.
| ForceDirectedLayout | ||
![]() |
minAngle(a1:Number, a2:Number):Number
Returns an angle value that minimizes the angular distance
between a reference angle and a target angle.
| Layout | |
|
update(d:DataSprite):void
Transfer the physics simulation results to an item's layout.
| ForceDirectedLayout | ||
| damping | property |
public var damping:FunctionFunction for assigning damping constant values to springs. By default, this simply uses the spring's computed tension value divided by 10. This function can be replaced to perform custom damping assignment.
| defaultParticleMass | property |
defaultParticleMass:Number [read-write]The default mass value for node/particles.
Implementation public function get defaultParticleMass():Number
public function set defaultParticleMass(value:Number):void
| defaultSpringLength | property |
defaultSpringLength:Number [read-write]The default spring rest length for edge/springs.
Implementation public function get defaultSpringLength():Number
public function set defaultSpringLength(value:Number):void
| defaultSpringTension | property |
defaultSpringTension:Number [read-write]The default spring tension for edge/springs.
Implementation public function get defaultSpringTension():Number
public function set defaultSpringTension(value:Number):void
| enforceBounds | property |
enforceBounds:Boolean [read-write]Flag indicating if the layout bounds should be enforced. If true, the layoutBounds will limit node placement.
Implementation public function get enforceBounds():Boolean
public function set enforceBounds(value:Boolean):void
| iterations | property |
iterations:int [read-write]The number of iterations to run the simulation per invocation (default is 1, expecting continuous updates).
Implementation public function get iterations():int
public function set iterations(value:int):void
| mass | property |
public var mass:FunctionFunction for assigning mass values to particles. By default, this simply returns the default mass value. This function can be replaced to perform custom mass assignment.
| restLength | property |
public var restLength:FunctionFunction for assigning rest length values to springs. By default, this simply returns the default rest length value. This function can be replaced to perform custom rest length assignment.
| simulation | property |
simulation:Simulation [read-only]The physics simulation driving this layout.
Implementation public function get simulation():Simulation
| tension | property |
public var tension:FunctionFunction for assigning tension values to springs. By default, this method computes spring tension adaptively, based on the connectivity of the attached particles, to create more stable layouts. More specifically, the tension is computed as the default tension value divided by the square root of the maximum degree of the attached particles. This function can be replaced to perform custom tension assignment.
| ticksPerIteration | property |
ticksPerIteration:int [read-write]The number of time ticks to advance the simulation on each iteration (default is 1).
Implementation public function get ticksPerIteration():int
public function set ticksPerIteration(value:int):void
| ForceDirectedLayout | () | constructor |
public function ForceDirectedLayout(enforceBounds:Boolean = false, iterations:int = 1, sim:Simulation = null)Creates a new ForceDirectedLayout.
ParametersenforceBounds:Boolean (default = false) — the number of iterations to run the simulation
per invocation
|
|
iterations:int (default = 1) — the physics simulation to use for the layout. If null
(the default), default simulation settings will be used
|
|
sim:Simulation (default = null) |
| init | () | method |
protected function init():voidInitializes the Simulation for this ForceDirectedLayout
| layout | () | method |
protected override function layout():voidCalculates the spatial layout of visualized items. Layout operators override this method with their layout implementations.
| update | () | method |
protected function update(d:DataSprite):voidTransfer the physics simulation results to an item's layout.
Parametersd:DataSprite — a DataSprite
|