Packagecom.yworks.yfiles.layout
Classpublic class DiscreteEdgeLabelLayoutModel
InheritanceDiscreteEdgeLabelLayoutModel Inheritance YObject Inheritance Object
Implements EdgeLabelModel

An edge label model that allows placement of labels at some positions along an edge.

It's possible to specify a distance value that controls the distance between label and edge. Furthermore, there's the possibility to mask out arbitrary edge label candidates. This can either be done by specifying predefined candidate masks or by OR-ing allowed label candidates to a user defined mask.



Public Properties
 PropertyDefined By
  candidateMask : int
[read-only] Returns the bit mask specifying the valid positions for edge labels.
DiscreteEdgeLabelLayoutModel
  defaultParameter : Object
[read-only] Returns a model parameter that encodes the default position of this model's allowed edge label positions.
DiscreteEdgeLabelLayoutModel
  distance : Number
Specifies the distance between the label's bounding box and the edge's path.
DiscreteEdgeLabelLayoutModel
Public Methods
 MethodDefined By
  
DiscreteEdgeLabelLayoutModel(init:Boolean = true)
Returns a new instance of DiscreteEdgeLabelModel.
DiscreteEdgeLabelLayoutModel
  
createModelParameter(labelBounds:YOrientedRectangle, edgeLayout:EdgeLayout, sourceNode:NodeLayout, targetNode:NodeLayout):Object
DiscreteEdgeLabelLayoutModel
  
createPositionParameter(position:int):Object
[static] Returns a model parameter that encodes the specified position.
DiscreteEdgeLabelLayoutModel
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
DiscreteEdgeLabelLayoutModel
  
getLabelCandidates(label:EdgeLabelLayout, edgeLayout:EdgeLayout, sourceNode:NodeLayout, targetNode:NodeLayout):YList
DiscreteEdgeLabelLayoutModel
  
getLabelPlacement(labelSize:YDimension, edgeLayout:EdgeLayout, sourceNode:NodeLayout, targetNode:NodeLayout, para:Object):YOrientedRectangle
DiscreteEdgeLabelLayoutModel
 Inherited
hashCode():int
YObject
  
isParameterValid(parameter:Object):Boolean
Checks if the given model parameter encodes an edge label position that is valid in this model.
DiscreteEdgeLabelLayoutModel
  
[static] Returns a new instance of DiscreteEdgeLabelModel.
DiscreteEdgeLabelLayoutModel
  
[static] Returns a new instance of DiscreteEdgeLabelModel.
DiscreteEdgeLabelLayoutModel
Protected Methods
 MethodDefined By
  
getLabelPlacementForParameter(labelSize:YDimension, edgeLayout:EdgeLayout, sourceNode:NodeLayout, targetNode:NodeLayout, pos:int):YOrientedRectangle
Returns the coordinates of the upper-left corner of the given label position.
DiscreteEdgeLabelLayoutModel
  
Initializes this object.
DiscreteEdgeLabelLayoutModel
  
initDiscreteEdgeLabelLayoutModel2(candidateMask:int):void
Initializes this object.
DiscreteEdgeLabelLayoutModel
Public Constants
 ConstantDefined By
  CENTER : int = 128
[static] Symbolic position specifier.
DiscreteEdgeLabelLayoutModel
  CENTERED : int = 128
[static] Position mask that constrains allowed positions to CENTER.
DiscreteEdgeLabelLayoutModel
  HEAD : int = 2
[static] Symbolic position specifier.
DiscreteEdgeLabelLayoutModel
  SCENTER : int = 64
[static] Symbolic position specifier.
DiscreteEdgeLabelLayoutModel
  SHEAD : int = 1
[static] Symbolic position specifier.
DiscreteEdgeLabelLayoutModel
  SIX_POS : int
[static] Position mask that constrains allowed positions to a set of six positions on the "head" and "tail" sides of an edge.
DiscreteEdgeLabelLayoutModel
  STAIL : int = 8
[static] Symbolic position specifier.
DiscreteEdgeLabelLayoutModel
  TAIL : int = 16
[static] Symbolic position specifier.
DiscreteEdgeLabelLayoutModel
  TCENTER : int = 256
[static] Symbolic position specifier.
DiscreteEdgeLabelLayoutModel
  THEAD : int = 4
[static] Symbolic position specifier.
DiscreteEdgeLabelLayoutModel
  THREE_CENTER : int
[static] Position mask that constrains allowed positions to a set of three positions directly on the edge's path.
DiscreteEdgeLabelLayoutModel
  TTAIL : int = 32
[static] Symbolic position specifier.
DiscreteEdgeLabelLayoutModel
  TWO_POS : int
[static] Position mask that constrains allowed positions to the two near the edge's end points.
DiscreteEdgeLabelLayoutModel
Property Detail
candidateMaskproperty
candidateMask:int  [read-only]

Returns the bit mask specifying the valid positions for edge labels.

Defaults to SIX_POS.


Implementation
    public function get candidateMask():int

See also

defaultParameterproperty 
defaultParameter:Object  [read-only]

Returns a model parameter that encodes the default position of this model's allowed edge label positions.

Default positions are (in descending order): Descending order means that whenever two or more of the above default positions are part of the allowed positions, then the model parameter encodes the one that is listed first.

Note that the model parameter encodes CENTER when none of the above default positions is part of the allowed positions.


Implementation
    public function get defaultParameter():Object

See also

distanceproperty 
distance:Number

Specifies the distance between the label's bounding box and the edge's path.


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

Returns a new instance of DiscreteEdgeLabelModel. Position mask SIX_POS is used to define the allowed positions for an edge label.

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
createModelParameter()method
public function createModelParameter(labelBounds:YOrientedRectangle, edgeLayout:EdgeLayout, sourceNode:NodeLayout, targetNode:NodeLayout):Object

Parameters

labelBounds:YOrientedRectangle
 
edgeLayout:EdgeLayout
 
sourceNode:NodeLayout
 
targetNode:NodeLayout

Returns
Object
createPositionParameter()method 
public static function createPositionParameter(position:int):Object

Returns a model parameter that encodes the specified position.

Parameters

position:int — one of
  • SHEAD,
  • HEAD,
  • THEAD,
  • STAIL,
  • TAIL,
  • TTAIL,
  • SCENTER,
  • CENTER,
  • TCENTER

Returns
Object — a model parameter that encodes the specified position.

Throws
IllegalArgumentException — if the specified position is not one of the symbolic position constants defined in this class.

See also

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

Returns
Class
getLabelCandidates()method 
public function getLabelCandidates(label:EdgeLabelLayout, edgeLayout:EdgeLayout, sourceNode:NodeLayout, targetNode:NodeLayout):YList

Parameters

label:EdgeLabelLayout
 
edgeLayout:EdgeLayout
 
sourceNode:NodeLayout
 
targetNode:NodeLayout

Returns
YList
getLabelPlacement()method 
public function getLabelPlacement(labelSize:YDimension, edgeLayout:EdgeLayout, sourceNode:NodeLayout, targetNode:NodeLayout, para:Object):YOrientedRectangle

Parameters

labelSize:YDimension
 
edgeLayout:EdgeLayout
 
sourceNode:NodeLayout
 
targetNode:NodeLayout
 
para:Object

Returns
YOrientedRectangle
getLabelPlacementForParameter()method 
protected function getLabelPlacementForParameter(labelSize:YDimension, edgeLayout:EdgeLayout, sourceNode:NodeLayout, targetNode:NodeLayout, pos:int):YOrientedRectangle

Returns the coordinates of the upper-left corner of the given label position.

Parameters

labelSize:YDimension — The size of the label that should be placed.
 
edgeLayout:EdgeLayout — The layout of the edge to which the label belongs.
 
sourceNode:NodeLayout — The layout of the source node of the label owning edge.
 
targetNode:NodeLayout — The layout of the target node of the label owning edge.
 
pos:int — A label position (given by a symbolic position specifier) that is valid in this model.

Returns
YOrientedRectangle — The coordinates of the upper-left corner of a label position.
initDiscreteEdgeLabelLayoutModel1()method 
protected final function initDiscreteEdgeLabelLayoutModel1():void

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

See also

initDiscreteEdgeLabelLayoutModel2()method 
protected final function initDiscreteEdgeLabelLayoutModel2(candidateMask:int):void

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

Parameters

candidateMask:int

See also

isParameterValid()method 
public function isParameterValid(parameter:Object):Boolean

Checks if the given model parameter encodes an edge label position that is valid in this model.

Parameters

parameter:Object

Returns
Boolean — Whether the label position encoded by the given model parameter is among the allowed positions.
newDiscreteEdgeLabelLayoutModel1()method 
public static function newDiscreteEdgeLabelLayoutModel1():DiscreteEdgeLabelLayoutModel

Returns a new instance of DiscreteEdgeLabelModel. Position mask SIX_POS is used to define the allowed positions for an edge label.

Returns
DiscreteEdgeLabelLayoutModel

See also

newDiscreteEdgeLabelLayoutModel2()method 
public static function newDiscreteEdgeLabelLayoutModel2(candidateMask:int):DiscreteEdgeLabelLayoutModel

Returns a new instance of DiscreteEdgeLabelModel.

Parameters

candidateMask:int — Position mask that defines the allowed positions for an edge label.

Returns
DiscreteEdgeLabelLayoutModel
Constant Detail
CENTERConstant
public static const CENTER:int = 128

Symbolic position specifier. Places the label near the middle of an edge directly on its path.

CENTEREDConstant 
public static const CENTERED:int = 128

Position mask that constrains allowed positions to CENTER.

See also

HEADConstant 
public static const HEAD:int = 2

Symbolic position specifier. Places the label near the middle of the edge's path. The label's position is to the left of or above the edge's path.

SCENTERConstant 
public static const SCENTER:int = 64

Symbolic position specifier. Places the label near the source node directly on the edge path.

SHEADConstant 
public static const SHEAD:int = 1

Symbolic position specifier. Places the label near the source node. The label's position is to the left of or above the edge's path.

SIX_POSConstant 
public static const SIX_POS:int

Position mask that constrains allowed positions to a set of six positions on the "head" and "tail" sides of an edge. Namely, these are SHEAD, HEAD, THEAD, STAIL, TAIL, and TTAIL .

See also

STAILConstant 
public static const STAIL:int = 8

Symbolic position specifier. Places the label near the source node. The label's position is to the right of or below the edge's path.

TAILConstant 
public static const TAIL:int = 16

Symbolic position specifier. Places the label near the middle of the edge's path. The label's position is to the right of or below the edge's path.

TCENTERConstant 
public static const TCENTER:int = 256

Symbolic position specifier. Places the label near the target node directly on the edge path.

THEADConstant 
public static const THEAD:int = 4

Symbolic position specifier. Places the label near the target node. The label's position is to the left of or above the edge's path. Places the label near the target node on the "head" side of the edge.

THREE_CENTERConstant 
public static const THREE_CENTER:int

Position mask that constrains allowed positions to a set of three positions directly on the edge's path. Namely, these are SCENTER, CENTER, and TCENTER .

See also

TTAILConstant 
public static const TTAIL:int = 32

Symbolic position specifier. Places the label near the target node. The label's position is to the right of or below the edge's path.

TWO_POSConstant 
public static const TWO_POS:int

Position mask that constrains allowed positions to the two near the edge's end points. Namely, these are HEAD and TAIL .

See also