|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.router.polyline.DynamicObstacleDecomposition
public class DynamicObstacleDecomposition
This class describes an ObstaclePartition that decomposes its area dynamically.
The partitioning strategy is based on binary space partitioning. It divides the partition space recursively in two
cells until each cell is completely covered by one or more Obstacles or completely empty.
![]() |
![]() |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface y.layout.router.polyline.DynamicDecomposition |
|---|
DynamicDecomposition.Listener |
| Constructor Summary | |
|---|---|
DynamicObstacleDecomposition()
Constructs a new instance of DynamicObstacleDecomposition. |
|
| Method Summary | |
|---|---|
void |
addDynamicDecompositionListener(DynamicDecomposition.Listener listener)
Adds the given dynamic decomposition listener to receive
PartitionCell subdivision and creation events from this decomposition. |
void |
clear()
Clears the partition data such that the DynamicObstacleDecomposition can be reused and
initialized with new Obstacles. |
protected void |
fireCreateCellEvent(PartitionCell createdCell)
Notifies all registered dynamic decomposition listeners that the given
partition cell has been created. |
protected void |
fireFinalizeCellEvent(PartitionCell finalizedCell)
Notifies all registered dynamic decomposition listeners that the given
partition cell has been finalized. |
protected void |
fireSubdividedEvent(PartitionCell cell,
java.util.List subCells)
Notifies all registered dynamic decomposition listeners of a subdivision
of a given partition cell. |
protected void |
fireUnlockCellEvent(PartitionCell unlockedCell)
Notifies all registered dynamic decomposition listeners that the given
partition cell is unlocked again. |
YRectangle |
getBounds()
Returns the bounds of the original rectangular area that is being partitioned. |
java.util.List |
getCells(Obstacle obstacle)
Returns all partition cells that are completely covered by the given Obstacle. |
java.util.List |
getCells(YRectangle rect)
Returns a list of all PartitionCells that intersect or cover the given rectangle. |
double |
getCutObstacleCost()
Returns the costs incurred for every Obstacle that must be cut in a subdivision. |
protected double |
getGeometricCutCosts(double cut,
double min,
double max,
double orthogonalMin,
double orthogonalMax)
Calculates the cost of a cut with respect to the geometry of the sub-cells. |
java.util.List |
getNeighbors(PartitionCell cell)
Returns the neighbor partition cells of the given cell. |
protected double |
getObstacleCutCosts(int numObstaclesInFirstHalf,
int numObstaclesInSecondHalf,
int numObstaclesOnCut)
Calculates the cost of a cut with respect to the subdivided obstacles. |
java.util.List |
getObstacles(PartitionCell cell)
Returns all Obstacles that cover the given partition cell. |
double |
getUnbalancedObstaclesCost()
Returns the costs incurred if the distribution after a subdivision of obstacles is unbalanced in sub-cells. |
double |
getUnbalancedRatioCost()
Returns the costs incurred if the subdivision produces unbalanced rectangles. |
void |
init(java.util.List obstacles,
YRectangle partitionBounds)
Initializes this DynamicObstacleDecomposition instance with the given obstacles and partition bounds. |
void |
removeDynamicDecompositionListener(DynamicDecomposition.Listener listener)
Removes the given dynamic decomposition listener such that it no longer
receives PartitionCell subdivision and creation events from this decomposition. |
void |
setCutObstacleCost(double cutObstacleCost)
Specifies the costs incurred for every Obstacle that must be cut in a subdivision. |
void |
setUnbalancedObstaclesCost(double unbalancedObstaclesCost)
Specifies the costs incurred if the distribution after a subdivision of obstacles is unbalanced in sub-cells. |
void |
setUnbalancedRatioCost(double unbalancedRatioCost)
Specifies the costs incurred if the subdivision produces unbalanced rectangles. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DynamicObstacleDecomposition()
DynamicObstacleDecomposition.
| Method Detail |
|---|
public double getCutObstacleCost()
Obstacle that must be cut in a subdivision.
Values need to be non-negative.
setCutObstacleCost(double)public void setCutObstacleCost(double cutObstacleCost)
Obstacle that must be cut in a subdivision.
Values need to be non-negative.
cutObstacleCost - a non-negative cut cost
java.lang.IllegalArgumentException - if the cost is negativepublic double getUnbalancedObstaclesCost()
Values need to be non-negative.
setUnbalancedObstaclesCost(double)public void setUnbalancedObstaclesCost(double unbalancedObstaclesCost)
Values need to be non-negative.
unbalancedObstaclesCost - a non-negative cost value
java.lang.IllegalArgumentException - if the cost is negativepublic double getUnbalancedRatioCost()
Values need to be non-negative.
setUnbalancedRatioCost(double)public void setUnbalancedRatioCost(double unbalancedRatioCost)
Values need to be non-negative.
unbalancedRatioCost - a non-negative cost value
java.lang.IllegalArgumentException - if the cost is negativepublic void addDynamicDecompositionListener(DynamicDecomposition.Listener listener)
dynamic decomposition listener to receive
PartitionCell subdivision and creation events from this decomposition. These events occur when the
decomposition changes the partition by subdividing cells into sub-cells or when new cells are created.
addDynamicDecompositionListener in interface DynamicDecompositionlistener - the dynamic decomposition listener to addDynamicDecomposition.Listenerpublic void removeDynamicDecompositionListener(DynamicDecomposition.Listener listener)
dynamic decomposition listener such that it no longer
receives PartitionCell subdivision and creation events from this decomposition.
removeDynamicDecompositionListener in interface DynamicDecompositionlistener - the dynamic decomposition listener to removeDynamicDecomposition.Listener
protected void fireSubdividedEvent(PartitionCell cell,
java.util.List subCells)
dynamic decomposition listeners of a subdivision
of a given partition cell.
cell - the cell that has been subdividedsubCells - the new sub-cells resulting from the subdivision of the given cellDynamicDecomposition.Listenerprotected void fireFinalizeCellEvent(PartitionCell finalizedCell)
dynamic decomposition listeners that the given
partition cell has been finalized.
finalizedCell - the cell that has been finalizedDynamicDecomposition.Listenerprotected void fireUnlockCellEvent(PartitionCell unlockedCell)
dynamic decomposition listeners that the given
partition cell is unlocked again.
unlockedCell - the cell that has been unlockedDynamicDecomposition.Listenerprotected void fireCreateCellEvent(PartitionCell createdCell)
dynamic decomposition listeners that the given
partition cell has been created.
This method is also called in init(List, YRectangle).
createdCell - the newly created cellDynamicDecomposition.Listener
public void init(java.util.List obstacles,
YRectangle partitionBounds)
DynamicObstacleDecomposition instance with the given obstacles and partition bounds.
This method must be called before any other method is invoked.
init in interface ObstaclePartitionobstacles - a list of Obstacle objectspartitionBounds - the bounds of the partitionObstaclePartition.clear()public void clear()
DynamicObstacleDecomposition can be reused and
initialized with new Obstacles.
clear in interface ObstaclePartitioninit(List, YRectangle)
protected double getObstacleCutCosts(int numObstaclesInFirstHalf,
int numObstaclesInSecondHalf,
int numObstaclesOnCut)
The cost can take values between 0 and 1.
This method is called while a PartitionCell is divided into upper and lower or left and right child
cells depending on the cut costs (during getCells(Obstacle), getCells(YRectangle) and
getNeighbors(PartitionCell) methods).
numObstaclesInFirstHalf - the number of obstacles that lie completely in the first halfnumObstaclesInSecondHalf - the number of obstacles that lie completely in the second halfnumObstaclesOnCut - the number of obstacles that lie on the cut
protected double getGeometricCutCosts(double cut,
double min,
double max,
double orthogonalMin,
double orthogonalMax)
The cost can take values between 0 and 1.
This method is called while a PartitionCell is divided into upper and lower or left and right child
cells depending on the cut costs (during getCells(Obstacle), getCells(YRectangle) and
getNeighbors(PartitionCell) methods).
cut - the coordinate of the cutmin - the left side of the subdivided cellmax - the right side of the subdivided cellorthogonalMin - the upper side of the subdivided cellorthogonalMax - the lower side of the subdivided cell
public java.util.List getNeighbors(PartitionCell cell)
partition cells of the given cell.
getNeighbors in interface Partitioncell - the cell whose neighbors will be returned
public java.util.List getObstacles(PartitionCell cell)
Obstacles that cover the given partition cell.
getObstacles in interface ObstaclePartitioncell - the partition cell for which the obstacles will be returned
Obstacle instances that cover the given cellpublic java.util.List getCells(Obstacle obstacle)
partition cells that are completely covered by the given Obstacle.
getCells in interface ObstaclePartitionobstacle - the obstacle for which the covered cells will be returned
PartitionCell instances that are completely covered by the given obstaclepublic java.util.List getCells(YRectangle rect)
PartitionCells that intersect or cover the given rectangle.
getCells in interface Partitionrect - the rectangular area whose (partially) covered cells will be returned
PartitionCells that (partially) cover the given rectangular areapublic YRectangle getBounds()
getBounds in interface Partition
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||