|
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.DynamicObstacleDecomposition
public class DynamicObstacleDecomposition
An ObstaclePartition
that decomposes its area dynamically and implements the DynamicDecomposition
interface.
The partitioning strategy is based on binary space partitioning. It divides the partition space recursively in two cells until each cell is completely covered from 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 dynamic obstacle decomposition. |
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 so the ObstaclePartition can be reused and
ObstaclePartition.init(java.util.List, y.geom.YRectangle) initialized} with new Obstacle s. |
protected void |
fireCreateCellEvent(PartitionCell createdCell)
Notifies all registered dynamic decomposition listeners about the newly created cell. |
protected void |
fireFinalizeCellEvent(PartitionCell finalizedCell)
Notifies all registered dynamic decomposition listeners about the finalized cell. |
protected void |
fireSubdividedEvent(PartitionCell cell,
List subCells)
Notifies all registered dynamic decomposition listeners about a subdivision. |
YRectangle |
getBounds()
Returns the bounds of the decomposition area. |
List |
getCells(Obstacle obstacle)
Returns the PartitionCell in which the given obstacle lies. |
List |
getCells(YRectangle rect)
Returns the PartitionCell s in which the given rectangle lies. |
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. |
List |
getNeighbors(PartitionCell cell)
Returns the neighbor 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. |
List |
getObstacles(PartitionCell cell)
Returns the obstacles that lie in the given 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(List obstacles,
YRectangle partitionBounds)
Initializes this dynamic obstacle decomposition with the given obstacles and partition bounds. |
void |
removeDynamicDecompositionListener(DynamicDecomposition.Listener listener)
Removes the given dynamic decomposition listener so that it no longer receives PartitionCell subdivision
and creation events from this decomposition. |
void |
setCutObstacleCost(double cutObstacleCost)
Sets the costs incurred for every obstacle that must be cut in a subdivision. |
void |
setUnbalancedObstaclesCost(double unbalancedObstaclesCost)
Sets the costs incurred if the distribution after a subdivision of obstacles is unbalanced in sub-cells. |
void |
setUnbalancedRatioCost(double unbalancedRatioCost)
Sets 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()
Method Detail |
---|
public double getCutObstacleCost()
public void setCutObstacleCost(double cutObstacleCost)
cutObstacleCost
- the costs incurred for every obstacle that must be cut in a subdivision.public double getUnbalancedObstaclesCost()
public void setUnbalancedObstaclesCost(double unbalancedObstaclesCost)
unbalancedObstaclesCost
- the costs incurred if the distribution after a subdivision of obstacles is
unbalanced in sub-cells.public double getUnbalancedRatioCost()
public void setUnbalancedRatioCost(double unbalancedRatioCost)
unbalancedRatioCost
- the costs incurred if the subdivision produces unbalanced rectangles.public void addDynamicDecompositionListener(DynamicDecomposition.Listener listener)
PartitionCell
subdivision and creation events from
this decomposition. These events occur when the decomposition changes the partition by subdividing cells into
sub-cells or new cell are created.
addDynamicDecompositionListener
in interface DynamicDecomposition
listener
- the dynamic decomposition listener.DynamicDecomposition.Listener
public void removeDynamicDecompositionListener(DynamicDecomposition.Listener listener)
PartitionCell
subdivision
and creation events from this decomposition.
removeDynamicDecompositionListener
in interface DynamicDecomposition
listener
- the dynamic decomposition listener.DynamicDecomposition.Listener
protected void fireSubdividedEvent(PartitionCell cell, List subCells)
cell
- The cell that has been subdivided.subCells
- The new sub cells of the divided cell.DynamicDecomposition.Listener
protected void fireFinalizeCellEvent(PartitionCell finalizedCell)
finalizedCell
- The cell that has been finalized.DynamicDecomposition.Listener
protected void fireCreateCellEvent(PartitionCell createdCell)
createdCell
- The newly created cell.DynamicDecomposition.Listener
public void init(List obstacles, YRectangle partitionBounds)
init
in interface ObstaclePartition
obstacles
- A list of Obstacle
objects.partitionBounds
- The bounds of the partition.public void clear()
ObstaclePartition
ObstaclePartition
can be reused and
ObstaclePartition.init(java.util.List, y.geom.YRectangle)
initialized} with new Obstacle
s.
clear
in interface ObstaclePartition
protected double getObstacleCutCosts(int numObstaclesInFirstHalf, int numObstaclesInSecondHalf, int numObstaclesOnCut)
numObstaclesInFirstHalf
- The number of obstacles that lie completely in the first half.numObstaclesInSecondHalf
- The number of obstacles that lie completely in the second half.numObstaclesOnCut
- The number of obstacles that lie on the cut.
protected double getGeometricCutCosts(double cut, double min, double max, double orthogonalMin, double orthogonalMax)
cut
- The coordinate of the cut.min
- The left side of the subdivided cell.max
- The right side of the subdivided cell.orthogonalMin
- The upper side of the subdivided cell.orthogonalMax
- The lower side of the subdivided cell.
public List getNeighbors(PartitionCell cell)
getNeighbors
in interface Partition
cell
- The cell to get the neighbors for.
public List getObstacles(PartitionCell cell)
getObstacles
in interface ObstaclePartition
cell
- The cell to get the obstacles for.
public List getCells(Obstacle obstacle)
PartitionCell
in which the given obstacle lies.
getCells
in interface ObstaclePartition
obstacle
- The obstacle to get the cells for.
public List getCells(YRectangle rect)
PartitionCell
s in which the given rectangle lies.
getCells
in interface Partition
rect
- The rectangle to get the cells for.
public YRectangle getBounds()
getBounds
in interface Partition
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |