Packagecom.yworks.yfiles.layout
Classpublic class DiscreteNodeLabelLayoutModel
InheritanceDiscreteNodeLabelLayoutModel Inheritance YObject Inheritance Object
Implements NodeLabelModel

A node label model that allows placement of labels at eight positions around a node and at nine positions inside the node.

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



Public Properties
 PropertyDefined By
  candidateMask : int
[read-only] Allowed candidate positions, default is all positions.
DiscreteNodeLabelLayoutModel
  defaultParameter : Object
[read-only] Returns a model parameter that encodes the default position of this model's allowed node label positions.
DiscreteNodeLabelLayoutModel
  distance : Number
Getter: Returns the distance between the bounding boxes of label and node.
DiscreteNodeLabelLayoutModel
Public Methods
 MethodDefined By
  
DiscreteNodeLabelLayoutModel(init:Boolean = true)
Returns a new instance of DiscreteNodeLabelModel.
DiscreteNodeLabelLayoutModel
  
createModelParameter(labelBounds:YOrientedRectangle, nodeLayout:NodeLayout):Object
DiscreteNodeLabelLayoutModel
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
DiscreteNodeLabelLayoutModel
  
Returns a list of candidate positions for the given node label.
DiscreteNodeLabelLayoutModel
  
getLabelPlacement(labelSize:YDimension, nodeLayout:NodeLayout, param:Object):YOrientedRectangle
Returns the the oriented label position and bounds encoded by the given model parameter.
DiscreteNodeLabelLayoutModel
 Inherited
hashCode():int
YObject
  
isParameterValid(parameter:Object):Boolean
Checks if the given model parameter encodes a node label position that is valid in this model.
DiscreteNodeLabelLayoutModel
  
[static] Returns a new instance of DiscreteNodeLabelModel.
DiscreteNodeLabelLayoutModel
  
[static] Returns a new instance of DiscreteNodeLabelModel.
DiscreteNodeLabelLayoutModel
  
[static] Returns a new instance of DiscreteNodeLabelModel.
DiscreteNodeLabelLayoutModel
Protected Methods
 MethodDefined By
  
Returns the oriented label position and bounds for a node label of the specified size.
DiscreteNodeLabelLayoutModel
  
Initializes this object.
DiscreteNodeLabelLayoutModel
  
initDiscreteNodeLabelLayoutModel2(candidateMask:int):void
Initializes this object.
DiscreteNodeLabelLayoutModel
  
initDiscreteNodeLabelLayoutModel3(candidateMask:int, inset:Number):void
Initializes this object.
DiscreteNodeLabelLayoutModel
Public Constants
 ConstantDefined By
  BOTTOM : int = 0x00200
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  BOTTOM_LEFT : int = 0x08000
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  BOTTOM_RIGHT : int = 0x10000
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  CENTER : int = 0x00100
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  CORNER_MASK : int
[static] Position mask that constrains the positions to NORTH_EAST, NORTH_WEST, SOUTH_EAST, and SOUTH_WEST.
DiscreteNodeLabelLayoutModel
  EAST : int = 0x00008
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  EIGHT_POS_MASK : int
[static] Position mask that allows only the eight node-external positions.
DiscreteNodeLabelLayoutModel
  INTERNAL_MASK : int
[static] Position mask that allows only the nine node-internal positions.
DiscreteNodeLabelLayoutModel
  LEFT : int = 0x00800
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  NORTH : int = 0x00001
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  NORTH_EAST : int = 0x00004
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  NORTH_WEST : int = 0x00002
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  RIGHT : int = 0x01000
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  SANDWICH_MASK : int
[static] Position mask that constrains the positions to NORTH and SOUTH.
DiscreteNodeLabelLayoutModel
  SIDES_MASK : int
[static] Position mask that constrains the positions to EAST, WEST, NORTH, and SOUTH.
DiscreteNodeLabelLayoutModel
  SOUTH : int = 0x00020
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  SOUTH_EAST : int = 0x00080
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  SOUTH_WEST : int = 0x00040
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  TOP : int = 0x00400
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  TOP_LEFT : int = 0x02000
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  TOP_RIGHT : int = 0x04000
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
  WEST : int = 0x00010
[static] Symbolic position specifier.
DiscreteNodeLabelLayoutModel
Property Detail
candidateMaskproperty
candidateMask:int  [read-only]

Allowed candidate positions, default is all positions.


Implementation
    public function get candidateMask():int
defaultParameterproperty 
defaultParameter:Object  [read-only]

Returns a model parameter that encodes the default position of this model's allowed node 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

Getter: Returns the distance between the bounding boxes of label and node.

Setter: Sets the distance between the bounding boxes of label and node in the manner of an insets. It is applied to all label positions, except the CENTER position.


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

See also

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

Returns a new instance of DiscreteNodeLabelModel. INTERNAL_MASK is used to define the allowed positions for the node label. The distance between label and node is set to 4.0 [pixel].

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, nodeLayout:NodeLayout):Object

Parameters

labelBounds:YOrientedRectangle
 
nodeLayout:NodeLayout

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

Returns
Class
getLabelCandidates()method 
public function getLabelCandidates(nl:NodeLabelLayout, nodeLayout:NodeLayout):YList

Returns a list of candidate positions for the given node label.

Parameters

nl:NodeLabelLayout
 
nodeLayout:NodeLayout

Returns
YList
getLabelPlacement()method 
public function getLabelPlacement(labelSize:YDimension, nodeLayout:NodeLayout, param:Object):YOrientedRectangle

Returns the the oriented label position and bounds encoded by the given model parameter.

Parameters

labelSize:YDimension — The size of the label.
 
nodeLayout:NodeLayout — The geometric description of the label's node.
 
param:Object — A model parameter that encodes a label position that is valid in this model.

Returns
YOrientedRectangle
getLabelPlacementForParameter()method 
protected function getLabelPlacementForParameter(labelSize:YDimension, nodeLayout:NodeLayout, pos:int):YOrientedRectangle

Returns the oriented label position and bounds for a node label of the specified size.

Parameters

labelSize:YDimension — The size of the label.
 
nodeLayout:NodeLayout — The geometric description of the label's node.
 
pos:int — A label position that is valid in this model.

Returns
YOrientedRectangle — the oriented label position and bounds.
initDiscreteNodeLabelLayoutModel1()method 
protected final function initDiscreteNodeLabelLayoutModel1():void

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

See also

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

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

Parameters

candidateMask:int

See also

initDiscreteNodeLabelLayoutModel3()method 
protected final function initDiscreteNodeLabelLayoutModel3(candidateMask:int, inset:Number):void

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

Parameters

candidateMask:int
 
inset:Number

See also

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

Checks if the given model parameter encodes a node 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.
newDiscreteNodeLabelLayoutModel1()method 
public static function newDiscreteNodeLabelLayoutModel1():DiscreteNodeLabelLayoutModel

Returns a new instance of DiscreteNodeLabelModel. INTERNAL_MASK is used to define the allowed positions for the node label. The distance between label and node is set to 4.0 [pixel].

Returns
DiscreteNodeLabelLayoutModel

See also

newDiscreteNodeLabelLayoutModel2()method 
public static function newDiscreteNodeLabelLayoutModel2(candidateMask:int):DiscreteNodeLabelLayoutModel

Returns a new instance of DiscreteNodeLabelModel. The given position mask is used to define the allowed positions for the node label. The distance between label and node is set to 4.0 [pixel].

Parameters

candidateMask:int — Defines the allowed positions for the node label.

Returns
DiscreteNodeLabelLayoutModel

See also

newDiscreteNodeLabelLayoutModel3()method 
public static function newDiscreteNodeLabelLayoutModel3(candidateMask:int, inset:Number):DiscreteNodeLabelLayoutModel

Returns a new instance of DiscreteNodeLabelModel.

Parameters

candidateMask:int — Defines the allowed positions for the node label.
 
inset:Number — The distance between label and node.

Returns
DiscreteNodeLabelLayoutModel

See also

Constant Detail
BOTTOMConstant
public static const BOTTOM:int = 0x00200

Symbolic position specifier. Places the label at the bottom inside of the node.

BOTTOM_LEFTConstant 
public static const BOTTOM_LEFT:int = 0x08000

Symbolic position specifier. Places the label at the bottom-left inside of the node.

BOTTOM_RIGHTConstant 
public static const BOTTOM_RIGHT:int = 0x10000

Symbolic position specifier. Places the label at the bottom-right inside of the node.

CENTERConstant 
public static const CENTER:int = 0x00100

Symbolic position specifier. Places the label in the center of the node.

CORNER_MASKConstant 
public static const CORNER_MASK:int

Position mask that constrains the positions to NORTH_EAST, NORTH_WEST, SOUTH_EAST, and SOUTH_WEST.

See also

EASTConstant 
public static const EAST:int = 0x00008

Symbolic position specifier. Places the label east of the node.

EIGHT_POS_MASKConstant 
public static const EIGHT_POS_MASK:int

Position mask that allows only the eight node-external positions.

INTERNAL_MASKConstant 
public static const INTERNAL_MASK:int

Position mask that allows only the nine node-internal positions.

LEFTConstant 
public static const LEFT:int = 0x00800

Symbolic position specifier. Places the label at the left inside of the node.

NORTHConstant 
public static const NORTH:int = 0x00001

Symbolic position specifier. Places the label north of the node.

NORTH_EASTConstant 
public static const NORTH_EAST:int = 0x00004

Symbolic position specifier. Places the label north-east of the node.

NORTH_WESTConstant 
public static const NORTH_WEST:int = 0x00002

Symbolic position specifier. Places the label north-west of the node.

RIGHTConstant 
public static const RIGHT:int = 0x01000

Symbolic position specifier. Places the label at the right inside of the node.

SANDWICH_MASKConstant 
public static const SANDWICH_MASK:int

Position mask that constrains the positions to NORTH and SOUTH.

See also

SIDES_MASKConstant 
public static const SIDES_MASK:int

Position mask that constrains the positions to EAST, WEST, NORTH, and SOUTH.

See also

SOUTHConstant 
public static const SOUTH:int = 0x00020

Symbolic position specifier. Places the label south of the node.

SOUTH_EASTConstant 
public static const SOUTH_EAST:int = 0x00080

Symbolic position specifier. Places the label south-east of the node.

SOUTH_WESTConstant 
public static const SOUTH_WEST:int = 0x00040

Symbolic position specifier. Places the label south-west of the node.

TOPConstant 
public static const TOP:int = 0x00400

Symbolic position specifier. Places the label at the top inside of the node.

TOP_LEFTConstant 
public static const TOP_LEFT:int = 0x02000

Symbolic position specifier. Places the label at the top-left inside of the node.

TOP_RIGHTConstant 
public static const TOP_RIGHT:int = 0x04000

Symbolic position specifier. Places the label at the top-right inside of the node.

WESTConstant 
public static const WEST:int = 0x00010

Symbolic position specifier. Places the label west of the node.