Class FreeConnectorShape
java.lang.Object
org.pathvisio.libgpml.model.connector.AbstractConnector
org.pathvisio.libgpml.model.connector.SegmentedConnector
org.pathvisio.libgpml.model.connector.FreeConnectorShape
- All Implemented Interfaces:
ConnectorShape
public class FreeConnectorShape extends SegmentedConnector
Implements a connector that draws straight lines between multiple waypoints.
In contrast to the automatic connectors (Elbow and Curved), the waypoints can
be added/removed freely by the user.
- Author:
- leon
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.pathvisio.libgpml.model.connector.ConnectorShape
ConnectorShape.Segment, ConnectorShape.WayPoint
-
Field Summary
Fields inherited from interface org.pathvisio.libgpml.model.connector.ConnectorShape
AXIS_X, AXIS_Y
-
Constructor Summary
Constructors Constructor Description FreeConnectorShape()
Constructor for free connector shape. -
Method Summary
Modifier and Type Method Description protected ConnectorShape.Segment[]
calculateSegments(ConnectorRestrictions restrictions, ConnectorShape.WayPoint[] waypoints)
Calculates segments given restrictions and waypoints.private int
getNrSegments(ConnectorRestrictions restrictions)
Returns the number of segments given connector restrictions.boolean
hasValidWaypoints(ConnectorRestrictions restrictions)
Checks if number of waypoints matches number of segments.void
recalculateShape(ConnectorRestrictions restrictions)
Forces the connector to redraw it's path.Methods inherited from class org.pathvisio.libgpml.model.connector.SegmentedConnector
calculateShape, fromLineCoordinate, fromLineCoordinate, getTotalLength, toLineCoordinate
Methods inherited from class org.pathvisio.libgpml.model.connector.AbstractConnector
calculateAdjustedShape, getSegments, getShape, getWayPoints, setSegments, setShape, setWayPoints
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
FreeConnectorShape
public FreeConnectorShape()Constructor for free connector shape.
-
-
Method Details
-
recalculateShape
Forces the connector to redraw it's path. The cache for segments, waypoints and shape.- Parameters:
restrictions
- the ConnectorRestrictions that provides the start, end and preferred waypoints
-
hasValidWaypoints
Checks if number of waypoints matches number of segments.- Parameters:
restrictions
- the connector restrictions.- Returns:
- true if number of waypoints matches number of segments, false otherwise.
-
getNrSegments
Returns the number of segments given connector restrictions.- Parameters:
restrictions
- the connector restrictions.- Returns:
- the number of segments.
-
calculateSegments
protected ConnectorShape.Segment[] calculateSegments(ConnectorRestrictions restrictions, ConnectorShape.WayPoint[] waypoints)Calculates segments given restrictions and waypoints.- Parameters:
restrictions
- the connector restrictions.waypoints
- the waypoint array- Returns:
- the array of segments.
-