Packagecom.yworks.yfiles.layout.router.polyline
Classpublic class PathSearchExtension
InheritancePathSearchExtension Inheritance YObject Inheritance Object

Extensions are added to a com.yworks.yfiles.layout.router.polyline.PathSearch to influence the search process.

It contains several callback methods that are used by the com.yworks.yfiles.layout.router.polyline.PathSearch to e.g. calculate the costs for the next possible steps (i.e. entering the next partition cell) and to decide when the target is reached.

The com.yworks.yfiles.layout.router.polyline.PathSearch uses the callbacks in the following order:

  1. initialize (initialize())
  2. initializeEdges (initializeEdges())
  3. initializeCurrentEdge (initializeCurrentEdge())
  4. appendStartEntrances (appendStartEntrances())
  5. calculateStartEntranceCost (calculateStartEntranceCost())
  6. calculateCosts (calculateCosts())
  7. calculateHeuristicCosts (calculateHeuristicCosts())
  8. isValidTargetEntrance (isValidTargetEntrance())
  9. finalizePath (finalizePath())
  10. finalizeCurrentEdge (finalizeCurrentEdge()) or cancelCurrentEdge (cancelCurrentEdge())
  11. finalizeEdges (finalizeEdges())
  12. finalizePathSearchResult (finalizePathSearchResult())
  13. cleanup (cleanup())

See also

com.yworks.yfiles.layout.router.polyline.PathSearch.addPathSearchExtension()
com.yworks.yfiles.layout.router.polyline.PathSearchContext.currentEdge
com.yworks.yfiles.layout.router.polyline.PathSearch
initialize
initializeEdges
initializeCurrentEdge
appendStartEntrances
calculateStartEntranceCost
calculateCosts
calculateHeuristicCosts
isValidTargetEntrance
finalizePath
finalizeCurrentEdge
cancelCurrentEdge
finalizeEdges
finalizePathSearchResult
cleanup


Protected Properties
 PropertyDefined By
  configuration : PathSearchConfiguration
[read-only] Returns the configuration used for the path search.
PathSearchExtension
  context : PathSearchContext
[read-only] Returns the current context of the path search.
PathSearchExtension
Public Methods
 MethodDefined By
  
PathSearchExtension(init:Boolean = true)
PathSearchExtension
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
PathSearchExtension
 Inherited
hashCode():int
YObject
Protected Methods
 MethodDefined By
  
appendStartEntrances(allStartEntrances:List):void
Appends additional start entrances for the path search of the current edge to the given list of all previously generated entrances.
PathSearchExtension
  
calculateCosts(currentEntrance:CellEntrance, enteredCell:PartitionCell, enterInterval:OrthogonalInterval, edgeCellInfo:EdgeCellInfo, maxAllowedCosts:Number):Number
Calculate the costs for entering the enteredCell via the enterInterval.
PathSearchExtension
  
Calculates the heuristic costs for the given entrance that describe the minimal costs that will arise to finish the path if the given cell entrance is used as next step.
PathSearchExtension
  
Returns the cost for starting the path in the given entrance.
PathSearchExtension
  
This callback notifies the extension when the path search for the current edge is cancelled.
PathSearchExtension
  
cleanup():void
Cleans the extension up from the path searches with the current configuration.
PathSearchExtension
  
This callback notifies the extension when enough paths are found for the current edge.
PathSearchExtension
  
This callback notifies the extension if enough paths have been found for all edges in the context's edge list.
PathSearchExtension
  
finalizePath(path:Path):void
After finding a valid target entrance and creating a com.yworks.yfiles.layout.router.polyline.Path, the extension is notified about the found path.
PathSearchExtension
  
Callback notifying the extension about the paths chosen for the edges in the current context.
PathSearchExtension
  
Initializes this extension for path searches using the given configuration.
PathSearchExtension
  
Initializes this extension with the current edge set in the given context.
PathSearchExtension
  
Initializes this extension with the context that contains the list of edges for which paths are calculated.
PathSearchExtension
  
PathSearchExtension
  
Determines whether this extension considers the given entrance a valid target entrance, i.e.
PathSearchExtension
Property Detail
configurationproperty
configuration:PathSearchConfiguration  [read-only]

Returns the configuration used for the path search. This property is initialized in the init (initialize()) method.


Implementation
    protected function get configuration():PathSearchConfiguration

See also

contextproperty 
context:PathSearchContext  [read-only]

Returns the current context of the path search. This property is initialized in the initEdges (initializeEdges()) method.


Implementation
    protected function get context():PathSearchContext

See also

Constructor Detail
PathSearchExtension()Constructor
public function PathSearchExtension(init:Boolean = true)



Parameters
init:Boolean (default = true)
Method Detail
appendStartEntrances()method
protected function appendStartEntrances(allStartEntrances:List):void

Appends additional start entrances for the path search of the current edge to the given list of all previously generated entrances.

Parameters

allStartEntrances:List — a list of all previously generated entrances

calculateCosts()method 
protected function calculateCosts(currentEntrance:CellEntrance, enteredCell:PartitionCell, enterInterval:OrthogonalInterval, edgeCellInfo:EdgeCellInfo, maxAllowedCosts:Number):Number

Calculate the costs for entering the enteredCell via the enterInterval.

The given com.yworks.yfiles.layout.router.polyline.EdgeCellInfo describes how the partition cell, that has been entered by the current entrance, would be traversed if this enter interval to the neighbor cell would be chosen.

The maxAllowedCosts describe the maximum costs the entering of the neighbor cell via this enter intervals may induce. If the maximum cost is exceeded, calculations that may further increase its cost may be skipped because this interval won't be chosen anyway.

Parameters

currentEntrance:CellEntrance — The entrance that was used to enter the current cell.
 
enteredCell:PartitionCell — The neighbor cell that shall be entered.
 
enterInterval:OrthogonalInterval — The interval that shall be used to enter the neighbor cell.
 
edgeCellInfo:EdgeCellInfo — Information about how the current cell would be traversed if the neighbor cell would be entered by this enter interval.
 
maxAllowedCosts:Number — The maximum allowed costs for this enter intervals.

Returns
Number — The costs for entering the neighbor cell via the enter interval.

See also

calculateHeuristicCosts()method 
protected function calculateHeuristicCosts(entrance:CellEntrance):Number

Calculates the heuristic costs for the given entrance that describe the minimal costs that will arise to finish the path if the given cell entrance is used as next step.

After evaluating the costs for each enter interval to a neighbor cell, this method is called for each of the resulting com.yworks.yfiles.layout.router.polyline.CellEntrance s.

Parameters

entrance:CellEntrance — The entrance to calculate the heuristic costs for the rest of the path.

Returns
Number — The minimal costs that will arise to finish the path if the given cell entrance is used as next step.

See also

calculateStartEntranceCost()method 
protected function calculateStartEntranceCost(startEntrance:CellEntrance):Number

Returns the cost for starting the path in the given entrance. This method is called called for each start entrance of the current edge.

Parameters

startEntrance:CellEntrance — The start entrance to calculate the cost for.

Returns
Number — The cost for starting the path in the given entrance.
cancelCurrentEdge()method 
protected function cancelCurrentEdge(context:PathSearchContext):void

This callback notifies the extension when the path search for the current edge is cancelled.

After that, the path search will proceed with altering the penalties of the current edge and reinitializing it again.

Parameters

context:PathSearchContext — The context containing the current edge the path search has been finished for.

See also

cleanup()method 
protected function cleanup():void

Cleans the extension up from the path searches with the current configuration.

finalizeCurrentEdge()method 
protected function finalizeCurrentEdge(context:PathSearchContext):void

This callback notifies the extension when enough paths are found for the current edge.

After that, the path search either proceed with initializing the next current edge in the context's edge list or calls finalizeEdges() if all edges in this list have been handled.

Parameters

context:PathSearchContext — The context containing the current edge the path search has been finished for.

See also

finalizeEdges()method 
protected function finalizeEdges(context:PathSearchContext):void

This callback notifies the extension if enough paths have been found for all edges in the context's edge list.

Parameters

context:PathSearchContext — The context containing the list of edges, paths have been found for.

See also

finalizePath()method 
protected function finalizePath(path:Path):void

After finding a valid target entrance and creating a com.yworks.yfiles.layout.router.polyline.Path, the extension is notified about the found path.

If the path search is configured to calculate several possible paths for an edge, the path search proceeds with choosing another unhandled CellEntrance.

Parameters

path:Path — The path found for the current edge in the context.

See also

finalizePathSearchResult()method 
protected function finalizePathSearchResult(pathSearchResult:PathSearchResult):void

Callback notifying the extension about the paths chosen for the edges in the current context.

After calling finalizeEdges (finalizeEdges()), the PathSearch decides, which of the found paths to use for each edge and adds them to the com.yworks.yfiles.layout.router.polyline.PathSearchResult.

With this callback the registered extensions are notified about this result before the path search either initializes the next list of edges to route or ends the path search by calling cleanup().

Parameters

pathSearchResult:PathSearchResult — The path search result for the edge in the current context's edge list.

See also

getClass()method 
override public function getClass():Class

Returns
Class
initialize()method 
protected function initialize(configuration:PathSearchConfiguration):void

Initializes this extension for path searches using the given configuration.

This method is the first one to be called by the com.yworks.yfiles.layout.router.polyline.PathSearch.

Parameters

configuration:PathSearchConfiguration — The configuration to use for the following path searches.

See also

initializeCurrentEdge()method 
protected function initializeCurrentEdge(context:PathSearchContext):void

Initializes this extension with the current edge set in the given context. Called for each of the context's edges (context) . Each call will be balanced by a call to either finalizeCurrentEdge(PathSearchContext) or cancelCurrentEdge(PathSearchContext).

Parameters

context:PathSearchContext — The context containing the current edge.

See also

initializeEdges()method 
protected function initializeEdges(context:PathSearchContext):void

Initializes this extension with the context that contains the list of edges for which paths are calculated. May be called several times during a path search. Each call will be balanced by calls to finalizeEdges() and finalizePathSearchResult().

Parameters

context:PathSearchContext — The context containing the list of edges, paths shall be found for.

See also

initPathSearchExtension()method 
protected final function initPathSearchExtension():void

isValidTargetEntrance()method 
protected function isValidTargetEntrance(entrance:CellEntrance):Boolean

Determines whether this extension considers the given entrance a valid target entrance, i.e. the path may end with this entrance.

Each time a com.yworks.yfiles.layout.router.polyline.CellEntrance is chosen as next step, all registered extension are asked if this entrance is a valid target entrance. Only if none of the extensions returns false, a com.yworks.yfiles.layout.router.polyline.Path is created.

Parameters

entrance:CellEntrance — The entrance to decide if it is a valid target entrance.

Returns
Booleantrue, if the path may end with this entrance; false otherwise.

See also