Class AbstractConnector
java.lang.Object
org.pathvisio.libgpml.model.connector.AbstractConnector
- All Implemented Interfaces:
ConnectorShape
- Direct Known Subclasses:
SegmentedConnector
,StraightConnectorShape
public abstract class AbstractConnector extends java.lang.Object implements ConnectorShape
Abstract connector shape implementation that deals with cached shapes,
segments and waypoints. ConnectorShapes may implement this class and use the
setShape, setSegments and setWayPoints to refresh the cached shape.
- Author:
- thomas
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.pathvisio.libgpml.model.connector.ConnectorShape
ConnectorShape.Segment, ConnectorShape.WayPoint
-
Field Summary
Fields Modifier and Type Field Description private ConnectorShape.Segment[]
segments
private java.awt.Shape
shape
private ConnectorShape.WayPoint[]
waypoints
Fields inherited from interface org.pathvisio.libgpml.model.connector.ConnectorShape
AXIS_X, AXIS_Y
-
Constructor Summary
Constructors Constructor Description AbstractConnector()
-
Method Summary
Modifier and Type Method Description java.awt.Shape
calculateAdjustedShape(double startGap, double endGap)
Calculates shape from the width of the line endings.protected abstract java.awt.Shape
calculateShape(ConnectorShape.Segment[] segments)
Calculates shape from the width of the line endings.ConnectorShape.Segment[]
getSegments()
Returns the segments of the connector shape as an array.java.awt.Shape
getShape()
Returns the connector shape.ConnectorShape.WayPoint[]
getWayPoints()
Returns the waypoints of the connector shape as an array.protected void
setSegments(ConnectorShape.Segment[] segments)
Sets the segment cache that will be returned bygetSegments()
.protected void
setShape(java.awt.Shape shape)
Sets the shape cache that will be returned bygetShape()
.void
setWayPoints(ConnectorShape.WayPoint[] waypoints)
Sets the waypoints cache that will be returned bygetWayPoints()
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.pathvisio.libgpml.model.connector.ConnectorShape
fromLineCoordinate, hasValidWaypoints, recalculateShape, toLineCoordinate
-
Field Details
-
shape
private java.awt.Shape shape -
segments
-
waypoints
-
-
Constructor Details
-
AbstractConnector
public AbstractConnector()
-
-
Method Details
-
getShape
public java.awt.Shape getShape()Returns the connector shape.- Specified by:
getShape
in interfaceConnectorShape
- Returns:
- shape the shape.
-
calculateShape
Calculates shape from the width of the line endings.- Parameters:
segments
- the array of segments.- Returns:
- the calculated shape.
-
calculateAdjustedShape
public java.awt.Shape calculateAdjustedShape(double startGap, double endGap)Calculates shape from the width of the line endings.- Specified by:
calculateAdjustedShape
in interfaceConnectorShape
- Parameters:
startGap
- the double.endGap
- the double.
-
setShape
protected void setShape(java.awt.Shape shape)Sets the shape cache that will be returned bygetShape()
.- Parameters:
shape
- the shape.
-
getSegments
Returns the segments of the connector shape as an array.- Specified by:
getSegments
in interfaceConnectorShape
- Returns:
- segments the segment array.
-
setSegments
Sets the segment cache that will be returned bygetSegments()
.- Parameters:
segments
- the segment array.
-
getWayPoints
Returns the waypoints of the connector shape as an array.- Specified by:
getWayPoints
in interfaceConnectorShape
- Returns:
- waypoints the waypoint array.
-
setWayPoints
Sets the waypoints cache that will be returned bygetWayPoints()
.- Parameters:
waypoints
- the waypoint array.
-