|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.CanonicMultiStageLayouter y.layout.orthogonal.DirectedOrthogonalLayouter
public class DirectedOrthogonalLayouter
This class is a variant of OrthogonalLayouter
that can route edges in a way that
they point to a main layout direction. Also, this class can route edges that connect to the same
node in a shared bus-structure. A typical use case for this layout algorithm are UML class diagrams
that contain some relationships like generalization or realization which are best expressed by
upward-pointing edges.
DIRECTED_EDGE_DPKEY
to the input graph. Edge groups at a common node can be specified
by registering data providers with the keys PortConstraintKeys.SOURCE_GROUPID_KEY
and PortConstraintKeys.TARGET_GROUPID_KEY
.
Like OrthogonalLayouter
this layout algorithm can consider edge label data when
laying out a graph. That means that the layout of edge labels will be part of the resulting
layout and the layout of nodes and edges is chosen in such a way that the
edge labels do not conflict with the rest of the layout.
See classes LabelLayoutData
, LabelLayoutConstants
LabelLayoutKeys
and LabelLayoutTranslator
on how
to setup the integrated edge label layout feature.
Here is an sample output of the layout algorithm. Note that all edges painted in blue
are marked as directed edges. Also, the directed edges at each node have been put into the
same edge group.
Field Summary | |
---|---|
static Object |
DIRECTED_EDGE_DPKEY
DataProvider key that is used to mark edges that should be routed in a way that point in the main layout direction. |
static Object |
EDGE_LAYOUT_DESCRIPTOR_DPKEY
DataProvider key used to retrieve EdgeLayoutDescriptor
instances for each edge in the graph. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
DirectedOrthogonalLayouter()
Creates a new instance of this class. |
Method Summary | |
---|---|
protected boolean |
canLayoutCore(LayoutGraph graph)
Subclasses have to provide information whether or not they can layout the given graph. |
protected EdgeLayoutDescriptor |
createEdgeLayoutDescriptor()
Factory method that creates the default EdgeLayoutDescriptor. |
void |
doLayout(LayoutGraph graph)
Calculates a layout for the given graph. |
protected void |
doLayoutCore(LayoutGraph graph)
Subclasses have to provide core layout code in this method. |
EdgeLayoutDescriptor |
getEdgeLayoutDescriptor()
Returns the EdgeLayoutDescriptor instance used for all those
edges, that do not have a specific layout descriptor assigned. |
int |
getGrid()
Returns the currently set grid spacing. |
boolean |
getUseSketchDrawing()
Returns if the existing drawing should be used as sketch. |
boolean |
isConsiderNodeLabelsEnabled()
Returns whether or not node labels are taken into account when calculating node positions (thereby preventing possible node/node label or node label/node label overlaps). |
boolean |
isIntegratedEdgeLabelingEnabled()
Returns whether integrated edge labeling is enabled. |
boolean |
isUsePostprocessing()
Returns if an additional postprocessing step is used that improves compactness and reduces the number of edge bends. |
void |
setConsiderNodeLabelsEnabled(boolean enabled)
Specifies whether or not to consider node labels when calculating node positions (thereby preventing possible node/node label or node label/node label overlaps). |
void |
setEdgeLayoutDescriptor(EdgeLayoutDescriptor edgeLayoutDescriptor)
Sets the EdgeLayoutDescriptor instance used for all those
edges, that do not have a specific layout descriptor assigned. |
void |
setGrid(int grid)
Sets the grid spacing to be used. |
void |
setIntegratedEdgeLabelingEnabled(boolean enabled)
Specifies whether or not to use integrated edge labeling. |
void |
setUsePostprocessing(boolean usePostprocessing)
Sets if an additional postprocessing step is used that improves compactness and reduces the number of edge bends. |
void |
setUseSketchDrawing(boolean value)
Sets if the existing drawing should be used as sketch. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Object EDGE_LAYOUT_DESCRIPTOR_DPKEY
DataProvider
key used to retrieve EdgeLayoutDescriptor
instances for each edge in the graph. Different settings will affect the routing of the edges during the layout.
public static final Object DIRECTED_EDGE_DPKEY
CanonicMultiStageLayouter.setLayoutOrientation(byte)
.
Constructor Detail |
---|
public DirectedOrthogonalLayouter()
Method Detail |
---|
protected EdgeLayoutDescriptor createEdgeLayoutDescriptor()
null
!
new EdgeLayoutDescriptor()
)public EdgeLayoutDescriptor getEdgeLayoutDescriptor()
EdgeLayoutDescriptor
instance used for all those
edges, that do not have a specific layout descriptor assigned.
OrthogonalLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY
,
createEdgeLayoutDescriptor()
public void setEdgeLayoutDescriptor(EdgeLayoutDescriptor edgeLayoutDescriptor)
EdgeLayoutDescriptor
instance used for all those
edges, that do not have a specific layout descriptor assigned.
NullPointerException
- if the argument is null
edgeLayoutDescriptor
- the new descriptorOrthogonalLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY
public void setConsiderNodeLabelsEnabled(boolean enabled)
label layouter
is of type LabelLayoutTranslator
and LabelLayoutTranslator.setTranslateNodeLabelsEnabled(boolean)
is set to
true
.
Note that setting this option may overwrite the currently set label layouter. Hence, to combine this option with
a generic edge labeling algorithm, the generic labeling has to be applied in an additional step after calculating the layout.
enabled
- whether to enable this featurepublic boolean isConsiderNodeLabelsEnabled()
label layouter
is of type LabelLayoutTranslator
and LabelLayoutTranslator.isTranslateNodeLabelsEnabled()
returns true
.
false
.
IllegalStateException
- if the current label layouter is not of type LabelLayoutTranslator
.
public void setIntegratedEdgeLabelingEnabled(boolean enabled)
label layouter
is of type LabelLayoutTranslator
and LabelLayoutTranslator.setTranslateEdgeLabelsEnabled(boolean)
is set to
true
enabled
- whether to enable this featurepublic boolean isIntegratedEdgeLabelingEnabled()
label layouter
is of type LabelLayoutTranslator
and
LabelLayoutTranslator.isTranslateEdgeLabelsEnabled()
returns true
. false
.
IllegalStateException
- if the current label layouter is not of type LabelLayoutTranslator
.
public int getGrid()
public void setGrid(int grid)
20
is set.
public boolean getUseSketchDrawing()
true
if the existing drawing is used as sketch
false
otherwise.public void setUseSketchDrawing(boolean value)
value
- true
if the existing drawing should be used
as sketch false
otherwise.public boolean isUsePostprocessing()
true
if the postprocessing step is applied and false
otherwise.public void setUsePostprocessing(boolean usePostprocessing)
usePostprocessing
- true
if the postprocessing step should be applied.public void doLayout(LayoutGraph graph)
CanonicMultiStageLayouter
doLayout
in interface Layouter
doLayout
in class CanonicMultiStageLayouter
protected void doLayoutCore(LayoutGraph graph)
CanonicMultiStageLayouter
doLayoutCore
in class CanonicMultiStageLayouter
protected boolean canLayoutCore(LayoutGraph graph)
CanonicMultiStageLayouter
canLayoutCore
in class CanonicMultiStageLayouter
true
for all graphs.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |