Package | com.yworks.yfiles.layout.router |
Class | public class BusRouter |
Inheritance | BusRouter AbstractLayoutStage YObject Object |
In a drawing of this algorithm, each edge path is orthogonal and there are no cycles induced by any two edge paths of the same bus, that is, the combination of all edge routes looks like an orthogonal tree. Besides these strict requirements, the algorithm aims to find routes where shared paths of edges with different end-nodes are drawn on top of each other and form long straight lines, so-called backbone segments. From these backbone segments, short connections of grouped edges branch off to each node (bus connections).
This routing algorithm uses a two-phase process. First, in backbone selection, a set of good initial backbone segments is determined. In routing and recombination, each initial backbone segment is connected to all others and also to each node by using orthogonal edge paths. Then, the set of resulting structures is reduced to the most optimal structure where backbone segments are long and connections to the nodes are short. Note that the calculated paths can join before reaching an initial backbone segment and, thus, establish additional backbone segments. Contrariwise, initial backbone segments of low overall profit are discarded and connections to them are rerouted to other backbone segments.
To determine which edges belong to a common bus, a mapping that assigns a bus ID to each edge must be specified using com.yworks.yfiles.layout.router.BusDescriptor s. A data provider holding bus descriptor objects is expected to be registered with the graph using the EDGE_DESCRIPTOR_DPKEY look-up key. In the absence of an individual bus ID for an edge, a bus consisting only of the single edge is created. Additionally, a bus descriptors allows to mark its associated edge as fixed or movable, which is required for incremental routing, and to specify an optional group ID for an edge's source end and target end, respectively.
Incremental routing means extending or updating an already existing bus-style representation. This can be used to rearrange existing edges or to include additional edges in an existing bus. The paths of edges not marked as fixed by their associated BusDescriptor (com.yworks.yfiles.layout.router.BusDescriptor.fixed) are calculated anew. The structure induced by the fixed edges must be orthogonal and cycle-free.
See also
Property | Defined By | ||
---|---|---|---|
coreLayouter : Layouter
Specifies the core layouter. | AbstractLayoutStage | ||
crossingCost : Number
Specifies the cost for each edge crossing of a routed path. | BusRouter | ||
gridRouting : Boolean
Getter:
Returns whether or not to route edge segments on grid lines. | BusRouter | ||
gridSpacing : int
Specifies the grid spacing that is used when grid routing is enabled. | BusRouter | ||
minimumBackboneSegmentLength : Number
Specifies the preferred minimum length of a backbone segment. | BusRouter | ||
minimumBusConnectionsCount : int
Getter:
Returns the minimum number of bus connections each backbone segment must have. | BusRouter | ||
minimumDistanceToEdge : int
Specifies the minimum distance between edge segments. | BusRouter | ||
minimumDistanceToNode : int
Specifies the minimum distance between edge segments and nodes. | BusRouter | ||
preferredBackboneSegmentCount : int
Getter:
Returns the preferred number of backbone segments with the same orientation. | BusRouter | ||
removeCollinearBends : Boolean
Specifies whether or not collinear bends are removed from the layout. | BusRouter | ||
rerouting : Boolean
Getter:
Returns whether rerouting of edges with many crossings is enabled. | BusRouter | ||
scope : int
Getter:
Returns the scope set for this router. | BusRouter | ||
selectedEdgesDpKey : Object
Specifies the DataProvider key to mark edges as selected. | BusRouter |
Method | Defined By | ||
---|---|---|---|
BusRouter(init:Boolean = true)
Creates a new instance of BusRouter. | BusRouter | ||
canLayout(graph:LayoutGraph):Boolean [override]
Returns true if the specified graph can be routed by this algorithm. | BusRouter | ||
doLayout(graph:LayoutGraph):void [override]
Calculates a new bus layout for the specified graph. | BusRouter | ||
equals(o:Object):Boolean | YObject | ||
getClass():Class [override] | BusRouter | ||
hashCode():int | YObject | ||
[static]
Creates a new instance of BusRouter. | BusRouter | ||
setProperty(key:String, value:Object):Boolean
Provides access to implementation specific properties of the algorithms used internally. | BusRouter |
Method | Defined By | ||
---|---|---|---|
canLayoutCore(graph:LayoutGraph):Boolean
Queries the core layouter whether or not the given graph can be laid out. | AbstractLayoutStage | ||
Factory method that creates an appropriate OrthogonalEdgeRouter implementation. | BusRouter | ||
doLayoutCore(graph:LayoutGraph):void
Invokes the layout routine of the core layouter. | AbstractLayoutStage | ||
initAbstractLayoutStage1():void | AbstractLayoutStage | ||
initAbstractLayoutStage2(core:Layouter):void | AbstractLayoutStage | ||
initBusRouter():void
Initializes this object. | BusRouter |
Constant | Defined By | ||
---|---|---|---|
EDGE_DESCRIPTOR_DPKEY : Object = y.layout.router.BusRouter.EDGE_DESCRIPTOR_DPKEY [static]
com.yworks.yfiles.base.DataProvider key used to store the com.yworks.yfiles.layout.router.BusDescriptor of every edge. | BusRouter | ||
EDGE_SUBSET_DPKEY : Object = y.layout.router.BusRouter.EDGE_SUBSET_DPKEY [static]
com.yworks.yfiles.base.DataProvider key used for specifying the edge subset to be laid out. | BusRouter | ||
SCOPE_ALL : int [static]
Scope constant - used for routing all edges in the graph. | BusRouter | ||
SCOPE_SUBSET : int [static]
Scope constant - used for routing only a subset of edges. | BusRouter |
crossingCost | property |
crossingCost:Number
Specifies the cost for each edge crossing of a routed path.
A cost of n
means that a path rather changes direction n
times than crossing the path of an edge. If the cost is set to 0.0
, no global crossing optimization is performed. Setting a higher value will activate global crossing minimization. A good trade-off between the number of direction changes and few crossings of a path is achieved by values between 1.0
and 3.0
. By default, a cost of 1.0
is set.
public function get crossingCost():Number
public function set crossingCost(value:Number):void
gridRouting | property |
gridRouting:Boolean
Getter: Returns whether or not to route edge segments on grid lines.
Setter: Specifies whether or not to route edge segments on grid lines only. By default, this feature is disabled. public function get gridRouting():Boolean
public function set gridRouting(value:Boolean):void
See also
gridSpacing | property |
gridSpacing:int
Specifies the grid spacing that is used when grid routing is enabled.
By default, a spacing of 10
is set.
public function get gridSpacing():int
public function set gridSpacing(value:int):void
See also
minimumBackboneSegmentLength | property |
minimumBackboneSegmentLength:Number
Specifies the preferred minimum length of a backbone segment.
This should be at least as large as the typical distance between nodes to avoid small backbone segments. It is reasonable to set this according to the dimension of the graph's bounding box. By default, a minimum length of 100.0
is set.
public function get minimumBackboneSegmentLength():Number
public function set minimumBackboneSegmentLength(value:Number):void
minimumBusConnectionsCount | property |
minimumBusConnectionsCount:int
Getter: Returns the minimum number of bus connections each backbone segment must have.
Setter: Sets the minimum number of bus connections a backbone segment must have. If a backbone segment has less connections, it is removed and the affected nodes connect to another backbone segment. Three or four is a good choice for small graphs, for larger graphs a much larger count can be reasonable. By default, a minimum count of3
is set. This setting is taken into account only in the routing and recombination phase and does not affect the selection of the initial backbone segments.
public function get minimumBusConnectionsCount():int
public function set minimumBusConnectionsCount(value:int):void
minimumDistanceToEdge | property |
minimumDistanceToEdge:int
Specifies the minimum distance between edge segments.
By default, a distance of 5
is set.
public function get minimumDistanceToEdge():int
public function set minimumDistanceToEdge(value:int):void
See also
minimumDistanceToNode | property |
minimumDistanceToNode:int
Specifies the minimum distance between edge segments and nodes.
By default, a distance of 10
is set.
public function get minimumDistanceToNode():int
public function set minimumDistanceToNode(value:int):void
See also
preferredBackboneSegmentCount | property |
preferredBackboneSegmentCount:int
Getter: Returns the preferred number of backbone segments with the same orientation.
Setter: Sets the maximal number of selected backbone segments with the same orientation. The more initial backbone segments, the longer the running time. By default, a count of2
is set. This count defines the number of backbone segments of the same orientation which are computed by the backbone selection phase. The final number of backbone segments may be different due to changes in the routing and recombination phase.
public function get preferredBackboneSegmentCount():int
public function set preferredBackboneSegmentCount(value:int):void
removeCollinearBends | property |
removeCollinearBends:Boolean
Specifies whether or not collinear bends are removed from the layout. If an edge has a collinear bend, there is another edge which has a real bend at this point, i.e. the bend location is an intersection of the bus. Therefore, it is advantageous for some applications to keep such bends. By default, this feature is enabled.
public function get removeCollinearBends():Boolean
public function set removeCollinearBends(value:Boolean):void
rerouting | property |
rerouting:Boolean
Getter: Returns whether rerouting of edges with many crossings is enabled.
Setter: Specifies whether or not to enable a further crossing minimization optimization based on rerouting edges that cross many edges. By default, this feature is disabled. Activating this feature only makes sense if the global crossing cost is set to a value greater than0.0
. This setting is taken into account only in the routing and recombination phase and does not affect the selection of the initial backbone segments.
public function get rerouting():Boolean
public function set rerouting(value:Boolean):void
See also
scope | property |
scope:int
Getter: Returns the scope set for this router.
Setter: Sets the scope for this router. The scope determines which edges are routed. Defaults to SCOPE_ALL. public function get scope():int
public function set scope(value:int):void
See also
selectedEdgesDpKey | property |
selectedEdgesDpKey:Object
Specifies the DataProvider
key to mark edges as selected.
By default, EDGE_SUBSET_DPKEY is used.
public function get selectedEdgesDpKey():Object
public function set selectedEdgesDpKey(value:Object):void
IllegalArgumentException — if the specified key is null .
|
See also
BusRouter | () | Constructor |
public function BusRouter(init:Boolean = true)
Creates a new instance of BusRouter
.
init:Boolean (default = true ) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods.
This parameter can safely be ignored/omitted when calling the constructor.
|
canLayout | () | method |
override public function canLayout(graph:LayoutGraph):Boolean
Returns true
if the specified graph can be routed by this algorithm.
Calling doLayout() with the specified graph as its argument will only succeed if this method returns true
.
Parameters
graph:LayoutGraph |
Boolean |
See also
createOrthogonalEdgeRouter | () | method |
protected function createOrthogonalEdgeRouter():OrthogonalEdgeRouter
Factory method that creates an appropriate OrthogonalEdgeRouter implementation.
ReturnsOrthogonalEdgeRouter — an appropriate OrthogonalEdgeRouter
|
doLayout | () | method |
override public function doLayout(graph:LayoutGraph):void
Calculates a new bus layout for the specified graph.
Parameters
graph:LayoutGraph — the graph to lay out
|
getClass | () | method |
override public function getClass():Class
ReturnsClass |
initBusRouter | () | method |
protected final function initBusRouter():void
Initializes this object. See the documentation of the corresponding factory method newBusRouter()
for details.
See also
newBusRouter | () | method |
public static function newBusRouter():BusRouter
Creates a new instance of BusRouter
.
BusRouter |
setProperty | () | method |
public function setProperty(key:String, value:Object):Boolean
Provides access to implementation specific properties of the algorithms used internally. Used for internal purposes.
Parameters
key:String — the key to a property
| |
value:Object — the value to associate with the key
|
Boolean |
EDGE_DESCRIPTOR_DPKEY | Constant |
public static const EDGE_DESCRIPTOR_DPKEY:Object = y.layout.router.BusRouter.EDGE_DESCRIPTOR_DPKEY
com.yworks.yfiles.base.DataProvider key used to store the com.yworks.yfiles.layout.router.BusDescriptor of every edge. A bus descriptor provides the edge's bus ID, its optional group IDs and whether or not the edge is fixed.
See also
EDGE_SUBSET_DPKEY | Constant |
public static const EDGE_SUBSET_DPKEY:Object = y.layout.router.BusRouter.EDGE_SUBSET_DPKEY
com.yworks.yfiles.base.DataProvider key used for specifying the edge subset to be laid out. This key is used if no custom key is set. The algorithm expects for each edge in the graph to find a boolean (com.yworks.yfiles.base.DataProvider.getBool()) that indicates whether the node belongs to the scope.
See also
SCOPE_ALL | Constant |
public static const SCOPE_ALL:int
Scope constant - used for routing all edges in the graph.
See also
SCOPE_SUBSET | Constant |
public static const SCOPE_SUBSET:int
Scope constant - used for routing only a subset of edges. This subset has to be specified by registering an appropriate com.yworks.yfiles.base.DataProvider.
See also