Packagecom.yworks.yfiles.layout
Classpublic class LabelLayoutTranslator
InheritanceLabelLayoutTranslator Inheritance YObject Inheritance Object
Implements LayoutStage

Layout stage that automatically translates label layout information provided by the standard label layout classes com.yworks.yfiles.layout.EdgeLabelLayout and com.yworks.yfiles.layout.NodeLabelLayout to layout data of type com.yworks.yfiles.layout.LabelLayoutData that is accessible by the keys defined in class com.yworks.yfiles.layout.LabelLayoutKeys.

One can use this layout stage as label layouter of a label aware layouter like HierarchicLayouter (com.yworks.yfiles.layout.hierarchic.HierarchicLayouter) . This can be done by assigning the stage by an appropriate call to setLabelLayouter (com.yworks.yfiles.layout.CanonicMultiStageLayouter.labelLayouter).

When writing the com.yworks.yfiles.layout.LabelLayoutData, the bounds (com.yworks.yfiles.layout.LabelLayoutData.bounds) are set relative. In case of a node label the bounds' anchor (com.yworks.yfiles.geom.YOrientedRectangle.anchor) is relative to the center of the owning node. In case of an edge label the bounds' anchor is relative to the center of the source node of the owning edge.

If writing back node labels (writeBackNodeLabels) and/or writing back edge labels (writeBackEdgeLabels) is enabled, the com.yworks.yfiles.layout.LabelLayoutData is written back to the com.yworks.yfiles.layout.NodeLabelLayout s and/or com.yworks.yfiles.layout.EdgeLabelLayout s.

Per default the bounds (com.yworks.yfiles.layout.LabelLayoutData.bounds) are now interpreted absolute but by activating writeBackRelativeNodeLabelLocation and/or writeBackRelativeEdgeLabelLocation this can be changed to interpret them relative as explained above.

Note that care must be taken on the choice of label model that is used by the classes com.yworks.yfiles.layout.EdgeLabelLayout and com.yworks.yfiles.layout.NodeLabelLayout . The calculated label positions must be consistent with the label positions allowed by the label model. The best label layout results are achieved by choosing com.yworks.yfiles.layout.FreeEdgeLabelLayoutModel for edge layouts and com.yworks.yfiles.layout.FreeNodeLabelLayoutModel for node layouts.

See also

com.yworks.yfiles.layout.EdgeLabelLayout
com.yworks.yfiles.layout.NodeLabelLayout
com.yworks.yfiles.layout.LabelLayoutData
com.yworks.yfiles.layout.LabelLayoutKeys
HierarchicLayouter
setLabelLayouter
bounds
anchor
writing back node labels
writing back edge labels
writeBackRelativeNodeLabelLocation
writeBackRelativeEdgeLabelLocation
com.yworks.yfiles.layout.FreeEdgeLabelLayoutModel
com.yworks.yfiles.layout.FreeNodeLabelLayoutModel


Public Properties
 PropertyDefined By
  autoFlippingEnabled : Boolean
Specifies whether or not this stage should automatically flip edge label content depending on the label's rotation angle.
LabelLayoutTranslator
  coreLayouter : Layouter
LabelLayoutTranslator
  resettingEdgeLabelOrientation : Boolean
Whether or not to reset the orientation of edge labels.
LabelLayoutTranslator
  resettingNodeLabelOrientation : Boolean
Whether or not to reset the orientation of node labels.
LabelLayoutTranslator
  translateEdgeLabels : Boolean
Getter: Returns whether edge label translation is enabled.
LabelLayoutTranslator
  translateNodeLabels : Boolean
Getter: Returns whether node label translation is enabled.
LabelLayoutTranslator
  writeBackEdgeLabels : Boolean
Getter: Returns whether edge labels are written back to their model.
LabelLayoutTranslator
  writeBackNodeLabels : Boolean
Getter: Returns whether node labels are written back to their model.
LabelLayoutTranslator
  writeBackRelativeEdgeLabelLocation : Boolean
Specifies whether edge label bounds (com.yworks.yfiles.layout.LabelLayoutData.bounds) are interpreted relative when writing them back to the model.
LabelLayoutTranslator
  writeBackRelativeNodeLabelLocation : Boolean
Specifies whether node label bounds (com.yworks.yfiles.layout.LabelLayoutData.bounds) are interpreted relative when writing them back to the model.
LabelLayoutTranslator
Public Methods
 MethodDefined By
  
LabelLayoutTranslator(init:Boolean = true)
Creates a new instance of LabelLayoutTranslator.
LabelLayoutTranslator
  
canLayout(graph:LayoutGraph):Boolean
The returned result gets calculated by the core layouter.
LabelLayoutTranslator
  
doLayout(graph:LayoutGraph):void
Before invoking the core layouter this stage translates traditional label layout information to data provider based label layout data.
LabelLayoutTranslator
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
LabelLayoutTranslator
 Inherited
hashCode():int
YObject
  
[static] Creates a new instance of LabelLayoutTranslator.
LabelLayoutTranslator
Protected Methods
 MethodDefined By
  
Initializes this object.
LabelLayoutTranslator
Property Detail
autoFlippingEnabledproperty
autoFlippingEnabled:Boolean

Specifies whether or not this stage should automatically flip edge label content depending on the label's rotation angle.

More precisely, if this option is enabled and the up vector of the com.yworks.yfiles.geom.YOrientedRectangle associated with an com.yworks.yfiles.layout.EdgeLabelLayout (see method com.yworks.yfiles.layout.EdgeLabelLayout.orientedBox) points downward ( upY (com.yworks.yfiles.geom.YOrientedRectangle.upY) > 0), this stage automatically flips the label, i.e., it rotates the label by 180 degree without changing the label's center.

By default, this property is set to true.


Implementation
    public function get autoFlippingEnabled():Boolean
    public function set autoFlippingEnabled(value:Boolean):void

See also

coreLayouterproperty 
coreLayouter:Layouter


Implementation
    public function get coreLayouter():Layouter
    public function set coreLayouter(value:Layouter):void
resettingEdgeLabelOrientationproperty 
resettingEdgeLabelOrientation:Boolean

Whether or not to reset the orientation of edge labels. If this option is enabled, the up vector of the corresponding oriented box is set to (0,-1). Default value is true.


Implementation
    public function get resettingEdgeLabelOrientation():Boolean
    public function set resettingEdgeLabelOrientation(value:Boolean):void
resettingNodeLabelOrientationproperty 
resettingNodeLabelOrientation:Boolean

Whether or not to reset the orientation of node labels. If this option is enabled, the up vector of the corresponding oriented box is set to (0,-1). Default value is false.


Implementation
    public function get resettingNodeLabelOrientation():Boolean
    public function set resettingNodeLabelOrientation(value:Boolean):void
translateEdgeLabelsproperty 
translateEdgeLabels:Boolean

Getter: Returns whether edge label translation is enabled. Defaults to true.

Setter: Determines whether edge label translation should be enabled.


Implementation
    public function get translateEdgeLabels():Boolean
    public function set translateEdgeLabels(value:Boolean):void
translateNodeLabelsproperty 
translateNodeLabels:Boolean

Getter: Returns whether node label translation is enabled. Defaults to false.

Setter: Determines whether node label translation should be enabled.


Implementation
    public function get translateNodeLabels():Boolean
    public function set translateNodeLabels(value:Boolean):void
writeBackEdgeLabelsproperty 
writeBackEdgeLabels:Boolean

Getter: Returns whether edge labels are written back to their model. Defaults to true.

Setter: Determines whether edge label information is written back to the model.


Implementation
    public function get writeBackEdgeLabels():Boolean
    public function set writeBackEdgeLabels(value:Boolean):void
writeBackNodeLabelsproperty 
writeBackNodeLabels:Boolean

Getter: Returns whether node labels are written back to their model. Defaults to false.

Setter: Determines whether node label information is written back to the model.


Implementation
    public function get writeBackNodeLabels():Boolean
    public function set writeBackNodeLabels(value:Boolean):void
writeBackRelativeEdgeLabelLocationproperty 
writeBackRelativeEdgeLabelLocation:Boolean

Specifies whether edge label bounds (com.yworks.yfiles.layout.LabelLayoutData.bounds) are interpreted relative when writing them back to the model.

This option is only considered if writeBackEdgeLabels is set to true.

Default is false.


Implementation
    public function get writeBackRelativeEdgeLabelLocation():Boolean
    public function set writeBackRelativeEdgeLabelLocation(value:Boolean):void

See also

writeBackRelativeNodeLabelLocationproperty 
writeBackRelativeNodeLabelLocation:Boolean

Specifies whether node label bounds (com.yworks.yfiles.layout.LabelLayoutData.bounds) are interpreted relative when writing them back to the model.

This option is only considered if writeBackNodeLabels is set to true.

Default is false.


Implementation
    public function get writeBackRelativeNodeLabelLocation():Boolean
    public function set writeBackRelativeNodeLabelLocation(value:Boolean):void

See also

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

Creates a new instance of LabelLayoutTranslator. Initially no core layouter will be bound to this layout stage.

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
public function canLayout(graph:LayoutGraph):Boolean

The returned result gets calculated by the core layouter.

Parameters

graph:LayoutGraph

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

Before invoking the core layouter this stage translates traditional label layout information to data provider based label layout data. Afterwards the calculated layout data will be written back to the original label layout.

Parameters

graph:LayoutGraph

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

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

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

See also

newLabelLayoutTranslator()method 
public static function newLabelLayoutTranslator():LabelLayoutTranslator

Creates a new instance of LabelLayoutTranslator. Initially no core layouter will be bound to this layout stage.

Returns
LabelLayoutTranslator