This class describes an IObstaclePartition that decomposes its area dynamically.
Remarks
Default Values of Properties
cutObstacleCost | 8 | |
unbalancedObstaclesCost | 2 | |
unbalancedRatioCost | 2 |
Type Details
- yfiles module
- router-polyline
- yfiles-umd modules
- layout-area, layout-multipage, layout-orthogonal-compact, layout, router-bus, router-polyline
- Legacy UMD name
- yfiles.router.DynamicObstacleDecomposition
Constructors
Constructs a new instance of DynamicObstacleDecomposition.
Properties
Gets the bounds of the original rectangular area that is being partitioned.
Implements
Gets or sets the costs incurred if the distribution after a subdivision of obstacles is unbalanced in sub-cells.
Remarks
Default Value
2
.Throws
- Exception({ name: 'ArgumentError' })
- if the cost is negative
Gets or sets the costs incurred if the subdivision produces unbalanced rectangles.
Remarks
Default Value
2
.Throws
- Exception({ name: 'ArgumentError' })
- if the cost is negative
Methods
Adds the given dynamic decomposition listener to receive PartitionCell subdivision and creation events from this decomposition.
Remarks
Parameters
A map of options to pass to the method.
- listener - IDecompositionListener
- the dynamic decomposition listener to add
See Also
Implements
Clears the partition data such that the DynamicObstacleDecomposition can be reused and initialized with new Obstacles.
Notifies all registered dynamic decomposition listeners that the given partition cell has been created.
Remarks
Parameters
A map of options to pass to the method.
- createdCell - PartitionCell
- the newly created cell
See Also
Notifies all registered dynamic decomposition listeners that the given partition cell has been finalized.
Parameters
A map of options to pass to the method.
- finalizedCell - PartitionCell
- the cell that has been finalized
See Also
Notifies all registered dynamic decomposition listeners of a subdivision of a given partition cell.
Parameters
A map of options to pass to the method.
- cell - PartitionCell
- the cell that has been subdivided
- subCells - IList<Object>
- the new sub-cells resulting from the subdivision of the given cell
See Also
Notifies all registered dynamic decomposition listeners that the given partition cell is unlocked again.
Parameters
A map of options to pass to the method.
- unlockedCell - PartitionCell
- the cell that has been unlocked
See Also
Returns a list of all PartitionCells that intersect or cover the given rectangle.
Parameters
A map of options to pass to the method.
- rect - YRectangle
- the rectangular area whose (partially) covered cells will be returned
Returns
- ↪IList<any>
- a list of PartitionCells that (partially) cover the given rectangular area
Implements
Returns all partition cells that are completely covered by the given Obstacle.
Parameters
A map of options to pass to the method.
- obstacle - Obstacle
- the obstacle for which the covered cells will be returned
Returns
- ↪IList<any>
- list of PartitionCell instances that are completely covered by the given obstacle
Implements
getGeometricCutCosts
(cut: number, min: number, max: number, orthogonalMin: number, orthogonalMax: number) : numberCalculates the cost of a cut with respect to the geometry of the sub-cells.
Remarks
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 getCellsForObstacle, getCells and getNeighbors methods).
Parameters
A map of options to pass to the method.
- cut - number
- the coordinate of the cut
- min - number
- the left side of the subdivided cell
- max - number
- the right side of the subdivided cell
- orthogonalMin - number
- the upper side of the subdivided cell
- orthogonalMax - number
- the lower side of the subdivided cell
Returns
- ↪number
- the cost of a cut with respect to the geometry of the sub-cells
Returns the neighbor partition cells of the given cell.
Parameters
A map of options to pass to the method.
- cell - PartitionCell
- the cell whose neighbors will be returned
Returns
- ↪IList<any>
- the neighbor cells of the given cell
Implements
getObstacleCutCosts
(numObstaclesInFirstHalf: number, numObstaclesInSecondHalf: number, numObstaclesOnCut: number) : numberCalculates the cost of a cut with respect to the subdivided obstacles.
Remarks
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 getCellsForObstacle, getCells and getNeighbors methods).
Parameters
A map of options to pass to the method.
- numObstaclesInFirstHalf - number
- the number of obstacles that lie completely in the first half
- numObstaclesInSecondHalf - number
- the number of obstacles that lie completely in the second half
- numObstaclesOnCut - number
- the number of obstacles that lie on the cut
Returns
- ↪number
- the cost of a cut with respect to the subdivided obstacles
Returns all Obstacles that cover the given partition cell.
Parameters
A map of options to pass to the method.
- cell - PartitionCell
- the partition cell for which the obstacles will be returned
Returns
- ↪IList<any>
- an list of Obstacle instances that cover the given cell
Implements
Initializes this DynamicObstacleDecomposition instance with the given obstacles and partition bounds.
Remarks
Parameters
A map of options to pass to the method.
- obstacles - IList<Object>
- a list of Obstacle objects
- partitionBounds - YRectangle
- the bounds of the partition
See Also
Implements
Removes the given dynamic decomposition listener such that it no longer receives PartitionCell subdivision and creation events from this decomposition.
Parameters
A map of options to pass to the method.
- listener - IDecompositionListener
- the dynamic decomposition listener to remove