|
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.router.CurveRoutingStage
public class CurveRoutingStage
CurveRoutingStage
replaces polyline edge paths with curved segments using cubic bezier splines.
This layout stage provides a generic way to add curved edge paths for a layout with polyline routes.
It first calls the core layout algorithm
and converts the edge routes as
a post-processing step.
Note that IncrementalHierarchicLayouter
and EdgeRouter
offer an integrated curve routing, making the usage of this layout stage unnecessary (see routing styles
RoutingStyle.EDGE_STYLE_CURVED
and
EdgeLayoutDescriptor.EDGE_STYLE_CURVED
).
A layout where this stage converted orthogonal edge paths to curved ones (the input is shown below).
The orthogonal input produced by the core layout on which the above curved example is based.
Using the scope
, it is possible to select for which edges the path is converted
to a curved one. This allows to only change a subset of edges.
Furthermore, the CurveEdgeLayoutDescriptor
class allows to individually configure settings for edges.
This stage is able to consider node and edge labels, see the respective properties
setNodeLabelConsiderationEnabled(boolean)
and setEdgeLabelConsiderationEnabled(boolean)
.
If edge labels are considered, the PreferredPlacementDescriptor
is respected too, such that
the preferred placement remains correct if it is already correct after the core layout execution.
This stage also supports edge grouping such that edges that are correctly grouped by the core layout
algorithm remain grouped in the curved layout result. However, it will not create new groupings. The same applies
for other features like, e.g., PortConstraint
s or PortCandidate
s. They are
only respected if they are already respected by the core layout algorithm
.
Field Summary | |
---|---|
static java.lang.Object |
CURVE_EDGE_LAYOUT_DESCRIPTOR_DPKEY
A DataProvider key for specifying individual edge layout information
If the DataProvider registered with this key does not contain a CurveEdgeLayoutDescriptor
for an edge, then the default descriptor is used. |
static byte |
ROUTE_ALL_EDGES
A scope specifier which defines that all edges of the input graph will be routed. |
static byte |
ROUTE_EDGES_AT_SELECTED_NODES
A scope specifier which defines that only edges incident to selected nodes will be routed. |
static byte |
ROUTE_SELECTED_EDGES
A scope specifier which defines that only the selected edges of the input graph will be routed. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
CurveRoutingStage(Layouter core)
Creates a new CurveRoutingStage instance using the given core layout
algorithm . |
Method Summary | |
---|---|
boolean |
canLayout(LayoutGraph graph)
Accepts all general graphs. |
void |
doLayout(LayoutGraph graph)
Adds curved segments to the edge routes produced by the core layout algorithm . |
java.lang.Object |
getAffectedEdgesDpKey()
Returns the DataProvider key to look up which edges are routed. |
java.lang.Object |
getAffectedNodesDpKey()
Returns the DataProvider key to look up the nodes whose incident edges are routed. |
CurveEdgeLayoutDescriptor |
getDefaultEdgeLayoutDescriptor()
Returns the default CurveEdgeLayoutDescriptor which provides layout information that is considered when
adding curves to the edge path. |
byte |
getScope()
Returns the (sub-)set of edges whose routes shall be converted to curved ones. |
boolean |
isEdgeLabelConsiderationEnabled()
Returns whether or not edge labels are considered while determining curved edge routes. |
boolean |
isNodeLabelConsiderationEnabled()
Returns whether or not node labels are considered while determining spline routes. |
void |
setAffectedEdgesDpKey(java.lang.Object affectedEdgesDpKey)
Specifies the DataProvider key to look up which edges are routed. |
void |
setAffectedNodesDpKey(java.lang.Object affectedNodesDpKey)
Specifies the DataProvider key to look up the nodes whose incident edges are routed. |
void |
setDefaultEdgeLayoutDescriptor(CurveEdgeLayoutDescriptor descriptor)
Specifies the default CurveEdgeLayoutDescriptor which provides layout information that is considered when
adding curves to the edge path. |
void |
setEdgeLabelConsiderationEnabled(boolean enabled)
Specifies whether or not edge labels are considered while determining curved edge routes. |
void |
setNodeLabelConsiderationEnabled(boolean enabled)
Specifies whether or not node labels are considered while determining spline routes. |
void |
setScope(byte scope)
Specifies the (sub-)set of edges whose routes shall be converted to curved ones. |
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 java.lang.Object CURVE_EDGE_LAYOUT_DESCRIPTOR_DPKEY
DataProvider
key for specifying individual edge layout information
If the DataProvider
registered with this key does not contain a CurveEdgeLayoutDescriptor
for an edge, then the default descriptor
is used.
CurveEdgeLayoutDescriptor
,
getDefaultEdgeLayoutDescriptor()
public static final byte ROUTE_ALL_EDGES
public static final byte ROUTE_SELECTED_EDGES
The selection state of an edge is determined by a boolean value returned
by a DataProvider
registered with key getAffectedEdgesDpKey()
.
All other non-selected edges will be considered to have fixed routes.
public static final byte ROUTE_EDGES_AT_SELECTED_NODES
The selection state of a node is determined by a boolean value returned
by a DataProvider
registered with key getAffectedNodesDpKey()
.
All other edges that are incident to non-selected nodes will be considered to have fixed routes.
Constructor Detail |
---|
public CurveRoutingStage(Layouter core)
CurveRoutingStage
instance using the given core layout
algorithm
.
core
- the core layout algorithmMethod Detail |
---|
public byte getScope()
setScope(byte)
,
getAffectedEdgesDpKey()
,
getAffectedNodesDpKey()
public void setScope(byte scope)
ROUTE_ALL_EDGES
scope
- one of the default scope values
java.lang.IllegalArgumentException
- if the given scope is unknowngetAffectedEdgesDpKey()
,
getAffectedNodesDpKey()
public java.lang.Object getAffectedEdgesDpKey()
DataProvider
key to look up which edges are routed.
If the setScope(byte)
scope} is set to ROUTE_SELECTED_EDGES
, only the selected edges
will be routed, while all other edges will be considered to have fixed routes.
DataProvider
key for the edge selectionsetScope(byte)
,
setAffectedEdgesDpKey(Object)
public void setAffectedEdgesDpKey(java.lang.Object affectedEdgesDpKey)
DataProvider
key to look up which edges are routed.
If the setScope(byte)
scope} is set to ROUTE_SELECTED_EDGES
, only the selected edges
will be routed, while all other edges will be considered to have fixed routes.
Layouter.SELECTED_EDGES
affectedEdgesDpKey
- the DataProvider
key for edge selection
java.lang.IllegalArgumentException
- if the specified DataProvider
key is null
setScope(byte)
,
getAffectedEdgesDpKey()
public java.lang.Object getAffectedNodesDpKey()
DataProvider
key to look up the nodes whose incident edges are routed.
If the setScope(byte)
scope} is set to ROUTE_EDGES_AT_SELECTED_NODES
, only the edges
that are incident to selected nodes will be routed, while all other edges will be considered to have
fixed routes.
DataProvider
key for the node selectionsetScope(byte)
,
setAffectedNodesDpKey(Object)
public void setAffectedNodesDpKey(java.lang.Object affectedNodesDpKey)
DataProvider
key to look up the nodes whose incident edges are routed.
If the setScope(byte)
scope} is set to ROUTE_EDGES_AT_SELECTED_NODES
, only the edges
that are incident to selected nodes will be routed, while all other edges will be considered to have
fixed routes.
Layouter.SELECTED_NODES
affectedNodesDpKey
- the DataProvider
key for node selection
java.lang.IllegalArgumentException
- if the specified DataProvider
key is null
setScope(byte)
,
getAffectedNodesDpKey()
public CurveEdgeLayoutDescriptor getDefaultEdgeLayoutDescriptor()
CurveEdgeLayoutDescriptor
which provides layout information that is considered when
adding curves to the edge path.
This CurveEdgeLayoutDescriptor
is used for all edges that have no individual layout information assigned.
CurveEdgeLayoutDescriptor
CURVE_EDGE_LAYOUT_DESCRIPTOR_DPKEY
,
setDefaultEdgeLayoutDescriptor(CurveEdgeLayoutDescriptor)
public void setDefaultEdgeLayoutDescriptor(CurveEdgeLayoutDescriptor descriptor)
CurveEdgeLayoutDescriptor
which provides layout information that is considered when
adding curves to the edge path.
This CurveEdgeLayoutDescriptor
is used for all edges that have no individual layout information assigned.
CurveEdgeLayoutDescriptor
descriptor
- the CurveEdgeLayoutDescriptor
java.lang.IllegalArgumentException
- if the specified CurveEdgeLayoutDescriptor
is null
CURVE_EDGE_LAYOUT_DESCRIPTOR_DPKEY
public boolean isEdgeLabelConsiderationEnabled()
The edge labels are taken into account when checking for intersections and the routes are prepared to get an associated segment that fits the preferred placement of the label.
core layout algorithm
place the labels.true
if edge labels are considered, false
otherwisePreferredPlacementDescriptor
,
setEdgeLabelConsiderationEnabled(boolean)
public void setEdgeLabelConsiderationEnabled(boolean enabled)
The edge labels are taken into account when checking for intersections and the routes are prepared to get an associated segment that fits the preferred placement of the label.
core layout algorithm
place the labels.enabled
- true
if edge labels should be considered, false
otherwisePreferredPlacementDescriptor
public boolean isNodeLabelConsiderationEnabled()
The node labels will be taken into account when checking for intersections and the routes will be prepared to get an associated segment that fits the the preferred placement of the label.
core layout algorithm
place the labels.true
if node labels are considered, false
otherwisesetNodeLabelConsiderationEnabled(boolean)
public void setNodeLabelConsiderationEnabled(boolean enabled)
The node labels will be taken into account when checking for intersections and the routes will be prepared to get an associated segment that fits the the preferred placement of the label.
core layout algorithm
place the labels.enabled
- true
if node labels should be considered, false
otherwisepublic boolean canLayout(LayoutGraph graph)
graph
- the input graph
true
for all graphsLayouter.doLayout(LayoutGraph)
public void doLayout(LayoutGraph graph)
core layout algorithm
.
graph
- the input graphLayouter.canLayout(LayoutGraph)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |