|
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.PortCandidateAssignmentStage
public class PortCandidateAssignmentStage
The PortCandidateAssignmentStage
assigns edges to the ports specified by PortConstraint
s or
PortCandidate
s after calling the core layout algorithm
.
It can be used for adjusting ports for layout algorithms that cannot handle PortConstraint
s.
If PortCandidate
s are assigned for edges and nodes, this stage tries to match them. When there is no
match, the PortCandidate
with the lowest costs specified for the edge is chosen.
While PortConstraint
s are also matched to PortCandidate
s at nodes and edges, it is not
recommended to mix them because they belong to different concepts.
This stage also considers port groups (see PortConstraintKeys.SOURCE_PORT_GROUP_ID_DPKEY
and
PortConstraintKeys.TARGET_PORT_GROUP_ID_DPKEY
). It assigns the same port to edges that are port-grouped
at a common node. Importantly, port grouping is prioritized over other constraints, for example, if two
port-grouped edges do not have at least one common PortCandidate
or the same PortConstraint
, then
the port of one of the edges will be chosen for both, violating the constraint of the other edge.
Furthermore, option setPathCorrectionEnabled(boolean)
allows to specify whether the edge path should be
corrected after correcting a port.
It is recommended that the PortCandidateAssignmentStage
is prepended to the core layout algorithm
in order to be able to process all the edges and especially, self-loops and parallel edges.
Note that edges that might be hidden by other LayoutStage
s cannot be handled by
PortCandidateAssignmentStage
.
PortConstraint
,
PortCandidate
,
PortCandidateSet
,
setPathCorrectionEnabled(boolean)
Field Summary |
---|
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
PortCandidateAssignmentStage()
Creates a new PortCandidateAssignmentStage instance with default settings. |
|
PortCandidateAssignmentStage(Layouter coreLayouter)
Creates a new PortCandidateAssignmentStage instance using the given
core layout algorithm . |
Method Summary | |
---|---|
boolean |
canLayout(LayoutGraph graph)
Accepts all graphs that can be handled by the core layout algorithm . |
void |
doLayout(LayoutGraph graph)
Corrects the ports of the edges considering PortConstraint s and PortCandidate s. |
boolean |
isPathCorrectionEnabled()
Returns whether or not this LayoutStage corrects the edge paths after moving the port to the location
specified by a PortConstraint or PortCandidate s. |
void |
setPathCorrectionEnabled(boolean pathCorrectionEnabled)
Specifies whether or not this LayoutStage corrects the edge paths after moving the port to the location
specified by a PortConstraint or PortCandidate s. |
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 |
Constructor Detail |
---|
public PortCandidateAssignmentStage()
PortCandidateAssignmentStage
instance with default settings.
public PortCandidateAssignmentStage(Layouter coreLayouter)
PortCandidateAssignmentStage
instance using the given
core layout algorithm
.
coreLayouter
- the core layout routineMethod Detail |
---|
public boolean canLayout(LayoutGraph graph)
core layout algorithm
.
If there is no core layout algorithm
, all graphs are accepted.
graph
- the input graph
true
if there is no core layout algorithm or the core layout algorithm accepts the graph,
false
otherwiseLayouter.doLayout(LayoutGraph)
public void doLayout(LayoutGraph graph)
PortConstraint
s and PortCandidate
s.
graph
- the input graphLayouter.canLayout(LayoutGraph)
public boolean isPathCorrectionEnabled()
LayoutStage
corrects the edge paths after moving the port to the location
specified by a PortConstraint
or PortCandidate
s.
If path correction is enabled, the edge will be rerouted within a specific area around its source/target node.
Outside this area, it will keep the route that was calculated by the core layout
algorithm
. If this feature is disabled, only the ports are moved which may be more suitable for initially
straight edges.
true
if edge paths are corrected, false
otherwisesetPathCorrectionEnabled(boolean)
public void setPathCorrectionEnabled(boolean pathCorrectionEnabled)
LayoutStage
corrects the edge paths after moving the port to the location
specified by a PortConstraint
or PortCandidate
s.
If path correction is enabled, the edge will be rerouted within a specific area around its source/target node.
Outside this area, it will keep the route that was calculated by the core layout
algorithm
. If this feature is disabled, only the ports are moved which may be more suitable for initially
straight edges.
pathCorrectionEnabled
- true
if edge paths should be corrected, false
otherwisefalse | true |
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |