Package | com.yworks.yfiles.layout |
Class | public class LabelLayoutTranslator |
Inheritance | LabelLayoutTranslator YObject Object |
Implements | LayoutStage |
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
Property | Defined 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 |
Method | Defined 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 | ||
equals(o:Object):Boolean | YObject | ||
getClass():Class [override] | LabelLayoutTranslator | ||
hashCode():int | YObject | ||
[static]
Creates a new instance of LabelLayoutTranslator. | LabelLayoutTranslator |
Method | Defined By | ||
---|---|---|---|
initLabelLayoutTranslator():void
Initializes this object. | LabelLayoutTranslator |
autoFlippingEnabled | property |
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
.
public function get autoFlippingEnabled():Boolean
public function set autoFlippingEnabled(value:Boolean):void
See also
coreLayouter | property |
coreLayouter:Layouter
public function get coreLayouter():Layouter
public function set coreLayouter(value:Layouter):void
resettingEdgeLabelOrientation | property |
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.
public function get resettingEdgeLabelOrientation():Boolean
public function set resettingEdgeLabelOrientation(value:Boolean):void
resettingNodeLabelOrientation | property |
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.
public function get resettingNodeLabelOrientation():Boolean
public function set resettingNodeLabelOrientation(value:Boolean):void
translateEdgeLabels | property |
translateEdgeLabels:Boolean
Getter:
Returns whether edge label translation is enabled.
Defaults to true
.
public function get translateEdgeLabels():Boolean
public function set translateEdgeLabels(value:Boolean):void
translateNodeLabels | property |
translateNodeLabels:Boolean
Getter:
Returns whether node label translation is enabled.
Defaults to false
.
public function get translateNodeLabels():Boolean
public function set translateNodeLabels(value:Boolean):void
writeBackEdgeLabels | property |
writeBackEdgeLabels:Boolean
Getter:
Returns whether edge labels are written back to their model.
Defaults to true
.
public function get writeBackEdgeLabels():Boolean
public function set writeBackEdgeLabels(value:Boolean):void
writeBackNodeLabels | property |
writeBackNodeLabels:Boolean
Getter:
Returns whether node labels are written back to their model.
Defaults to false
.
public function get writeBackNodeLabels():Boolean
public function set writeBackNodeLabels(value:Boolean):void
writeBackRelativeEdgeLabelLocation | property |
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
.
public function get writeBackRelativeEdgeLabelLocation():Boolean
public function set writeBackRelativeEdgeLabelLocation(value:Boolean):void
See also
writeBackRelativeNodeLabelLocation | property |
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
.
public function get writeBackRelativeNodeLabelLocation():Boolean
public function set writeBackRelativeNodeLabelLocation(value:Boolean):void
See also
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.
Parametersinit: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.
|
canLayout | () | method |
public function canLayout(graph:LayoutGraph):Boolean
The returned result gets calculated by the core layouter.
Parameters
graph:LayoutGraph |
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
ReturnsClass |
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.
ReturnsLabelLayoutTranslator |