Packagecom.yworks.yfiles.layout.router.polyline
Classpublic class GraphPartition
InheritanceGraphPartition Inheritance YObject Inheritance Object
Implements Partition, DynamicDecomposition, DynamicDecomposition_Listener

Partitions the bounding box of a graph in rectangles using graph elements as obstacles.

All com.yworks.yfiles.layout.router.polyline.Obstacle s used during the partitioning are created (createObstacle()) by com.yworks.yfiles.layout.router.polyline.GraphPartitionExtension s, that have been registered (addDynamicDecompositionListener()) before, in their prepare (com.yworks.yfiles.layout.router.polyline.GraphPartitionExtension.preparePartition()) method which is called during the GraphPartitions initialization (init()).

The core partitioning is delegated to an com.yworks.yfiles.layout.router.polyline.ObstaclePartition that is initialized (com.yworks.yfiles.layout.router.polyline.ObstaclePartition.init()) with these Obstacles.

If the com.yworks.yfiles.layout.router.polyline.ObstaclePartition implements com.yworks.yfiles.layout.router.polyline.DynamicDecomposition, GraphPartition redispatches the decomposition notifications to its extensions.

See also

com.yworks.yfiles.layout.router.polyline.GraphPartitionExtension
com.yworks.yfiles.layout.router.polyline.Obstacle
created
registered
prepare
initialization
com.yworks.yfiles.layout.router.polyline.ObstaclePartition
initialized
com.yworks.yfiles.layout.router.polyline.DynamicDecomposition


Public Properties
 PropertyDefined By
  bounds : YRectangle
[read-only]
GraphPartition
Protected Properties
 PropertyDefined By
  partition : ObstaclePartition
[read-only] Returns the inner obstacle partition.
GraphPartition
Public Methods
 MethodDefined By
  
GraphPartition(partition:ObstaclePartition, init:Boolean = true)
Creates a new instance.
GraphPartition
  
Adds the given listener to the com.yworks.yfiles.layout.router.polyline.Partition.
GraphPartition
  
clear():void
Clears the partition data so the GraphPartition can be reused and initialized (init()) with a new configuration.
GraphPartition
  
createObstacle(bounds:YRectangle, data:Object):Obstacle
Creates and returns a new com.yworks.yfiles.layout.router.polyline.Obstacle using the given bounds and data.
GraphPartition
 Inherited
equals(o:Object):Boolean
YObject
  
Note: this call is delegated to com.yworks.yfiles.layout.router.polyline.ObstaclePartition.getCells().
GraphPartition
  
Returns all cells that are completely covered by the bounds of the given node.
GraphPartition
  
getClass():Class
[override]
GraphPartition
  
GraphPartition
  
Returns a list of all com.yworks.yfiles.base.Node s whose bounds intersect or cover the bounds of the given cell.
GraphPartition
  
getObstacle(data:Object):Obstacle
Returns the obstacle that has earlier been created for the given data object.
GraphPartition
  
Returns all obstacles covering the given com.yworks.yfiles.layout.router.polyline.PartitionCell by delegating to the inner partition's com.yworks.yfiles.layout.router.polyline.ObstaclePartition.getObstacles() method.
GraphPartition
 Inherited
hashCode():int
YObject
  
init(configuration:PathSearchConfiguration):void
Initializes the partition with the given graph instance.
GraphPartition
  
[static] Creates a new instance.
GraphPartition
  
onCellCreated(createdCell:PartitionCell):void
Callback after a new com.yworks.yfiles.layout.router.polyline.PartitionCell has been created.
GraphPartition
  
onCellFinalized(finalizedCell:PartitionCell):void
Callback after a com.yworks.yfiles.layout.router.polyline.PartitionCell has been decided to be final and won't be subdivided further.
GraphPartition
  
onCellSubdivided(cell:PartitionCell, subCells:List):void
Callback after a com.yworks.yfiles.layout.router.polyline.PartitionCell has been subdivided into several sub cells.
GraphPartition
  
Removes the given listener from the com.yworks.yfiles.layout.router.polyline.Partition.
GraphPartition
Protected Methods
 MethodDefined By
  
Initializes this object.
GraphPartition
Property Detail
boundsproperty
bounds:YRectangle  [read-only]


Implementation
    public function get bounds():YRectangle
partitionproperty 
partition:ObstaclePartition  [read-only]

Returns the inner obstacle partition.


Implementation
    protected function get partition():ObstaclePartition
Constructor Detail
GraphPartition()Constructor
public function GraphPartition(partition:ObstaclePartition, init:Boolean = true)

Creates a new instance.

Parameters
partition:ObstaclePartition — The inner obstacle partition used by this graph partition to delegate the partitioning to.
 
init: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.
Method Detail
addDynamicDecompositionListener()method
public function addDynamicDecompositionListener(listener:DynamicDecomposition_Listener):void

Adds the given listener to the com.yworks.yfiles.layout.router.polyline.Partition.

Parameters

listener:DynamicDecomposition_Listener — The listener that shall be notified upon dynamic decomposition events. If it is a com.yworks.yfiles.layout.router.polyline.GraphPartitionExtension, its preparePartition (com.yworks.yfiles.layout.router.polyline.GraphPartitionExtension.preparePartition()) method is called during initialization (init()).

See also

clear()method 
public function clear():void

Clears the partition data so the GraphPartition can be reused and initialized (init()) with a new configuration.

See also

createObstacle()method 
public function createObstacle(bounds:YRectangle, data:Object):Obstacle

Creates and returns a new com.yworks.yfiles.layout.router.polyline.Obstacle using the given bounds and data. All obstacles created via this method are given to the inner com.yworks.yfiles.layout.router.polyline.ObstaclePartition upon initialization.

Parameters

bounds:YRectangle — The bounds of the obstacle.
 
data:Object — The additional data that shall be associated with the obstacle.

Returns
Obstacle — A new com.yworks.yfiles.layout.router.polyline.Obstacle using the given bounds and data.

See also

getCells()method 
public function getCells(rect:YRectangle):List

Note: this call is delegated to com.yworks.yfiles.layout.router.polyline.ObstaclePartition.getCells().

Parameters

rect:YRectangle

Returns
List

See also

getCells2()method 
public function getCells2(node:Node):List

Returns all cells that are completely covered by the bounds of the given node.

Parameters

node:Node — The node to get the covered cells for.

Returns
List — An unmodifiable list of com.yworks.yfiles.layout.router.polyline.PartitionCell instances that are completely covered by the bounds of the given node.

See also

getClass()method 
override public function getClass():Class

Returns
Class
getNeighbors()method 
public function getNeighbors(cell:PartitionCell):List

Parameters

cell:PartitionCell

Returns
List
getNodes()method 
public function getNodes(cell:PartitionCell):List

Returns a list of all com.yworks.yfiles.base.Node s whose bounds intersect or cover the bounds of the given cell.

Parameters

cell:PartitionCell — The cell to get the nodes for.

Returns
List — A list of com.yworks.yfiles.base.Node s that are intersected by the given cell.

See also

getObstacle()method 
public function getObstacle(data:Object):Obstacle

Returns the obstacle that has earlier been created for the given data object.

Parameters

data:Object — The data to get the obstacle for.

Returns
Obstacle — The obstacle that has been created for the given data object.
getObstacles()method 
public function getObstacles(cell:PartitionCell):List

Returns all obstacles covering the given com.yworks.yfiles.layout.router.polyline.PartitionCell by delegating to the inner partition's com.yworks.yfiles.layout.router.polyline.ObstaclePartition.getObstacles() method.

Parameters

cell:PartitionCell — The cell to get the obstacles for.

Returns
List — A list of com.yworks.yfiles.layout.router.polyline.Obstacle s that cover the given cell.

See also

init()method 
public function init(configuration:PathSearchConfiguration):void

Initializes the partition with the given graph instance.

After clearing (clear()) any old partitioning information, the com.yworks.yfiles.layout.router.polyline.GraphPartitionExtension.preparePartition() method of all registered extensions is called. Finally the inner com.yworks.yfiles.layout.router.polyline.ObstaclePartition is initialized passing all added (createObstacle()) obstacles as well as the given graph's bounds extended by a small padding.

Parameters

configuration:PathSearchConfiguration

See also

initGraphPartition()method 
protected final function initGraphPartition(partition:ObstaclePartition):void

Initializes this object. See the documentation of the corresponding factory method newGraphPartition() for details.

Parameters

partition:ObstaclePartition

See also

newGraphPartition()method 
public static function newGraphPartition(partition:ObstaclePartition):GraphPartition

Creates a new instance.

Parameters

partition:ObstaclePartition — The inner obstacle partition used by this graph partition to delegate the partitioning to.

Returns
GraphPartition
onCellCreated()method 
public function onCellCreated(createdCell:PartitionCell):void

Callback after a new com.yworks.yfiles.layout.router.polyline.PartitionCell has been created.

This class redispatches this event to all registered com.yworks.yfiles.layout.router.polyline.DynamicDecomposition_Listener s.

Parameters

createdCell:PartitionCell — The newly created cell.

See also

onCellFinalized()method 
public function onCellFinalized(finalizedCell:PartitionCell):void

Callback after a com.yworks.yfiles.layout.router.polyline.PartitionCell has been decided to be final and won't be subdivided further.

This class redispatches this event to all registered com.yworks.yfiles.layout.router.polyline.DynamicDecomposition_Listener s.

Parameters

finalizedCell:PartitionCell — The cell that has been finalized.

See also

onCellSubdivided()method 
public function onCellSubdivided(cell:PartitionCell, subCells:List):void

Callback after a com.yworks.yfiles.layout.router.polyline.PartitionCell has been subdivided into several sub cells.

This class redispatches this event to all registered com.yworks.yfiles.layout.router.polyline.DynamicDecomposition_Listener s.

Parameters

cell:PartitionCell — The cell that has been subdivided.
 
subCells:List — The new sub cells of the divided cell.

See also

removeDynamicDecompositionListener()method 
public function removeDynamicDecompositionListener(listener:DynamicDecomposition_Listener):void

Removes the given listener from the com.yworks.yfiles.layout.router.polyline.Partition.

Parameters

listener:DynamicDecomposition_Listener — The listener that shall not be notified anymore upon dynamic decomposition events.

See also