public class OrthogonalRouter extends AbstractRouter
IConnectionRouter
that interprets the Connection
control
points as way points and adjusts the way points (if necessary) so that the
Connection
is routed orthogonally.Modifier and Type | Class and Description |
---|---|
protected static class |
OrthogonalRouter.ControlPointManipulator
A
OrthogonalRouter.ControlPointManipulator can be used to record, perform, and
roll back control point changes during routing. |
Constructor and Description |
---|
OrthogonalRouter() |
Modifier and Type | Method and Description |
---|---|
protected Point |
getAnchoredReferencePoint(Connection connection,
int index)
Returns the reference point for the anchor at the given index.
|
void |
route(Connection connection)
Adjusts the
connection's anchors (if necessary) to
satisfy certain routing constraints. |
protected Vector |
routeNonOrthogonalSegment(Connection connection,
OrthogonalRouter.ControlPointManipulator controlPointManipulator,
Vector inDirection,
Vector outDirection,
int i,
Point currentPoint)
This method is called for a non-orthogonal direction from the last point
on the connection to the current point on the connection.
|
protected Vector |
routeOrthogonalSegment(Connection connection,
OrthogonalRouter.ControlPointManipulator controlPointManipulator,
Vector currentDirection,
int i,
Point currentPoint)
This method is called for an orthogonal direction from the last point on
the connection to the current point on the connection.
|
protected void |
updateComputationParameters(Connection connection,
int index)
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) . |
getComputationParameter
protected Point getAnchoredReferencePoint(Connection connection, int index)
getAnchoredReferencePoint
in class AbstractRouter
connection
- The Connection
that is currently routed.index
- The index specifying the anchor for which to provide a
reference point.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
.connection
- The Connection
to route.protected Vector routeNonOrthogonalSegment(Connection connection, OrthogonalRouter.ControlPointManipulator controlPointManipulator, Vector inDirection, Vector outDirection, int i, Point currentPoint)
connection
- The Connection
that is manipulated.controlPointManipulator
- The helper that is used for inserting route points.inDirection
- The previous direction, or null
(for the end
point).outDirection
- The current direction, or null
(for the start
point).i
- The index of the current point.currentPoint
- The current Point
.protected Vector routeOrthogonalSegment(Connection connection, OrthogonalRouter.ControlPointManipulator controlPointManipulator, Vector currentDirection, int i, Point currentPoint)
connection
- The Connection
that is manipulated.controlPointManipulator
- The helper that is used to insert route points.currentDirection
- The current direction.i
- The index of the current point.currentPoint
- The current Point
.protected void updateComputationParameters(Connection connection, int index)
AbstractRouter
updateComputationParameters
in class AbstractRouter
connection
- The connection whose anchor to update.index
- The index of the connection anchor, whose reference point is
to be updated.public boolean wasInserted(IAnchor anchor)
IConnectionRouter
true
if the given IAnchor
was added by this
IConnectionRouter
during IConnectionRouter.route(Connection)
. Otherwise
returns false
.Copyright (c) 2014 itemis AG and others. All rights reserved.