|
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.PortCalculator
public class PortCalculator
This class implements a LayoutStage that can be used to adjust the final port
assignments after a layout has been calculated. This can be useful if the port
assignment calculated by the layout algorithm is insufficient. This stage uses
DataProvider
instances bound to the graph using the keys defined in
the IntersectionCalculator
interface to calculate the new port offsets.
For each edge in the LayoutGraph
instance the
DataProvider
s are queried for an implementation of the
IntersectionCalculator
interface. If the result is non-null
,
that implementation will be queried and if the result of the query is
non-null
, the returned point will be applied to the edge layout.
CompositeLayoutStage.prependStage(y.layout.LayoutStage)
or
CanonicMultiStageLayouter.prependStage(y.layout.LayoutStage)
to add this layout stage and register appropriate DataProvider
implementations to the graph using the keys defined in IntersectionCalculator
.
Note, that this class will not change the coordinates of a port if it is
associated with a strong port constraint.
IntersectionCalculator
,
IntersectionCalculator.SOURCE_INTERSECTION_CALCULATOR_DPKEY
,
IntersectionCalculator.TARGET_INTERSECTION_CALCULATOR_DPKEY
,
PortConstraint
Field Summary | |
---|---|
protected double |
EPS
EPSILON used by equalsEps(double, double, double, double) . |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
PortCalculator()
Creates a new PortCalculator without a core layouter. |
|
PortCalculator(Layouter core)
Creates a new PortCalculator using the given layouter as the core of this layout stage. |
Method Summary | |
---|---|
protected void |
calculatePorts(LayoutGraph graph)
Performs the actual port calculation on the specified graph instance. |
boolean |
canLayout(LayoutGraph graph)
Returns true iff the given graph can be laid
out by this algorithm. |
void |
doLayout(LayoutGraph graph)
Main layout routine that assigns new layout information to the given graph. |
protected boolean |
equalsEps(double x1,
double y1,
double x2,
double y2)
Callback method that determines whether two points are equal. |
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 |
Methods inherited from interface y.layout.LayoutStage |
---|
getCoreLayouter, setCoreLayouter |
Field Detail |
---|
protected double EPS
equalsEps(double, double, double, double)
.
By default this is 0.2d
.
Constructor Detail |
---|
public PortCalculator()
public PortCalculator(Layouter core)
Method Detail |
---|
public boolean canLayout(LayoutGraph graph)
Layouter
true
iff the given graph can be laid
out by this algorithm. Calling doLayout
with
the given graph as its argument will only success if
this method returns true
.
canLayout
in interface Layouter
public void doLayout(LayoutGraph graph)
Layouter
doLayout
in interface Layouter
protected void calculatePorts(LayoutGraph graph)
protected boolean equalsEps(double x1, double y1, double x2, double y2)
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |