Packagecom.yworks.yfiles.layout.hierarchic.incremental
Classpublic class DefaultPortAllocator
InheritanceDefaultPortAllocator Inheritance YObject Inheritance Object
Implements PortAllocator

Default implementation of the PortAllocator interface.



Public Properties
 PropertyDefined By
  defaultPortBorderGapRatio : Number
Getter: Returns the default port to border gap ratio.
DefaultPortAllocator
Public Methods
 MethodDefined By
  
DefaultPortAllocator(init:Boolean = true)
Creates a new instance of DefaultPortAllocator with default settings
DefaultPortAllocator
  
assignPorts(graph:LayoutGraph, layers:Layers, ldp:LayoutDataProvider, itemFactory:ItemFactory):void
Assigns the port positions for the drawer.
DefaultPortAllocator
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
DefaultPortAllocator
 Inherited
hashCode():int
YObject
  
[static] Creates a new instance of DefaultPortAllocator with default settings
DefaultPortAllocator
Protected Methods
 MethodDefined By
  
getPortBorderGap(graph:LayoutGraph, ldp:LayoutDataProvider, node:Node, sideIndex:int, sideLength:Number, edgeCount:int):Number
Callback method used to determine the port border gap for each node and side.
DefaultPortAllocator
  
getPortBorderGapRatio(graph:LayoutGraph, ldp:LayoutDataProvider, node:Node, sideIndex:int, sideLength:Number, edgeCount:int):Number
Callback method used to determine the port border gap ratio.
DefaultPortAllocator
  
getPortDistanceDelta(graph:LayoutGraph, ldp:LayoutDataProvider, node:Node, sideIndex:int, sideLength:Number, edgeCount:int, portBorderGap:Number):Number
Callback method used to determine the distance between two adjacent ports
DefaultPortAllocator
  
Initializes this object.
DefaultPortAllocator
Property Detail
defaultPortBorderGapRatioproperty
defaultPortBorderGapRatio:Number

Getter: Returns the default port to border gap ratio.

Setter: Sets for default port to border gap ratio. This ratio determines the gap between a corner of the node and the first assigned port. A value of 0.0d results in ports being placed directly on the corner of the node (if there is more than one port). The default value of 0.5d results in ports being distributed along the side of the node so that the distance between the corner of the node and the first port is half as wide as the distance between two adjacent ports. A value of Double.POSITIVE_INFINITY results in all ports being centered at the side in one point.


Implementation
    public function get defaultPortBorderGapRatio():Number
    public function set defaultPortBorderGapRatio(value:Number):void
Constructor Detail
DefaultPortAllocator()Constructor
public function DefaultPortAllocator(init:Boolean = true)

Creates a new instance of DefaultPortAllocator with default settings

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.

See also

Method Detail
assignPorts()method
public function assignPorts(graph:LayoutGraph, layers:Layers, ldp:LayoutDataProvider, itemFactory:ItemFactory):void

Assigns the port positions for the drawer. Assigns com.yworks.yfiles.layout.PortConstraint.ANY_SIDE ports to appropriate sides. Assigns weak (com.yworks.yfiles.layout.PortConstraint.strong) ports to appropriate positions between strong ones

Parameters

graph:LayoutGraph — the graph
 
layers:Layers — the layering
 
ldp:LayoutDataProvider — the LayoutDataProvider that can be used to query information
 
itemFactory:ItemFactory — the ItemFactory that can be used for temporarily altering the graph

See also

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

Returns
Class
getPortBorderGap()method 
protected function getPortBorderGap(graph:LayoutGraph, ldp:LayoutDataProvider, node:Node, sideIndex:int, sideLength:Number, edgeCount:int):Number

Callback method used to determine the port border gap for each node and side.

Parameters

graph:LayoutGraph — the graph
 
ldp:LayoutDataProvider — the LayoutDataProvider that can be used to query information from
 
node:Node — the node
 
sideIndex:int — the zero based (top is 0) clock-wise index of the side of the node (for top-to-bottom layouts)
 
sideLength:Number — the width/height of the side
 
edgeCount:int — the number of edges/port that connect to this side

Returns
Number — the absolute gap to be used on both sides of the ports

See also

getPortBorderGapRatio()method 
protected function getPortBorderGapRatio(graph:LayoutGraph, ldp:LayoutDataProvider, node:Node, sideIndex:int, sideLength:Number, edgeCount:int):Number

Callback method used to determine the port border gap ratio. See defaultPortBorderGapRatio for an explanation. This implementation returns the same value as defaultPortBorderGapRatio does.

Parameters

graph:LayoutGraph — the graph
 
ldp:LayoutDataProvider — the LayoutDataProvider that can be used to query information from
 
node:Node — the node
 
sideIndex:int — the zero based (top is 0) clock-wise index of the side of the node (for top-to-bottom layouts)
 
sideLength:Number — the width/height of the side
 
edgeCount:int — the number of edges/port that connect to this side

Returns
Number — the ratio

See also

getPortDistanceDelta()method 
protected function getPortDistanceDelta(graph:LayoutGraph, ldp:LayoutDataProvider, node:Node, sideIndex:int, sideLength:Number, edgeCount:int, portBorderGap:Number):Number

Callback method used to determine the distance between two adjacent ports

Parameters

graph:LayoutGraph — the graph
 
ldp:LayoutDataProvider — the LayoutDataProvider that can be used to query information from
 
node:Node — the node
 
sideIndex:int — the zero based (top is 0) clock-wise index of the side of the node (for top-to-bottom layouts)
 
sideLength:Number — the width/height of the side
 
edgeCount:int — the number of edges/port that connect to this side
 
portBorderGap:Number — the previously calculated port border gap

Returns
Number — the absolute distance to be used between two adjacent ports
initDefaultPortAllocator()method 
protected final function initDefaultPortAllocator():void

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

See also

newDefaultPortAllocator()method 
public static function newDefaultPortAllocator():DefaultPortAllocator

Creates a new instance of DefaultPortAllocator with default settings

Returns
DefaultPortAllocator

See also