|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.AbstractLayoutStage y.layout.labeling.AbstractLabelingAlgorithm
public abstract class AbstractLabelingAlgorithm
This class is an abstract base class for labeling algorithms. A labeling algorithm places a set of labels.
Field Summary | |
---|---|
protected static double |
EPS
|
static Object |
LABEL_MODEL_DPKEY
DataProvider key to specify for each EdgeLabelLayout s and each
NodeLabelLayout a replacement EdgeLabelModel or NodeLabelModel ,
respectively, that is used by the labeling algorithm instead of the original label model. |
protected boolean |
setCustomizedProfitModel
|
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
protected |
AbstractLabelingAlgorithm()
Creates a new instance of this class. |
Method Summary | |
---|---|
boolean |
canLayout(LayoutGraph graph)
Returns true . |
protected void |
checkGroupNodeSize(GraphLayout layout,
Object node)
This method throws an IllegalArgumentException if the width/height of the given group node object is zero. |
protected void |
checkNodeSize(GraphLayout layout,
Object node)
This method throws an IllegalArgumentException if the width/height of the given node object is zero. |
void |
doLayout(LayoutGraph graph)
Place the labels in the graph. |
boolean |
getPlaceEdgeLabels()
Returns whether labels assigned to edges in a graph should be placed or ignored. |
boolean |
getPlaceNodeLabels()
Returns whether labels assigned to nodes in a graph should be placed or ignored. |
double |
getProfit(LabelCandidate l)
Returns the profit model that is used to rank the available positions for each label. |
ProfitModel |
getProfitModel()
|
YList |
getRects()
Returns the set of all generated candidate rectangles. |
boolean |
getRemoveEdgeOverlaps()
Returns how label candidates which overlap with edges are handled. |
boolean |
getRemoveNodeOverlaps()
Returns how label candidates which overlap with nodes are handled. |
Object |
getSelectionKey()
Returns the labeling selection DataProvider key. |
boolean |
isApplyPostprocessing()
Returns true if the postprocessing step is applied. |
boolean |
isAutoFlippingEnabled()
Determines whether or not edge labels associated with a "free" label model (see, e.g., SmartEdgeLabelModel ) should be automatically flipped
if they would be upside-down. |
boolean |
isEdgeGroupOverlapAllowed()
Returns whether edge labels may overlap with edges belonging to the same edge group. |
boolean |
isMoveInternalNodeLabels()
Returns true if the labeling algorithm is allowed to move internal node labels. |
boolean |
isStoreRects()
Returns whether the candidate rectangles should be stored to be retrieved. |
boolean |
isUseAlternativeSideHandling()
Deprecated. use PreferredPlacementDescriptor.getSideReference() instead |
void |
label(LayoutGraph gl)
Place the labels in the graph. |
void |
label(LayoutGraph gl,
Object key)
Place a subset of the labels. |
void |
label(LayoutGraph gl,
YList nodeLabels,
YList edgeLabels)
Place some labels in the graph. |
void |
setApplyPostprocessing(boolean applyPostprocessing)
Sets if the postprocessing step should be applied. |
void |
setAutoFlippingEnabled(boolean enabled)
Specifies whether or not edge labels associated with a "free" label model (see, e.g., SmartEdgeLabelModel ) should be automatically flipped
if they would be upside-down. |
void |
setEdgeGroupOverlapAllowed(boolean edgeGroupOverlapAllowed)
Sets the policy for edge groups. |
void |
setMoveInternalNodeLabels(boolean moveInternalNodeLabels)
Sets if the labeling algorithm is allowed to move internal node labels. |
void |
setPlaceEdgeLabels(boolean enable)
Specifies whether labels assigned to edges in a graph should be placed or ignored. |
void |
setPlaceNodeLabels(boolean enable)
Specifies whether labels assigned to nodes in a graph should be placed or ignored. |
void |
setProfitModel(ProfitModel model)
Sets the profit model that is used to rank the available positions for each label. |
void |
setRemoveEdgeOverlaps(boolean flag)
Specifies how label candidates which overlap with edges are handled. |
void |
setRemoveNodeOverlaps(boolean flag)
Specifies how label candidates which overlap with nodes are handled. |
void |
setSelection(Object key)
Sets the DataProvider key, under which the labeling selection
can be retrieved. |
void |
setStoreRects(boolean s)
Sets whether the candidate rectangles should be stored to be retrieved. |
void |
setUseAlternativeSideHandling(boolean useAlternativeSideHandling)
Deprecated. use PreferredPlacementDescriptor.setSideReference(byte) with PreferredPlacementDescriptor.SIDE_IS_ABSOLUTE_WITH_LEFT_IN_NORTH or PreferredPlacementDescriptor.SIDE_IS_ABSOLUTE_WITH_RIGHT_IN_NORTH as argument instead |
Methods inherited from class y.layout.AbstractLayoutStage |
---|
canLayoutCore, doLayoutCore, getCoreLayouter, setCoreLayouter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Object LABEL_MODEL_DPKEY
DataProvider
key to specify for each EdgeLabelLayout
s and each
NodeLabelLayout
a replacement EdgeLabelModel
or NodeLabelModel
,
respectively, that is used by the labeling algorithm instead of the original label model. If this key is not
defined or if a label has no mapping, the original model is used as normal. Otherwise, a model parameter that
fits the calculated position of the replacement model best is set for the original model.
This feature is especially useful to restrict a free model. For example, to place a label upon its associated edge,
a centered RotatedSliderEdgeLabelModel
can be used a replacement model.
protected boolean setCustomizedProfitModel
protected static final double EPS
Constructor Detail |
---|
protected AbstractLabelingAlgorithm()
Method Detail |
---|
public ProfitModel getProfitModel()
public boolean isMoveInternalNodeLabels()
public void setMoveInternalNodeLabels(boolean moveInternalNodeLabels)
public boolean isApplyPostprocessing()
public void setApplyPostprocessing(boolean applyPostprocessing)
FreeEdgeLabelModel
and node labels whose node label model is FreeNodeLabelModel
.
public boolean isUseAlternativeSideHandling()
PreferredPlacementDescriptor.getSideReference()
instead
true
if the preference on which side of an edge a corresponding label should be placed is
interpreted by human perception instead of always following the edge from source to target.
public void setUseAlternativeSideHandling(boolean useAlternativeSideHandling)
PreferredPlacementDescriptor.setSideReference(byte)
with PreferredPlacementDescriptor.SIDE_IS_ABSOLUTE_WITH_LEFT_IN_NORTH
or PreferredPlacementDescriptor.SIDE_IS_ABSOLUTE_WITH_RIGHT_IN_NORTH
as argument instead
Note: the alternative side handling is only applied to edge labels whose edge label model is
FreeEdgeLabelModel
.
useAlternativeSideHandling
- if true
, the preferred side for an edge label is interpreted
according to human perception.public void setRemoveNodeOverlaps(boolean flag)
true
these candidates are not
considered, if false
these candidates are considered, but a penalty is assigned to them.
public void setRemoveEdgeOverlaps(boolean flag)
true
these candidates are not
considered, if false
these candidates are considered, but a penalty is assigned to them.
public boolean getRemoveNodeOverlaps()
true
these candidates are not
considered, if false
these candidates are considered, but a penalty is assigned to them.
public boolean getRemoveEdgeOverlaps()
true
these candidates are not
considered, if false
these candidates are considered, but a penalty is assigned to them.
public void setPlaceNodeLabels(boolean enable)
false
.
enable
- whether labels assigned to nodes should be placed or ignored.getPlaceNodeLabels()
,
setSelection(Object)
public void setPlaceEdgeLabels(boolean enable)
false
.
enable
- whether labels assigned to edges should be placed or ignored.getPlaceEdgeLabels()
,
setSelection(Object)
public boolean getPlaceNodeLabels()
true
if and only if node labels are placed by this algorithm.setPlaceNodeLabels(boolean)
public boolean getPlaceEdgeLabels()
true
if and only if edge labels are placed by this algorithm.setPlaceEdgeLabels(boolean)
public void setSelection(Object key)
DataProvider
key, under which the labeling selection
can be retrieved.
The data provider registered with this key has to return true
for labels that should be placed and false
for all other
labels.
key
- The key for a DataProvider
.getSelectionKey()
public Object getSelectionKey()
DataProvider
key.
setSelection(Object)
public boolean isAutoFlippingEnabled()
SmartEdgeLabelModel
) should be automatically flipped
if they would be upside-down.
By default, this property is set to false
.
true
if edge labels should be automatically flipped and false
otherwise.public void setAutoFlippingEnabled(boolean enabled)
SmartEdgeLabelModel
) should be automatically flipped
if they would be upside-down.
By default, this property is set to false
.
enabled
- if true
, edge labels will be automatically flipped.public boolean canLayout(LayoutGraph graph)
true
.
public void doLayout(LayoutGraph graph)
label()
method.
graph
- The graph to label.protected void checkNodeSize(GraphLayout layout, Object node) throws IllegalArgumentException
IllegalArgumentException
if the width/height of the given node object is zero.
It is called by the label-methods for each node object in the input graph.
IllegalArgumentException
- thrown if the width/height of the node object is zero.layout
- a graph layout object.node
- the node object to test.checkGroupNodeSize(GraphLayout,Object)
protected void checkGroupNodeSize(GraphLayout layout, Object node) throws IllegalArgumentException
IllegalArgumentException
if the width/height of the given group node object is zero.
It is called by the label-methods for each group node object in the input graph.
IllegalArgumentException
- thrown if the width/height of the group node object is zero.layout
- a graph layout object.node
- the group node object to test.checkNodeSize(GraphLayout,Object)
public void label(LayoutGraph gl)
gl
- The graph to label.public void label(LayoutGraph gl, Object key)
key
- The key for a DataProvider
in gl
. Labels which should be placed return
true
.public void label(LayoutGraph gl, YList nodeLabels, YList edgeLabels)
public void setProfitModel(ProfitModel model)
LabelRanking
is set.
public double getProfit(LabelCandidate l)
LabelRanking
is set.
public YList getRects()
Debug only.
public void setStoreRects(boolean s)
Debug only.
public boolean isStoreRects()
Debug only.
public boolean isEdgeGroupOverlapAllowed()
public void setEdgeGroupOverlapAllowed(boolean edgeGroupOverlapAllowed)
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |