|
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
A GraphPartition
partitions the bounding box of a graph into rectangles using the graph elements as Obstacle
s.
All Obstacle
s used during the partitioning are created
by GraphPartitionExtension
s. GraphPartitionExtension
s have been
registered
before
using method GraphPartitionExtension.preparePartition(PathSearchConfiguration, GraphPartition)
which is called during the initialization
of a GraphPartition
.
The core partitioning is delegated to an ObstaclePartition
that is
initialized
with these Obstacle
s.
If the ObstaclePartition
is of type DynamicDecomposition
, GraphPartition
re-dispatches
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 GraphPartition instance using the given delegate inner obstacle partition . |
Method Summary | |
---|---|
void |
addDynamicDecompositionListener(DynamicDecomposition.Listener listener)
Adds the given listener to the GraphPartition . |
void |
clear()
Clears the partition data such that the GraphPartition can be reused and
initialized with a new configuration. |
Obstacle |
createObstacle(YRectangle bounds,
java.lang.Object data)
Creates and returns a new Obstacle using the given bounds and data. |
YRectangle |
getBounds()
Returns the bounds of the original rectangular area that is being partitioned. |
java.util.List |
getCells(Node node)
Returns all PartitionCell s that are completely covered by the bounds of the given node. |
java.util.List |
getCells(YRectangle rect)
Returns a list of all PartitionCell s that intersect or cover the given rectangle by delegating to the
corresponding method of the inner partition . |
java.util.List |
getNeighbors(PartitionCell cell)
Returns a list of all PartitionCell s that are neighbors of the given cell, i.e., those cells that have a
common border segment with the given cell. |
java.util.List |
getNodes(PartitionCell cell)
Returns a list of all Node s whose bounds intersect or cover the bounds of the given cell. |
Obstacle |
getObstacle(java.lang.Object data)
Returns the Obstacle that has been created earlier for the given data object. |
java.util.List |
getObstacles(PartitionCell cell)
Returns all Obstacle s covering the given PartitionCell by delegating to the corresponding method
of the inner partition . |
protected ObstaclePartition |
getPartition()
Returns the delegate inner obstacle partition. |
void |
init(PathSearchConfiguration configuration)
Initializes the GraphPartition with the given graph instance based on the given
configuration used by path search algorithms. |
void |
onCellCreated(PartitionCell createdCell)
Re-dispatches the event of the creation of a new PartitionCell to all registered
DynamicDecomposition.Listener s. |
void |
onCellFinalized(PartitionCell finalizedCell)
Re-dispatches the event of having completed the process of subdivisions of a given PartitionCell to all registered
DynamicDecomposition.Listener s. |
void |
onCellSubdivided(PartitionCell cell,
java.util.List subCells)
Re-dispatches the event of the subdivision of a given PartitionCell into several sub-cells to all registered
DynamicDecomposition.Listener s. |
void |
onCellUnlocked(PartitionCell unlockedCell)
Re-dispatches the event of having unlocked a previously finalized
PartitionCell to all registered DynamicDecomposition.Listener s. |
void |
removeDynamicDecompositionListener(DynamicDecomposition.Listener listener)
Removes the given listener from the GraphPartition . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GraphPartition(ObstaclePartition partition)
GraphPartition
instance using the given delegate inner obstacle partition
.
partition
- the delegate inner obstacle partitionMethod Detail |
---|
protected ObstaclePartition getPartition()
public void addDynamicDecompositionListener(DynamicDecomposition.Listener listener)
GraphPartition
.
The listener will be notified upon dynamic decomposition events. If it is a GraphPartitionExtension
, method
GraphPartitionExtension.preparePartition(PathSearchConfiguration, GraphPartition)
is called during initialization
.
addDynamicDecompositionListener
in interface DynamicDecomposition
listener
- the listener to be addedpublic void removeDynamicDecompositionListener(DynamicDecomposition.Listener listener)
GraphPartition
.
The listener will not be notified of dynamic decomposition events anymore.
removeDynamicDecompositionListener
in interface DynamicDecomposition
listener
- the listener to be removedpublic void init(PathSearchConfiguration configuration)
GraphPartition
with the given graph instance based on the given
configuration
used by path search algorithms.
Before calling this method, any old partitioning information must be cleared
.
This initialization method calls GraphPartitionExtension.preparePartition(PathSearchConfiguration, GraphPartition)
of all registered extensions. Then, the inner delegate partition
is initialized passing
all added
obstacles as well as the given graph's bounds
extended by a small padding.
In the case where the delegate partition
is of type DynamicDecomposition
,
this GraphPartition
will also be added as DynamicDecomposition.Listener
to it.
configuration
- the configuration used by path search algorithmsclear()
,
GraphPartitionExtension.preparePartition(PathSearchConfiguration, GraphPartition)
,
DynamicDecomposition.addDynamicDecompositionListener(Listener)
public java.util.List getNeighbors(PartitionCell cell)
PartitionCell
s that are neighbors of the given cell, i.e., those cells that have a
common border segment with the given cell.
getNeighbors
in interface Partition
cell
- the cell whose neighbors will be returned
PartitionCell
s that are neighbors of the given cellpublic java.util.List getNodes(PartitionCell cell)
Node
s whose bounds intersect or cover the bounds of the given cell.
cell
- the cell
Node
s that are intersected by the given cellpublic java.util.List getObstacles(PartitionCell cell)
Obstacle
s covering the given PartitionCell
by delegating to the corresponding method
of the inner partition
.
cell
- the cell whose obstacles will be returned
Obstacle
s that cover the given cellObstaclePartition.getObstacles(PartitionCell)
public java.util.List getCells(Node node)
PartitionCell
s that are completely covered by the bounds of the given node.
node
- the node for which the covered cells will be returned
PartitionCell
instances that are completely covered by the bounds of
the given node
java.lang.IllegalArgumentException
- if the node is unknownpublic java.util.List getCells(YRectangle rect)
PartitionCell
s that intersect or cover the given rectangle by delegating to the
corresponding method of the inner partition
.
getCells
in interface Partition
rect
- the rectangular area whose (partially) covered cells will be returned
PartitionCell
sPartition.getCells(YRectangle)
public YRectangle getBounds()
inner partition
.
getBounds
in interface Partition
Partition.getBounds()
public void clear()
partition
data such that the GraphPartition
can be reused and
initialized
with a new configuration.
All GraphPartitionExtension
s are cleaned up
;
partition listeners and obstacles are removed
.
init(PathSearchConfiguration)
public void onCellSubdivided(PartitionCell cell, java.util.List subCells)
PartitionCell
into several sub-cells to all registered
DynamicDecomposition.Listener
s.
This method is a callback after a PartitionCell
has been subdivided into several sub-cells.
onCellSubdivided
in interface DynamicDecomposition.Listener
cell
- the cell that has been subdividedsubCells
- the sub-cells resulting from the subdivision of the given PartitionCell
public void onCellFinalized(PartitionCell finalizedCell)
PartitionCell
to all registered
DynamicDecomposition.Listener
s.
This method is a callback after a PartitionCell
has been finalized and won't be further
subdivided.
onCellFinalized
in interface DynamicDecomposition.Listener
finalizedCell
- the cell that has been finalizedpublic void onCellUnlocked(PartitionCell unlockedCell)
finalized
PartitionCell
to all registered DynamicDecomposition.Listener
s.
This method is a callback after a previously finalized PartitionCell
has been unlocked again.
onCellUnlocked
in interface DynamicDecomposition.Listener
unlockedCell
- the cell that has been unlockedpublic void onCellCreated(PartitionCell createdCell)
PartitionCell
to all registered
DynamicDecomposition.Listener
s.
This method is a callback after a PartitionCell
has been created.
onCellCreated
in interface DynamicDecomposition.Listener
createdCell
- the newly created PartitionCell
public Obstacle createObstacle(YRectangle bounds, java.lang.Object data)
Obstacle
using the given bounds and data.
All obstacles created via this method are delegated to the inner partition
upon
initialization
.
bounds
- the bounds of the obstacledata
- the additional data that should be associated with the obstacle
Obstacle
using the given bounds and datapublic Obstacle getObstacle(java.lang.Object data)
Obstacle
that has been created earlier for the given data object.
data
- the given data for which the obstacle will be returned
Obstacle
that has been created earlier for the given data object
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |