|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.hierarchic.incremental.AbstractPortConstraintOptimizer
public abstract class AbstractPortConstraintOptimizer
This class is an abstract implementation of the PortConstraintOptimizer
interface that minimizes the effort
required to modify the port assignment after the sequencing phase of hierarchic layout algorithm.
The callback method invoked after sequencing
performs the following three steps:
the hook
in which the custom port assignment should be done.
1
.
Nested Class Summary | |
---|---|
static class |
AbstractPortConstraintOptimizer.SameLayerData
This static class provides information about the same-layer structures created by class AbstractPortConstraintOptimizer . |
Constructor Summary | |
---|---|
protected |
AbstractPortConstraintOptimizer()
Creates a new AbstractPortConstraintOptimizer instance with default settings. |
Method Summary | |
---|---|
byte |
getLayoutOrientation()
Returns the layout orientation. |
int |
getMirrorMask()
Returns the mirror mask that defines which orientations should be mirrored. |
protected AbstractPortConstraintOptimizer.SameLayerData |
insertSameLayerStructures(LayoutGraph graph,
Layers layers,
LayoutDataProvider ldp,
ItemFactory itemFactory)
Inserts a same-layer edge structure for each same-layer edge of the original graph. |
abstract void |
optimizeAfterLayering(LayoutGraph graph,
Layers layers,
LayoutDataProvider ldp,
ItemFactory itemFactory)
Assigns new temporary port constraints after the nodes have been assigned to layers. |
protected void |
optimizeAfterSequencing(java.util.Comparator inEdgeOrder,
java.util.Comparator outEdgeOrder,
LayoutGraph graph,
Layers layers,
LayoutDataProvider ldp,
ItemFactory itemFactory)
Assigns new temporary port constraints after the order of the nodes in each layer has been determined. |
void |
optimizeAfterSequencing(LayoutGraph graph,
Layers layers,
LayoutDataProvider ldp,
ItemFactory itemFactory)
Assigns new temporary port constraints after the order of the nodes in each layer has been determined. |
protected abstract void |
optimizeAfterSequencing(Node node,
java.util.Comparator inEdgeOrder,
java.util.Comparator outEdgeOrder,
LayoutGraph graph,
LayoutDataProvider ldp,
ItemFactory itemFactory)
Assigns new temporary port constraints to a given node of the graph after the order of the nodes in each layer has been determined. |
protected void |
removeSameLayerStructures(AbstractPortConstraintOptimizer.SameLayerData sameLayerData,
LayoutGraph graph,
LayoutDataProvider ldp,
ItemFactory itemFactory)
Removes the same-layer edge structure created using insertSameLayerStructures(LayoutGraph, Layers, LayoutDataProvider, ItemFactory) . |
void |
setLayoutOrientation(byte layoutOrientation)
Specifies the layout orientation. |
void |
setMirrorMask(int mirrorMask)
Specifies the mirror mask that defines which orientations should be mirrored. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractPortConstraintOptimizer()
AbstractPortConstraintOptimizer
instance with default settings.
Method Detail |
---|
public int getMirrorMask()
Setting a layout orientation can be considered as rotating the graph by 90
, 180
or
270
degrees. Afterwards, the graph can be mirrored at the x-axis (for horizontal layout orientations)
or y-axis (for vertical layout orientations). Which directions are mirrored can be defined by the given mask.
OrientationLayouter
,
LayoutOrientation
,
setMirrorMask(int)
public void setMirrorMask(int mirrorMask)
Setting a layout orientation can be considered as rotating the graph by 90
, 180
or
270
degrees. Afterwards, the graph can be mirrored at the x-axis (for horizontal layout orientations)
or y-axis (for vertical layout orientations). Which directions are mirrored can be defined by the given mask.
OrientationLayouter.MIRROR_BOTTOM_TO_TOP
. Layout orientation
LayoutOrientation.BOTTOM_TO_TOP
will be mirrored at the y-axis.mirrorMask
- one of the predefined mirror masksOrientationLayouter
,
LayoutOrientation
public void setLayoutOrientation(byte layoutOrientation)
This setting is necessary to correctly interpret the values provided by the PortCandidate
s
since the OrientationLayouter
cannot automatically adjust these values.
LayoutOrientation.TOP_TO_BOTTOM
. The layout orientation is top-to-bottom.layoutOrientation
- a predefined orientation constantCanonicMultiStageLayouter.getLayoutOrientation()
public byte getLayoutOrientation()
This setting is necessary to correctly interpret the values provided by the PortCandidate
s
since the OrientationLayouter
cannot automatically adjust these values.
CanonicMultiStageLayouter.getLayoutOrientation()
,
setLayoutOrientation(byte)
public abstract void optimizeAfterLayering(LayoutGraph graph, Layers layers, LayoutDataProvider ldp, ItemFactory itemFactory)
More precisely, it is called after the layering information has been determined. In this phase, it is possible to create back-loops by assigning incoming edges to the south (i.e. bottom) side or outgoing edges to the north (i.e. top) side, respectively.
optimizeAfterLayering
in interface PortConstraintOptimizer
graph
- the input graphlayers
- the given Layers
instance holding the layering informationldp
- the LayoutDataProvider
implementation which provides access to the NodeData
and
EdgeData
instancesitemFactory
- the factory
that sets the temporary port constraintsItemFactory.setTemporaryPortConstraint(y.base.Edge, boolean, y.layout.PortConstraint)
public void optimizeAfterSequencing(LayoutGraph graph, Layers layers, LayoutDataProvider ldp, ItemFactory itemFactory)
More precisely, it is called after the sequence of the nodes has been determined. It
inserts the same-layer structures
, invokes
the hook
in which the custom port assignment should be done, and finally
restores the original state
of the layout graph by removing the temporary edges.
optimizeAfterSequencing
in interface PortConstraintOptimizer
graph
- the input graphlayers
- the given Layers
instance holding the layering informationldp
- the LayoutDataProvider
implementation which provides access to the NodeData
and
EdgeData
instancesitemFactory
- the factory
that sets the temporary port constraintsinsertSameLayerStructures(LayoutGraph, Layers, LayoutDataProvider, ItemFactory)
,
optimizeAfterSequencing(y.layout.LayoutGraph, Layers, LayoutDataProvider, ItemFactory)
,
removeSameLayerStructures(y.layout.hierarchic.incremental.AbstractPortConstraintOptimizer.SameLayerData, y.layout.LayoutGraph, y.layout.hierarchic.incremental.LayoutDataProvider, y.layout.hierarchic.incremental.ItemFactory)
protected void optimizeAfterSequencing(java.util.Comparator inEdgeOrder, java.util.Comparator outEdgeOrder, LayoutGraph graph, Layers layers, LayoutDataProvider ldp, ItemFactory itemFactory)
More precisely, it is called after the sequence of the nodes has been determined. It invokes
optimizeAfterSequencing(y.base.Node, java.util.Comparator, java.util.Comparator, y.layout.LayoutGraph, LayoutDataProvider, ItemFactory)
for every node of the original layout graph and omits the nodes of the same-layer structures.
Incoming and outgoing edges are sorted using Comparators.PartialOrder
instances which define the preferred ordering of the incoming
and outgoing edges from left to right. To sort collections according to a Comparators.PartialOrder
instance, an
appropriate method like Comparators.sort(java.util.List, java.util.Comparator)
or YList.sort(java.util.Comparator)
must be used.
inEdgeOrder
- a given Comparators.PartialOrder
instance for incoming edgesoutEdgeOrder
- a given Comparators.PartialOrder
instance for outgoing edgesgraph
- the input graphldp
- the LayoutDataProvider
implementation which provides access to the NodeData
and
EdgeData
instancesitemFactory
- the factory
that sets the temporary port constraintsoptimizeAfterSequencing(y.layout.LayoutGraph, Layers, LayoutDataProvider, ItemFactory)
protected abstract void optimizeAfterSequencing(Node node, java.util.Comparator inEdgeOrder, java.util.Comparator outEdgeOrder, LayoutGraph graph, LayoutDataProvider ldp, ItemFactory itemFactory)
More precisely, it is called after the sequence of the nodes has been determined.
Incoming and outgoing edges are sorted using Comparators.PartialOrder
instances which define the preferred ordering of the incoming
and outgoing edges from left to right. To sort collections according to a Comparators.PartialOrder
instance, an
appropriate method like Comparators.sort(java.util.List, java.util.Comparator)
or YList.sort(java.util.Comparator)
must be used.
node
- the original node to set temporary port constraintsinEdgeOrder
- a given Comparators.PartialOrder
instance for incoming edgesoutEdgeOrder
- a given Comparators.PartialOrder
instance for outgoing edgesgraph
- the input graphldp
- the LayoutDataProvider
implementation which provides access to the NodeData
and
EdgeData
instancesitemFactory
- the factory
that sets the temporary port constraintsoptimizeAfterSequencing(y.layout.LayoutGraph, Layers, LayoutDataProvider, ItemFactory)
protected AbstractPortConstraintOptimizer.SameLayerData insertSameLayerStructures(LayoutGraph graph, Layers layers, LayoutDataProvider ldp, ItemFactory itemFactory)
(s,t)
consists of a temporary node w
and edges (s,w)
and (t,w)
.graph
- the input graphlayers
- the given Layers
instance holding the layering informationldp
- the LayoutDataProvider
implementation which provides access to the NodeData
and
EdgeData
instancesitemFactory
- the factory
that sets the temporary port constraintsItemFactory.setTemporaryPortConstraint(y.base.Edge, boolean, y.layout.PortConstraint)
protected void removeSameLayerStructures(AbstractPortConstraintOptimizer.SameLayerData sameLayerData, LayoutGraph graph, LayoutDataProvider ldp, ItemFactory itemFactory)
insertSameLayerStructures(LayoutGraph, Layers, LayoutDataProvider, ItemFactory)
.
sameLayerData
- a given AbstractPortConstraintOptimizer.SameLayerData
instance holding the information about the same-layer structures.graph
- the input graphldp
- the LayoutDataProvider
implementation which provides access to the NodeData
and
EdgeData
instancesitemFactory
- the factory
that sets the temporary port constraintsItemFactory.setTemporaryPortConstraint(y.base.Edge, boolean, y.layout.PortConstraint)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |