|
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.hierarchic.HierarchicLayouter
public class HierarchicLayouter
This class implements a layout algorithm for drawing directed graphs in a hierarchic way.
The algorithm places nodes in different horizontal layers, in such a way that most edges in the graph run from top to bottom. Here is a sample output of the algorithm using top to bottom orientation andPENDULUM
layout style.
PortConstraint
and PortConstraintKeys
on how
to setup port constraint information for this algorithm.
HierarchicLayouter 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 labeling algorithm.
Field Summary | |
---|---|
static byte |
LAYERING_BFS
Layering strategy specifier. |
static byte |
LAYERING_FROM_SKETCH
Layering strategy specifier. |
static byte |
LAYERING_HIERARCHICAL_DOWNSHIFT
Layering strategy specifier. |
static byte |
LAYERING_HIERARCHICAL_OPTIMAL
Layering strategy specifier. |
static byte |
LAYERING_HIERARCHICAL_TIGHT_TREE
Layering strategy specifier. |
static byte |
LAYERING_HIERARCHICAL_TOPMOST
Layering strategy specifier. |
static byte |
LAYERING_STRATEGY_UNKNOWN
Dummy layering strategy specifier. |
static byte |
LAYERING_USER_DEFINED
Layering strategy specifier. |
static byte |
LINEAR_SEGMENTS
Layout style specifier. |
static byte |
MEDIAN_SIMPLEX
Layout style specifier. |
static byte |
PENDULUM
Layout style specifier. |
static byte |
POLYLINE
Layout style specifier. |
static byte |
ROUTE_ORTHOGONAL
Edge routing style specifier. |
static byte |
ROUTE_POLYLINE
Edge routing style specifier. |
static byte |
SIMPLEX
Layout style specifier. |
static byte |
TREE
Layout style specifier. |
Fields inherited from interface y.layout.PortConstraintKeys |
---|
SOURCE_GROUPID_KEY, SOURCE_PORT_CONSTRAINT_KEY, TARGET_GROUPID_KEY, TARGET_PORT_CONSTRAINT_KEY |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
HierarchicLayouter()
Instantiates a new HierarchicLayouter. |
Method Summary | |
---|---|
boolean |
canLayoutCore(LayoutGraph graph)
Always returns true. |
void |
disposeMementoSupport()
Disposes the memento support if it is existent, i.e. if it has been queried before by getMementoSupport() |
void |
doLayoutCore(LayoutGraph g)
Layout the given graph. |
int |
getBendReductionThreshold()
Returns the limit, when bends are removed and a straight line is drawn instead. |
Drawer |
getDrawer()
Returns the Drawer , which is responsible for the third phase of
the algorithm. |
Layerer |
getLayerer()
Returns the Layerer , which is responsible for the first phase
of the algorithm. |
byte |
getLayeringStrategy()
Returns the currently set layering strategy. |
protected NodeList[] |
getLayerSequence(LayoutGraph g,
NodeMap LAYER_KEY,
int maxLayer)
Determines the order of the nodes within their layers. |
LayerSequencer |
getLayerSequencer()
Returns the LayerSequencer , which is responsible for the second phase
of the algorithm. |
byte |
getLayoutStyle()
Returns the currently set layout style or -1
if the style cannot be
determined |
long |
getMaximalDuration()
Returns a time limit for the algorithm in milliseconds |
MementoSupport |
getMementoSupport()
Gets the cookie for the memento support of the hierarchic layout algorithm. |
double |
getMinimalEdgeDistance()
Returns the minimal distance between edges that run in parallel. |
double |
getMinimalFirstSegmentLength()
Returns the minimal length of first and last edge segments for edge routing. |
double |
getMinimalLayerDistance()
Returns the minimal distance between two layers. |
double |
getMinimalNodeDistance()
Returns the minimal distance between two nodes in the same layer. |
boolean |
getRemoveFalseCrossings()
Returns whether or not false crossings should be removed from the layout. |
byte |
getRoutingStyle()
Returns the routing style being used. |
boolean |
isPortConstraintOptimizationEnabled()
Returns whether the algorithm tries to optimize PortConstraints, that are either PortConstraint.ANY_SIDE or null . |
boolean |
isSameLayerEdgeRoutingOptimizationEnabled()
Returns whether the algorithm tries to optimize the routing of same layer edges whose PortConstraints don't impose the routing. |
void |
setBendReductionThreshold(int t)
Sets the limit, when bends are removed and a straight line is drawn instead. |
void |
setDrawer(Drawer drawer)
Sets the Drawer , which is responsible for the third phase of
the algorithm. |
void |
setLayerer(Layerer layerer)
Sets the Layerer , which is responsible for the first phase
of the algorithm. |
void |
setLayeringStrategy(byte strategy)
Sets a predefined layering strategy. |
void |
setLayerSequencer(LayerSequencer sequencer)
Sets the LayerSequencer , which is responsible for the second phase
of the algorithm. |
void |
setLayoutStyle(byte style)
Sets the layout style for this layouter. |
void |
setMaximalDuration(long msec)
Sets a time limit for the algorithm in milliseconds |
void |
setMinimalEdgeDistance(double d)
Sets the minimal distance between edges that run in parallel. |
void |
setMinimalFirstSegmentLength(double minimalFirstSegmentLength)
Sets the minimal length of first and last edge segments for edge routing. |
void |
setMinimalLayerDistance(double d)
Sets the minimal distance between two layers. |
void |
setMinimalNodeDistance(double d)
Sets the minimal distance between two nodes in the same layer. |
void |
setPortConstraintOptimizationEnabled(boolean enabled)
Specifies whether the algorithm should try to optimize PortConstraints, that are either PortConstraint.ANY_SIDE or null . |
void |
setRemoveFalseCrossings(boolean b)
Specifies whether or not false crossings should be removed from the layout. |
void |
setRoutingStyle(byte style)
Sets the edge routing style. |
void |
setSameLayerEdgeRoutingOptimizationEnabled(boolean enabled)
Determines whether the algorithm should try to optimize the routing of same layer edges whose PortConstraints don't impose the routing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte PENDULUM
public static final byte LINEAR_SEGMENTS
public static final byte POLYLINE
public static final byte TREE
public static final byte SIMPLEX
public static final byte MEDIAN_SIMPLEX
public static final byte ROUTE_POLYLINE
public static final byte ROUTE_ORTHOGONAL
public static final byte LAYERING_HIERARCHICAL_TOPMOST
setLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_HIERARCHICAL_OPTIMAL
setLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_HIERARCHICAL_TIGHT_TREE
LAYERING_HIERARCHICAL_OPTIMAL
.
setLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_HIERARCHICAL_DOWNSHIFT
LAYERING_HIERARCHICAL_TOPMOST
by down shifting
some nodes in the layering. The quality is usually worse than the
one produced by Tight Tree Heuristic.
setLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_BFS
BFSLayerer.CORE_NODES
.
If this data provider is not given, then nodes that have no incoming edges are placed
in the first layer.
setLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_FROM_SKETCH
setLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_USER_DEFINED
GivenLayersLayerer.LAYER_ID_KEY
. Like
LAYERING_FROM_SKETCH
this layering allows inner layer edges.
setLayeringStrategy(byte)
,
Constant Field Valuespublic static final byte LAYERING_STRATEGY_UNKNOWN
getLayeringStrategy()
if the current strategy
is not known.
Constructor Detail |
---|
public HierarchicLayouter()
Method Detail |
---|
public void setRoutingStyle(byte style)
ROUTE_POLYLINE
and ROUTE_ORTHOGONAL
.
By default ROUTE_POLYLINE
is set.
public byte getRoutingStyle()
setRoutingStyle(byte)
public void setPortConstraintOptimizationEnabled(boolean enabled)
PortConstraint.ANY_SIDE
or null
.
Default is false
.
enabled
- whether optimization should be performedpublic boolean isPortConstraintOptimizationEnabled()
PortConstraint.ANY_SIDE
or null
.
Default is false
.
public void setSameLayerEdgeRoutingOptimizationEnabled(boolean enabled)
true
.
enabled
- whether optimization should be performedpublic boolean isSameLayerEdgeRoutingOptimizationEnabled()
public void setLayoutStyle(byte style)
POLYLINE
, LINEAR_SEGMENTS
, MEDIAN_SIMPLEX
,
SIMPLEX
, PENDULUM
,
and TREE
.
The default is set to LINEAR_SEGMENTS
public byte getLayoutStyle()
-1
if the style cannot be
determined
public void setLayeringStrategy(byte strategy)
LAYERING_HIERARCHICAL_TIGHT_TREE
is set.
strategy
- one of
LAYERING_HIERARCHICAL_TOPMOST
, LAYERING_HIERARCHICAL_DOWNSHIFT
,
LAYERING_HIERARCHICAL_TIGHT_TREE
, LAYERING_HIERARCHICAL_OPTIMAL
,
LAYERING_FROM_SKETCH
, LAYERING_USER_DEFINED
or
LAYERING_BFS
.public byte getLayeringStrategy()
setLayeringStrategy(byte)
public void setLayerer(Layerer layerer)
Layerer
, which is responsible for the first phase
of the algorithm.
public Layerer getLayerer()
Layerer
, which is responsible for the first phase
of the algorithm.
public void setLayerSequencer(LayerSequencer sequencer)
LayerSequencer
, which is responsible for the second phase
of the algorithm.
public LayerSequencer getLayerSequencer()
LayerSequencer
, which is responsible for the second phase
of the algorithm.
public void setDrawer(Drawer drawer)
Drawer
, which is responsible for the third phase of
the algorithm. The Drawer
is responsible for the layout style of
this layouter.
public Drawer getDrawer()
Drawer
, which is responsible for the third phase of
the algorithm. The Drawer
is responsible for the layout style of
this layouter.
public void setMinimalNodeDistance(double d)
public double getMinimalNodeDistance()
public void setMinimalEdgeDistance(double d)
public double getMinimalEdgeDistance()
public void setMinimalLayerDistance(double d)
public double getMinimalLayerDistance()
public double getMinimalFirstSegmentLength()
public void setMinimalFirstSegmentLength(double minimalFirstSegmentLength)
minimalFirstSegmentLength
- the new minimal length of first and last
edge segmentspublic void setRemoveFalseCrossings(boolean b)
public boolean getRemoveFalseCrossings()
public void setMaximalDuration(long msec)
public long getMaximalDuration()
public void setBendReductionThreshold(int t)
public int getBendReductionThreshold()
public boolean canLayoutCore(LayoutGraph graph)
canLayoutCore
in class CanonicMultiStageLayouter
public void doLayoutCore(LayoutGraph g)
doLayoutCore
in class CanonicMultiStageLayouter
protected NodeList[] getLayerSequence(LayoutGraph g, NodeMap LAYER_KEY, int maxLayer)
public MementoSupport getMementoSupport()
public void disposeMementoSupport()
getMementoSupport()
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |