|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.LabelLayoutTranslator
public class LabelLayoutTranslator
LabelLayoutTranslator automatically translates label layout information provided by the standard
label layout classes EdgeLabelLayout and NodeLabelLayout to layout data
of type LabelLayoutData that is accessible by the keys defined in class LabelLayoutKeys.
LayoutStage as label layout algorithm of a label-aware layout algorithm like
IncrementalHierarchicLayouter. This can be done by assigning the stage by an appropriate
call to setLabelLayouter.
When writing the LabelLayoutData, the boxes are set relative.
In case of a node label, the box's anchor is relative
to the center of the owning node. In case of an edge label the box's anchor is relative to
the center of the source node of the owning edge.
If writing back node labels and/or
writing back edge labels is enabled, the LabelLayoutData
is transferred back to the NodeLabelLayouts and/or EdgeLabelLayouts.
By default, the boxes are now interpreted absolute but by activating
isWriteBackRelativeNodeLabelLocationEnabled() and/or isWriteBackRelativeEdgeLabelLocationEnabled()
this can be changed to interpret them relative as explained above.
EdgeLabelLayout and 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 FreeEdgeLabelModel for edge layouts and
FreeNodeLabelModel for node layouts.
![]() |
![]() |
| Field Summary |
|---|
| Fields inherited from interface y.layout.Layouter |
|---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
| Constructor Summary | |
|---|---|
LabelLayoutTranslator()
Creates a new LabelLayoutTranslator instance with default settings. |
|
| Method Summary | |
|---|---|
boolean |
canLayout(LayoutGraph graph)
Accepts all graphs which the core layout algorithm can handle. |
void |
doLayout(LayoutGraph graph)
Translates traditional LabelLayout information to DataProvider-based LabelLayoutData. |
Layouter |
getCoreLayouter()
Returns the core layout algorithm that is wrapped by this LayoutStage. |
boolean |
isAutoFlippingEnabled()
Returns whether or not this stage should automatically flip edge label content depending on the label's rotation angle. |
boolean |
isResettingEdgeLabelOrientation()
Returns whether or not to reset the orientation of edge labels. |
boolean |
isResettingNodeLabelOrientation()
Returns whether or not to reset the orientation of node labels. |
boolean |
isTranslateEdgeLabelsEnabled()
Returns whether or not edge label information is translated. |
boolean |
isTranslateNodeLabelsEnabled()
Returns whether or not node label information is translated. |
boolean |
isWriteBackEdgeLabelsEnabled()
Returns whether or not edge label information is written back to the model after core layout. |
boolean |
isWriteBackNodeLabelsEnabled()
Returns whether or not node label information is written back to the model after the core layout. |
boolean |
isWriteBackRelativeEdgeLabelLocationEnabled()
Returns whether or not edge label boxes are interpreted relative to the edge
when writing them back to the model. |
boolean |
isWriteBackRelativeNodeLabelLocationEnabled()
Returns whether or not node label bounds are interpreted relative to the node
when writing them back to the model. |
void |
setAutoFlippingEnabled(boolean enabled)
Specifies whether or not this stage should automatically flip edge label content depending on the label's rotation angle. |
void |
setCoreLayouter(Layouter layouter)
Specifies the core layout algorithm that is wrapped by this LayoutStage. |
void |
setResettingEdgeLabelOrientation(boolean resettingEdgeLabelOrientation)
Specifies whether or not to reset the orientation of edge labels. |
void |
setResettingNodeLabelOrientation(boolean resettingNodeLabelOrientation)
Specifies whether or not to reset the orientation of node labels. |
void |
setTranslateEdgeLabelsEnabled(boolean translateEdgeLabelsEnabled)
Specifies whether or not edge label information is translated. |
void |
setTranslateNodeLabelsEnabled(boolean translateNodeLabelsEnabled)
Specifies whether or not node label information is translated. |
void |
setWriteBackEdgeLabelsEnabled(boolean writeBack)
Specifies whether or not edge label information is written back to the model after core layout. |
void |
setWriteBackNodeLabelsEnabled(boolean writeBack)
Specifies whether or not node label information is written back to the model after the core layout. |
void |
setWriteBackRelativeEdgeLabelLocationEnabled(boolean writeBackRelativeEdgeLabelLocationEnabled)
Specifies whether or not edge label boxes are interpreted relative to the edge
when writing them back to the model. |
void |
setWriteBackRelativeNodeLabelLocationEnabled(boolean writeBackRelativeNodeLabelLocationEnabled)
Specifies whether or not node label boxes are interpreted relative to the node
when writing them back to the model. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LabelLayoutTranslator()
LabelLayoutTranslator instance with default settings.
| Method Detail |
|---|
public void setCoreLayouter(Layouter layouter)
LayoutStage.
setCoreLayouter in interface LayoutStagelayouter - the core layout routinepublic Layouter getCoreLayouter()
LayoutStage.
getCoreLayouter in interface LayoutStagesetCoreLayouter(Layouter)public void doLayout(LayoutGraph graph)
LabelLayout information to DataProvider-based LabelLayoutData.
Afterwards, the calculated layout data will be written back to the original label layout.
doLayout in interface Layoutergraph - the input graphLayouter.canLayout(LayoutGraph)public boolean isAutoFlippingEnabled()
More precisely, if this option is enabled and the up vector of the OrientedRectangle associated with an
EdgeLabelLayout points downwards (upY > 0),
this LayoutStage automatically flips the label. It rotates the label by 180 degrees
without changing the label's center.
true if this LayoutStage automatically flips edge label content depending on the
label's rotation angle, false otherwisesetAutoFlippingEnabled(boolean),
LayoutTool.autoFlipBox(OrientedRectangle),
LabelLayout.getOrientedBox()public void setAutoFlippingEnabled(boolean enabled)
More precisely, if this option is enabled and the up vector of the OrientedRectangle associated with an
EdgeLabelLayout points downwards (upY > 0),
this LayoutStage automatically flips the label. It rotates the label by 180 degrees
without changing the label's center.
enabled - true if this LayoutStage should automatically flip edge label content depending on the
label's rotation angle, false otherwiseLayoutTool.autoFlipBox(OrientedRectangle),
LabelLayout.getOrientedBox()![]() false | ![]() true |
public boolean isResettingNodeLabelOrientation()
(0,-1) before adding it to the DataProvider.
LabelLayoutTranslator
should not reset their orientation. When it performs integrated node labeling, this option should be
enabled.true if the orientation of node labels is reset, false otherwisesetResettingNodeLabelOrientation(boolean)public void setResettingNodeLabelOrientation(boolean resettingNodeLabelOrientation)
(0,-1) before adding it to the DataProvider.
LabelLayoutTranslator
should not reset their orientation. When it performs integrated node labeling, this option should be
enabled.resettingNodeLabelOrientation - true if the orientation of node labels should be reset,
false otherwisepublic boolean isResettingEdgeLabelOrientation()
(0,-1) before adding it to the DataProvider.
LabelLayoutTranslator
should not reset their orientation. When it performs integrated edge labeling, this option should be
enabled.true if the orientation of edge labels is reset, false otherwisesetResettingEdgeLabelOrientation(boolean)public void setResettingEdgeLabelOrientation(boolean resettingEdgeLabelOrientation)
(0,-1) before adding it to the DataProvider.
LabelLayoutTranslator
should not reset their orientation. When it performs integrated edge labeling, this option should be
enabled.resettingEdgeLabelOrientation - true if the orientation of edge labels should be reset,
false otherwisepublic boolean canLayout(LayoutGraph graph)
core layout algorithm can handle.
canLayout in interface Layoutergraph - the input graph
true if there is a core layout algorithm which can arrange the graph, false
otherwiseLayouter.doLayout(LayoutGraph)public boolean isWriteBackEdgeLabelsEnabled()
core layout algorithm performs
integrated edge labeling.true if edge label information is written back, false otherwisesetWriteBackEdgeLabelsEnabled(boolean)public void setWriteBackEdgeLabelsEnabled(boolean writeBack)
core layout algorithm performs
integrated edge labeling.writeBack - true if edge label information should be written back, false otherwisepublic boolean isWriteBackRelativeEdgeLabelLocationEnabled()
boxes are interpreted relative to the edge
when writing them back to the model.
setWriteBackEdgeLabelsEnabled(boolean) is enabled.true if the bounds are interpreted relative, false for absolute
interpretationsetWriteBackRelativeEdgeLabelLocationEnabled(boolean)public void setWriteBackRelativeEdgeLabelLocationEnabled(boolean writeBackRelativeEdgeLabelLocationEnabled)
boxes are interpreted relative to the edge
when writing them back to the model.
setWriteBackEdgeLabelsEnabled(boolean) is enabled.writeBackRelativeEdgeLabelLocationEnabled - true if the boxes should be interpreted relative,
false for absolute interpretationpublic boolean isWriteBackNodeLabelsEnabled()
core layout algorithm performs
integrated node labeling.true if node label information is written back, false otherwisesetWriteBackNodeLabelsEnabled(boolean)public void setWriteBackNodeLabelsEnabled(boolean writeBack)
core layout algorithm performs
integrated node labeling.writeBack - true if node label information should be written back, false otherwisepublic boolean isWriteBackRelativeNodeLabelLocationEnabled()
bounds are interpreted relative to the node
when writing them back to the model.
setWriteBackNodeLabelsEnabled(boolean) is enabled.true if the bounds are interpreted relative, false for absolute
interpretationsetWriteBackRelativeNodeLabelLocationEnabled(boolean)public void setWriteBackRelativeNodeLabelLocationEnabled(boolean writeBackRelativeNodeLabelLocationEnabled)
boxes are interpreted relative to the node
when writing them back to the model.
setWriteBackNodeLabelsEnabled(boolean) is enabled.writeBackRelativeNodeLabelLocationEnabled - true if the boxes should be interpreted relative,
false for absolute interpretationpublic boolean isTranslateNodeLabelsEnabled()
true if node label information is translated,
false otherwisesetTranslateNodeLabelsEnabled(boolean)public void setTranslateNodeLabelsEnabled(boolean translateNodeLabelsEnabled)
translateNodeLabelsEnabled - true if node label information should be translated,
false otherwisepublic boolean isTranslateEdgeLabelsEnabled()
true if edge label information is translated,
false otherwisesetTranslateEdgeLabelsEnabled(boolean)public void setTranslateEdgeLabelsEnabled(boolean translateEdgeLabelsEnabled)
translateEdgeLabelsEnabled - true if edge label information should be translated,
false otherwise
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||