public abstract class AbstractRouter extends java.lang.Object implements IConnectionRouter
IConnectionRouter
s implementing a routing
strategy that can be specialized by subclasses:
AbstractRouter.ControlPointManipulator
.
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractRouter.ControlPointManipulator
A
AbstractRouter.ControlPointManipulator can be used to record, perform, and
roll back control point changes during routing. |
protected static class |
AbstractRouter.VolatileStaticAnchor
The
AbstractRouter.VolatileStaticAnchor is a StaticAnchor that may be
inserted by an AbstractRouter during
route(Connection) , and, hence,
will be removed when routing is performed again. |
Constructor and Description |
---|
AbstractRouter() |
Modifier and Type | Method and Description |
---|---|
protected AbstractRouter.ControlPointManipulator |
createControlPointManipulator(Connection connection)
Returns a newly created
AbstractRouter.ControlPointManipulator that can be used
to insert control points into the given Connection . |
protected IGeometry |
getAnchorageGeometry(int index)
Retrieves the geometry of the anchorage at the given index within the
coordinate system of the
Connection , in case the respective
anchor is connected. |
protected abstract Point |
getAnchoredReferencePoint(java.util.List<Point> points,
int index)
Returns the
DynamicAnchor.AnchoredReferencePoint parameter value (within the
coordinate system of the Connection ) for the anchor specified by
the given index. |
protected Connection |
getConnection()
Returns the
Connection of the last route(Connection)
call. |
protected void |
insertRouterAnchors(Connection connection)
Inserts router anchors into the
Connection . |
protected void |
removeVolatileAnchors(Connection connection)
Removes volatile anchors (i.e.
|
protected Vector |
route(AbstractRouter.ControlPointManipulator cpm,
Vector inDirection,
Vector outDirection)
Inserts router anchors where necessary.
|
void |
route(Connection connection)
Adjusts the
connection's anchors (if necessary) to
satisfy certain routing constraints. |
protected void |
updateComputationParameters(Connection connection)
Updates all computation parameters for the anchors of the given
Connection . |
protected void |
updateComputationParameters(java.util.List<Point> points,
int index,
DynamicAnchor anchor,
AnchorKey key)
Update's the reference point of the anchor with the given index.
|
boolean |
wasInserted(IAnchor anchor)
Returns
true if the given IAnchor was added by this
IConnectionRouter during IConnectionRouter.route(Connection) . |
protected AbstractRouter.ControlPointManipulator createControlPointManipulator(Connection connection)
AbstractRouter.ControlPointManipulator
that can be used
to insert control points into the given Connection
.connection
- The Connection
for which to create a
AbstractRouter.ControlPointManipulator
.AbstractRouter.ControlPointManipulator
for the given
Connection
.protected IGeometry getAnchorageGeometry(int index)
Connection
, in case the respective
anchor is connected.index
- The index of the anchor whose anchorage geometry is to be
retrieved.null
if the anchor is
not connected.protected abstract Point getAnchoredReferencePoint(java.util.List<Point> points, int index)
DynamicAnchor.AnchoredReferencePoint
parameter value (within the
coordinate system of the Connection
) for the anchor specified by
the given index.points
- The list of Point
s from which the Connection
is currently constituted.index
- The index of the IAnchor
for which to compute the
DynamicAnchor.AnchoredReferencePoint
parameter value.Point
for the specified anchor.protected Connection getConnection()
Connection
of the last route(Connection)
call.Connection
passed into route(Connection)
.protected void insertRouterAnchors(Connection connection)
Connection
.connection
- The Connection
.protected void removeVolatileAnchors(Connection connection)
inserted by
the router
).connection
- The Connection
from which to remove volatile anchors.public void route(Connection connection)
IConnectionRouter
connection's
anchors (if necessary) to
satisfy certain routing constraints. This includes insertion of
'implicit' anchors, as well as updating the positions of existing anchors
(which includes manipulating the
computation parameters
of dynamic anchors
.route
in interface IConnectionRouter
connection
- The Connection
to route.protected Vector route(AbstractRouter.ControlPointManipulator cpm, Vector inDirection, Vector outDirection)
Vector
that
points to the next point.cpm
- The AbstractRouter.ControlPointManipulator
that can be used to insert
points.inDirection
- The Vector
from the previous point to the current
point.outDirection
- The Vector
from the current point to the next point.Vector
from the current point to the next
point.protected void updateComputationParameters(Connection connection)
Connection
.connection
- The Connection
.protected void updateComputationParameters(java.util.List<Point> points, int index, DynamicAnchor anchor, AnchorKey key)
points
- The Connection
's points (snapshot taken before
parameters are updated, i.e. independent from the parameter
changes).index
- The index of the connection anchor (and anchor key) for which
the computation parameters are updated.anchor
- The DynamicAnchor
for which to update the computation
parameters.key
- The AnchorKey
, corresponding to the index, for which
to update the computation parameters.public boolean wasInserted(IAnchor anchor)
IConnectionRouter
true
if the given IAnchor
was added by this
IConnectionRouter
during IConnectionRouter.route(Connection)
. Otherwise
returns false
.wasInserted
in interface IConnectionRouter
anchor
- The IAnchor
that is tested for implicitness.true
if the given IAnchor
is implicit,
otherwise false
.Copyright (c) 2014, 2016 itemis AG and others. All rights reserved.