Packagecom.yworks.yfiles.layout.router
Classpublic class OrthogonalSegmentDistributionStage
InheritanceOrthogonalSegmentDistributionStage Inheritance AbstractLayoutStage Inheritance YObject Inheritance Object

This class can be used to distribute overlapping edge segments of orthogonally routed edges. The edge segments will then be distributed in their so called channel according to the given settings. The channel in which the segments can be distributed is defined by the surrounding graph elements, which will form borderlines for the channel.

The distance between the distributed edge segments can be determined by method preferredDistance.

The edge segments can also be forced to be distributed on a given grid ( gridEnabled ) whose origin ( setGridOffset() ) and grid width ( gridWidth ) can be set.

Note: this LayoutStage is not capable of moving nodes. If the set conditions like preferred distance or the grid width can not be satisfied, for example, because there is not enough space inside the channel, the set values will by default be adjusted (reduced). Concerning the grid, it will be divided by 2 until all segments will fit. The preferred distance will be adjusted so that the maximum possible distance near the given value will be taken. Also, segments that are directly at a node (source or target) will be distributed, so that they are placed equidistant all along the node's side.

Settings gridWidthAdjustable and preferredDistanceAdjustable can be used to force the algorithm to distribute the edges with the exact given distances. If the segments will not fit into the given channel, they then will not be distributed at all. So there is a guarantee that they will match the settings if they are routed.

lockFirstAndLastSegment can be used to guarantee that the first and last segment of an edge (connected to source or target), won't be distributed. So ports can easily be kept without setting explicit strong port constraints or fixed PortCandidates.

The algorithm will not distribute the segments, whose end connect to a node at a strong port constraint or fixed port candidate.

See also

preferredDistance
gridEnabled
setGridOffset()
gridWidth
gridWidthAdjustable
preferredDistanceAdjustable
lockFirstAndLastSegment


Public Properties
 PropertyDefined By
  affectedEdgesDpKey : Object
Specifies the DataProvider key, which determines the edges, that shall be distributed by the algorithm.
OrthogonalSegmentDistributionStage
 InheritedcoreLayouter : Layouter
Specifies the core layouter.
AbstractLayoutStage
  gridEnabled : Boolean
Specifies whether grid distribution is enabled or not.
OrthogonalSegmentDistributionStage
  gridOffsetX : Number
[read-only] Returns the grid offset in x direction.
OrthogonalSegmentDistributionStage
  gridOffsetY : Number
[read-only] Returns the grid offset in y direction.
OrthogonalSegmentDistributionStage
  gridWidth : Number
Specifies the grid width that shall be used if grid distribution is enabled.
OrthogonalSegmentDistributionStage
  gridWidthAdjustable : Boolean
Specifies whether or not the algorithm is allowed to reduce the grid width, if segments cannot be distributed using the previously given grid width.
OrthogonalSegmentDistributionStage
  lockFirstAndLastSegment : Boolean
Getter: Returns whether the first and last segment of an edge (connected to source or target), will be distributed.
OrthogonalSegmentDistributionStage
  preferredDistance : Number
Specifies the preferred distance, segments shall have to each other and to the channel's border.
OrthogonalSegmentDistributionStage
  preferredDistanceAdjustable : Boolean
Determines what happens if the preferred distance can not be kept, because there is not enough space for the segments to be distributed in that distance.
OrthogonalSegmentDistributionStage
Public Methods
 MethodDefined By
  
OrthogonalSegmentDistributionStage
  
canLayout(graph:LayoutGraph):Boolean
[override]
OrthogonalSegmentDistributionStage
  
doLayout(graph:LayoutGraph):void
[override]
OrthogonalSegmentDistributionStage
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
OrthogonalSegmentDistributionStage
 Inherited
hashCode():int
YObject
  
[static]
OrthogonalSegmentDistributionStage
  
setGridOffset(offsetX:Number, offsetY:Number):void
Can be used to set the grid origin.
OrthogonalSegmentDistributionStage
Protected Methods
 MethodDefined By
 Inherited
canLayoutCore(graph:LayoutGraph):Boolean
Queries the core layouter whether or not the given graph can be laid out.
AbstractLayoutStage
 Inherited
Invokes the layout routine of the core layouter.
AbstractLayoutStage
 Inherited
AbstractLayoutStage
 Inherited
AbstractLayoutStage
  
Initializes this object.
OrthogonalSegmentDistributionStage
Public Constants
 ConstantDefined By
  AFFECTED_EDGES : Object = y.layout.router.OrthogonalSegmentDistributionStage.AFFECTED_EDGES
[static] DataProvider key that can be used to determine which edges the distribution stage will route.
OrthogonalSegmentDistributionStage
Property Detail
affectedEdgesDpKeyproperty
affectedEdgesDpKey:Object

Specifies the DataProvider key, which determines the edges, that shall be distributed by the algorithm.

By default, AFFECTED_EDGES is used.


Implementation
    public function get affectedEdgesDpKey():Object
    public function set affectedEdgesDpKey(value:Object):void

See also

gridEnabledproperty 
gridEnabled:Boolean

Specifies whether grid distribution is enabled or not. If so, all segments will be distributed onto the grid. By default grid distribution is not enabled.


Implementation
    public function get gridEnabled():Boolean
    public function set gridEnabled(value:Boolean):void
gridOffsetXproperty 
gridOffsetX:Number  [read-only]

Returns the grid offset in x direction. by default this will be 0.


Implementation
    public function get gridOffsetX():Number
gridOffsetYproperty 
gridOffsetY:Number  [read-only]

Returns the grid offset in y direction. by default this will be 0.


Implementation
    public function get gridOffsetY():Number
gridWidthproperty 
gridWidth:Number

Specifies the grid width that shall be used if grid distribution is enabled. By default the grid width is 10.0.


Implementation
    public function get gridWidth():Number
    public function set gridWidth(value:Number):void
gridWidthAdjustableproperty 
gridWidthAdjustable:Boolean

Specifies whether or not the algorithm is allowed to reduce the grid width, if segments cannot be distributed using the previously given grid width. The algorithm will divide the given grid width by 2 as long as the segments will not fit and thus will lead to nicer results than taking some other value. Note: The grid width will only be adjusted for segments that cannot keep the originally set grid width.

By default, the algorithm is allowed to reduce the grid width.


Implementation
    public function get gridWidthAdjustable():Boolean
    public function set gridWidthAdjustable(value:Boolean):void
lockFirstAndLastSegmentproperty 
lockFirstAndLastSegment:Boolean

Getter: Returns whether the first and last segment of an edge (connected to source or target), will be distributed. Defaults to false, i.e. first and last segments are not locked.

Setter: Determines whether the first and last segment of an edge (connected to source or target), will be distributed. So ports can easily be kept without setting explicit strong port constraints or fixed PortCandidates. Defaults to false, i.e. first and last segments are not locked.


Implementation
    public function get lockFirstAndLastSegment():Boolean
    public function set lockFirstAndLastSegment(value:Boolean):void
preferredDistanceproperty 
preferredDistance:Number

Specifies the preferred distance, segments shall have to each other and to the channel's border.

Default value is 10.0.

Note: if preferredDistanceAdjustable is set to true (which is the default), the preferred distance might be adjusted so that the maximum possible distance near the given value will be taken. This happens if the channel is not big enough to fit in all segments with the desired preferred distance.


Implementation
    public function get preferredDistance():Number
    public function set preferredDistance(value:Number):void

See also

preferredDistanceAdjustableproperty 
preferredDistanceAdjustable:Boolean

Determines what happens if the preferred distance can not be kept, because there is not enough space for the segments to be distributed in that distance. If set to true the algorithm is allowed to reduce the distance to the next best value, that is possible. If set to false the algorithm will not at all distribute those segments. By default the setting is true and therefore segments will be distributed. Note: Preferred distances will not be kept for segments connecting to nodes (first and last segment of an edge). The segments are distributed equidistant all along the node side, thus may lead to bigger distances between segments.


Implementation
    public function get preferredDistanceAdjustable():Boolean
    public function set preferredDistanceAdjustable(value:Boolean):void
Constructor Detail
OrthogonalSegmentDistributionStage()Constructor
public function OrthogonalSegmentDistributionStage(init:Boolean = true)

Parameters
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.
Method Detail
canLayout()method
override public function canLayout(graph:LayoutGraph):Boolean

Parameters

graph:LayoutGraph

Returns
Boolean
doLayout()method 
override public function doLayout(graph:LayoutGraph):void

Parameters

graph:LayoutGraph

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

Returns
Class
initOrthogonalSegmentDistributionStage()method 
protected final function initOrthogonalSegmentDistributionStage():void

Initializes this object. See the documentation of the corresponding factory method newOrthogonalSegmentDistributionStage() for details.

See also

newOrthogonalSegmentDistributionStage()method 
public static function newOrthogonalSegmentDistributionStage():OrthogonalSegmentDistributionStage

Returns
OrthogonalSegmentDistributionStage
setGridOffset()method 
public function setGridOffset(offsetX:Number, offsetY:Number):void

Can be used to set the grid origin. By default the offset is (0, 0), so there is no offset.

Parameters

offsetX:Number — the offset in x direction.
 
offsetY:Number — the offset in y direction

Constant Detail
AFFECTED_EDGESConstant
public static const AFFECTED_EDGES:Object = y.layout.router.OrthogonalSegmentDistributionStage.AFFECTED_EDGES

DataProvider key that can be used to determine which edges the distribution stage will route.