|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.router.polyline.GraphPartition
public class GraphPartition
Partitions the bounding box of a graph in rectangles using graph elements as obstacles.
All Obstacle
s used during the partitioning are created
by GraphPartitionExtension
s, that have been
registered
before,
in their prepare
method
which is called during the GraphPartition
s initialization
.
The core partitioning is delegated to an ObstaclePartition
that is
initialized
with these Obstacle
s.
If the ObstaclePartition
implements DynamicDecomposition
, GraphPartition
redispatches
the decomposition notifications to its extensions.
GraphPartitionExtension
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface y.layout.router.polyline.DynamicDecomposition |
---|
DynamicDecomposition.Listener |
Constructor Summary | |
---|---|
GraphPartition(ObstaclePartition partition)
Creates a new instance. |
Method Summary | |
---|---|
void |
addDynamicDecompositionListener(DynamicDecomposition.Listener listener)
Adds the given listener to the Partition . |
void |
clear()
Clears the partition data so the GraphPartition can be reused and
initialized with a new configuration. |
Obstacle |
createObstacle(YRectangle bounds,
Object data)
Creates and returns a new Obstacle using the given bounds and data. |
YRectangle |
getBounds()
The rectangular area that is partitioned. |
List |
getCells(Node node)
Returns a list of all PartitionCell s whose bounds intersect or cover the bounds of the given node. |
List |
getCells(YRectangle rect)
Returns a list of all PartitionCell s that intersect or cover the given rectangle.
Note: this call is delegated to Partition.getCells(y.geom.YRectangle) . |
List |
getNeighbors(PartitionCell cell)
Returns a list of all PartitionCell s that are neighbors of the given cell, this means those cells have a
common border segment with the given cell. |
List |
getNodes(PartitionCell cell)
Returns a list of all Node s whose bounds intersect or cover the bounds of the given cell. |
Obstacle |
getObstacle(Object data)
Returns the obstacle that has earlier been created for the given data object. |
List |
getObstacles(PartitionCell cell)
Returns all obstacles covering the given PartitionCell by delegating to the inner partition's
ObstaclePartition.getObstacles(PartitionCell) method. |
protected ObstaclePartition |
getPartition()
Returns the inner obstacle partition. |
void |
init(PathSearchConfiguration configuration)
Initializes the partition with the given graph instance. |
void |
onCellCreated(PartitionCell createdCell)
Callback after a new PartitionCell has been created. |
void |
onCellFinalized(PartitionCell finalizedCell)
Callback after a PartitionCell has been decided to be final and won't be subdivided further. |
void |
onCellSubdivided(PartitionCell cell,
List subCells)
Callback after a PartitionCell has been subdivided into several sub cells. |
void |
removeDynamicDecompositionListener(DynamicDecomposition.Listener listener)
Removes the given listener from the Partition . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GraphPartition(ObstaclePartition partition)
partition
- The inner obstacle partition used by this graph partition to delegate the partitioning to.Method Detail |
---|
protected ObstaclePartition getPartition()
public void addDynamicDecompositionListener(DynamicDecomposition.Listener listener)
Partition
.
addDynamicDecompositionListener
in interface DynamicDecomposition
listener
- The listener that shall be notified upon dynamic decomposition events. If it is a
GraphPartitionExtension
, its
preparePartition
method is called during initialization
.public void removeDynamicDecompositionListener(DynamicDecomposition.Listener listener)
Partition
.
removeDynamicDecompositionListener
in interface DynamicDecomposition
listener
- The listener that shall not be notified anymore upon dynamic decomposition events.public void init(PathSearchConfiguration configuration)
After clearing
any old partitioning information, the GraphPartitionExtension.preparePartition(PathSearchConfiguration, GraphPartition)
method of all registered extensions is called. Finally the inner ObstaclePartition
is initialized passing
all added
obstacles as well as the given graph's bounds
extended by a small padding.
configuration
- public List getNeighbors(PartitionCell cell)
Partition
PartitionCell
s that are neighbors of the given cell, this means those cells have a
common border segment with the given cell.
getNeighbors
in interface Partition
cell
- The cell to get the neighbors for.
PartitionCell
s that are neighbors of the given cell.public List getNodes(PartitionCell cell)
Node
s whose bounds intersect or cover the bounds of the given cell.
cell
- The cell to get the nodes for.
Node
s that are intersected by the given cell.public List getObstacles(PartitionCell cell)
PartitionCell
by delegating to the inner partition's
ObstaclePartition.getObstacles(PartitionCell)
method.
cell
- The cell to get the obstacles for.
Obstacle
s that cover the given cell.public List getCells(Node node)
PartitionCell
s whose bounds intersect or cover the bounds of the given node.
node
- The node to get the cells for.
PartitionCell
s that are intersected by the given node.public List getCells(YRectangle rect)
PartitionCell
s that intersect or cover the given rectangle.
Note: this call is delegated to Partition.getCells(y.geom.YRectangle)
.
getCells
in interface Partition
rect
- The rectangular area to get (partially) covered cells for.
PartitionCell
s.public YRectangle getBounds()
Partition
getBounds
in interface Partition
public void clear()
GraphPartition
can be reused and
initialized
with a new configuration.
public void onCellSubdivided(PartitionCell cell, List subCells)
PartitionCell
has been subdivided into several sub cells.
This class redispatches this event to all registered
DynamicDecomposition.Listener
s.
onCellSubdivided
in interface DynamicDecomposition.Listener
cell
- The cell that has been subdivided.subCells
- The new sub cells of the divided cell.public void onCellFinalized(PartitionCell finalizedCell)
PartitionCell
has been decided to be final and won't be subdivided further.
This class redispatches this event to all registered
DynamicDecomposition.Listener
s.
onCellFinalized
in interface DynamicDecomposition.Listener
finalizedCell
- The cell that has been finalized.public void onCellCreated(PartitionCell createdCell)
PartitionCell
has been created.
This class redispatches this event to all registered
DynamicDecomposition.Listener
s.
onCellCreated
in interface DynamicDecomposition.Listener
createdCell
- The newly created cell.public Obstacle createObstacle(YRectangle bounds, Object data)
Obstacle
using the given bounds and data. All obstacles created via this
method are given to the inner ObstaclePartition
upon initialization.
bounds
- The bounds of the obstacle.data
- The additional data that shall be associated with the obstacle.
Obstacle
using the given bounds and data.public Obstacle getObstacle(Object data)
data
- The data to get the obstacle for.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |