|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.CanonicMultiStageLayouter
y.layout.organic.SmartOrganicLayouter
public class SmartOrganicLayouter
This class can be used as a convenience class to gain access to a variety of organic layout algorithms. Its strength lies in being able to conveniently specify a ratio between quality and running time, as well as the ability to specify the degree of the compactness of the drawing and to guarantee non-overlapping nodes.
| Field Summary | |
|---|---|
static Object |
GROUP_NODE_MODE_DATA
The data provider key for specifying how to handle group nodes. |
static Object |
GROUP_NODE_MODE_FIX_BOUNDS
Group node mode constant that can be used to tag a group node. |
static Object |
GROUP_NODE_MODE_FIX_CONTENTS
Group node mode constant that can be used to tag a group node. |
static Object |
GROUP_NODE_MODE_NORMAL
Group node mode constant that can be used to tag a group node. |
static Object |
NODE_SUBSET_DATA
The data provider key for specifying the node subset to be laid out. |
static Object |
PREFERRED_EDGE_LENGTH_DATA
The data provider key for specifying the preferred edge lengths for each edge The algorithm expects to find DataProvider.getInt(Object) integer values associated with
each edge. |
static byte |
SCOPE_ALL
scope constant - used for layouting all nodes |
static byte |
SCOPE_MAINLY_SUBSET
scope constant - used for layouting mainly the subset of the nodes |
static byte |
SCOPE_SUBSET
scope constant - used for layouting the subset of the nodes only |
| Fields inherited from interface y.layout.Layouter |
|---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES |
| Constructor Summary | |
|---|---|
SmartOrganicLayouter()
Creates a new SmartOrganicLayouter instance |
|
| Method Summary | |
|---|---|
protected boolean |
canLayoutCore(LayoutGraph graph)
Subclasses have to provide information whether or not they can layout the given graph. |
protected void |
configureComponentLayouter(LayoutGraph graph,
ComponentLayouter layouter)
Configures the ComponentLayouter
and graph instance to adhere to the NODE_SUBSET_DATA in case
SCOPE_ALL is not set. |
void |
doLayout(LayoutGraph layoutGraph)
Calculates a layout for the given graph. |
protected void |
doLayoutCore(LayoutGraph graph)
Subclasses have to provide core layout code in this method. |
double |
getCompactness()
Returns the property for the compactness of the resulting layout. |
GroupBoundsCalculator |
getGroupBoundsCalculator()
Returns the GroupBoundsCalculator instance used for calculating the size of group nodes. |
long |
getMaximumDuration()
Returns the maximum duration this algorithm is allowed to run. |
double |
getMinimalNodeDistance()
Returns the current minimal node distance this algorithm should enforce if the node overlaps allowance property is set to true. |
OutputRestriction |
getOutputRestriction()
Returns the current OutputRestriction instance set for this instance. |
double |
getPreferredEdgeLength()
Returns the currently set default preferred edge length. |
double |
getPreferredMinimalNodeDistance()
Returns the current preferred minimal node distance this algorithm should use for pairs of nodes that are not directly connected by adjacent edges. |
double |
getQualityTimeRatio()
Returns the qualityTimeRatio. |
byte |
getScope()
Returns the scope of the layout. |
boolean |
isDeterministic()
Returns whether the algorithm will behave deterministically in the next layout run. |
boolean |
isNodeEdgeOverlapAvoided()
Returns whether this algorithm is configured to try to avoid node/edge overlaps. |
boolean |
isNodeOverlapsAllowed()
Returns whether node overlaps are allowed (but not encouraged) for the next run. |
boolean |
isNodeSizeAware()
Determines whether the algorithm should consider the size of the nodes for the layout. |
boolean |
isSmartComponentLayoutEnabled()
Determines whether this instance should configure the ComponentLayouter
in such a way that it respects the scope's settings SCOPE_SUBSET and
SCOPE_MAINLY_SUBSET by keeping other nodes pinned down. |
void |
setCompactness(double compactness)
Sets the compactness property for the next layout run. |
void |
setDeterministic(boolean deterministic)
Sets this algorithm to deterministic mode. |
void |
setGroupBoundsCalculator(GroupBoundsCalculator groupBoundsCalculator)
Sets the GroupBoundsCalculator instance used for calculating the size of group nodes. |
void |
setMaximumDuration(long maximumDurationMillis)
Sets the soft limit for the maximum duration this algorithm is allowed to execute. |
void |
setMinimalNodeDistance(double minimalNodeDistance)
Sets the minimal node distance this algorithm should enforce between all pairs of nodes for the next run. |
void |
setNodeEdgeOverlapAvoided(boolean nodeEdgeOverlapAvoided)
Configures this algorithm so that it tries to avoid node/edge overlaps. |
void |
setNodeOverlapsAllowed(boolean nodeOverlapsAllowed)
Determines whether the next layout run should enforce non-overlapping nodes. |
void |
setNodeSizeAware(boolean nodeSizeAware)
Instructs the algorithm to consider node sizes for the next layout run. |
void |
setOutputRestriction(OutputRestriction restriction)
Sets a restriction on the output generated by this layouter |
void |
setPreferredEdgeLength(double preferredEdgeLength)
Sets the default preferred edge length for the next algorithm run. |
void |
setPreferredMinimalNodeDistance(double preferredMinimalNodeDistance)
Sets the minimal node distance this algorithm should try to obey for the next run. |
void |
setQualityTimeRatio(double qualityTimeRatio)
Setter the qualityTimeRatio property. |
void |
setScope(byte scope)
Sets the scope for the next layout run. |
void |
setSmartComponentLayoutEnabled(boolean smartComponentLayoutEnabled)
Sets whether this instance should configure the ComponentLayouter
in such a way that it respects the scope's settings SCOPE_SUBSET and
SCOPE_MAINLY_SUBSET by keeping other nodes pinned, even if they reside in different components. |
protected void |
unconfigureComponentLayouter(LayoutGraph graph,
ComponentLayouter layouter)
Unconfigures the ComponentLayouter
from previous configureComponentLayouter(y.layout.LayoutGraph, y.layout.ComponentLayouter)
call. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final byte SCOPE_ALL
public static final byte SCOPE_SUBSET
public static final byte SCOPE_MAINLY_SUBSET
public static final Object NODE_SUBSET_DATA
boolean that indicates whether the node belongs
to the "sphere of action".
setScope(byte)public static final Object GROUP_NODE_MODE_DATA
null:
null will be treated like GROUP_NODE_MODE_NORMAL.
public static final Object GROUP_NODE_MODE_NORMAL
GROUP_NODE_MODE_DATA DataProvider key to associate this constant
with a group node to indicate that it should be treated like an ordinary group node.
public static final Object GROUP_NODE_MODE_FIX_BOUNDS
GROUP_NODE_MODE_DATA DataProvider key to associate this constant
with a group node to indicate that its bounds should be treated as fixed an
its contents should never exceed those bounds.
public static final Object GROUP_NODE_MODE_FIX_CONTENTS
GROUP_NODE_MODE_DATA DataProvider key to associate this constant
with a group node to indicate that it can be moved like an ordinary group node however its
contents should remain fixed relative to the position of the group node.
Note that this implicitly fixes all descendants of the group node.
public static final Object PREFERRED_EDGE_LENGTH_DATA
DataProvider.getInt(Object) integer values associated with
each edge.
| Constructor Detail |
|---|
public SmartOrganicLayouter()
| Method Detail |
|---|
public GroupBoundsCalculator getGroupBoundsCalculator()
GroupBoundsCalculator instance used for calculating the size of group nodes.
The default is MinimumSizeGroupBoundsCalculator.
public boolean isSmartComponentLayoutEnabled()
ComponentLayouter
in such a way that it respects the scope's settings SCOPE_SUBSET and
SCOPE_MAINLY_SUBSET by keeping other nodes pinned down.
The default is false.
configure
the component layouter instance.isSmartComponentLayoutEnabled()public void setSmartComponentLayoutEnabled(boolean smartComponentLayoutEnabled)
ComponentLayouter
in such a way that it respects the scope's settings SCOPE_SUBSET and
SCOPE_MAINLY_SUBSET by keeping other nodes pinned, even if they reside in different components.
The default is false.
isSmartComponentLayoutEnabled()public void setGroupBoundsCalculator(GroupBoundsCalculator groupBoundsCalculator)
GroupBoundsCalculator instance used for calculating the size of group nodes.
The default is MinimumSizeGroupBoundsCalculator.
NullPointerException - if the argument is nullgroupBoundsCalculator - the instance to usepublic boolean isNodeEdgeOverlapAvoided()
setNodeEdgeOverlapAvoided(boolean)public void setNodeEdgeOverlapAvoided(boolean nodeEdgeOverlapAvoided)
false. Note that the current implementation does not
guarantee the non-existence of overlaps but tries to avoid them.
nodeEdgeOverlapAvoided - whether to enable that option
protected void configureComponentLayouter(LayoutGraph graph,
ComponentLayouter layouter)
ComponentLayouter
and graph instance to adhere to the NODE_SUBSET_DATA in case
SCOPE_ALL is not set.
This will result in the component layouter not rearranging components if they contain
pinned-down nodes.
graph - the graph that will be arrangedlayouter - the layouter to reconfigureunconfigureComponentLayouter(y.layout.LayoutGraph, y.layout.ComponentLayouter),
setSmartComponentLayoutEnabled(boolean)public void doLayout(LayoutGraph layoutGraph)
CanonicMultiStageLayouter
doLayout in interface LayouterdoLayout in class CanonicMultiStageLayouter
protected void unconfigureComponentLayouter(LayoutGraph graph,
ComponentLayouter layouter)
ComponentLayouter
from previous configureComponentLayouter(y.layout.LayoutGraph, y.layout.ComponentLayouter)
call.
graph - the graph that has been arrangedlayouter - the layouter to unconfigureconfigureComponentLayouter(y.layout.LayoutGraph, y.layout.ComponentLayouter),
setSmartComponentLayoutEnabled(boolean)protected boolean canLayoutCore(LayoutGraph graph)
CanonicMultiStageLayouter
canLayoutCore in class CanonicMultiStageLayouterprotected void doLayoutCore(LayoutGraph graph)
CanonicMultiStageLayouter
doLayoutCore in class CanonicMultiStageLayouterpublic double getQualityTimeRatio()
public void setQualityTimeRatio(double qualityTimeRatio)
qualityTimeRatio - a value between 0.0 (low quality, fast)
and 1.0 (high quality, slow)getQualityTimeRatio()public long getMaximumDuration()
public void setMaximumDuration(long maximumDurationMillis)
maximumDurationMillis - the new soft limit for the duration in millisecondspublic byte getScope()
SCOPE_ALL, SCOPE_SUBSET, or SCOPE_MAINLY_SUBSETpublic void setScope(byte scope)
scope - the new scope, should be one of SCOPE_ALL, SCOPE_SUBSET, or SCOPE_MAINLY_SUBSETpublic double getCompactness()
public void setCompactness(double compactness)
0.5d being a "normal" compactness.
compactness - the new compactness value [0.0d .. 1.0d]public double getPreferredEdgeLength()
double DataProvider instance bound to the graph using the
PREFERRED_EDGE_LENGTH_DATA key.
public void setPreferredEdgeLength(double preferredEdgeLength)
preferredEdgeLength - the new default preferred edge lengthgetPreferredEdgeLength()public double getPreferredMinimalNodeDistance()
public void setPreferredMinimalNodeDistance(double preferredMinimalNodeDistance)
preferredMinimalNodeDistance - the new preferred minimal distance between two nodes that are not directly connected to each otherpublic boolean isNodeSizeAware()
true the algorithm will take the node size into account
for given preferred edge lengths.
public void setNodeSizeAware(boolean nodeSizeAware)
nodeSizeAware - whether to consider the size of the nodes for the next layout runpublic boolean isDeterministic()
public void setDeterministic(boolean deterministic)
true, the algorithm will yield
the same results if given the exact same input and same settings.
deterministic - whether to operate in deterministic modepublic double getMinimalNodeDistance()
true.
public void setMinimalNodeDistance(double minimalNodeDistance)
minimalNodeDistance - the minimal distance between nodes that are not interconnected by a common edgesetNodeOverlapsAllowed(boolean)public boolean isNodeOverlapsAllowed()
public void setNodeOverlapsAllowed(boolean nodeOverlapsAllowed)
nodeOverlapsAllowed - whether to allow node overlapssetMinimalNodeDistance(double)public void setOutputRestriction(OutputRestriction restriction)
restriction - the restriction to useOutputRestriction.NONE,
OutputRestrictionpublic OutputRestriction getOutputRestriction()
OutputRestriction.NONE.
|
© Copyright 2000-2008, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||