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
  • Field Details

  • Constructor Details

    • AbstractConnector

      public AbstractConnector()
  • Method Details

    • getShape

      public java.awt.Shape getShape()
      Returns the connector shape.
      Specified by:
      getShape in interface ConnectorShape
      Returns:
      shape the shape.
    • calculateShape

      protected abstract java.awt.Shape calculateShape​(ConnectorShape.Segment[] segments)
      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 interface ConnectorShape
      Parameters:
      startGap - the double.
      endGap - the double.
    • setShape

      protected void setShape​(java.awt.Shape shape)
      Sets the shape cache that will be returned by getShape().
      Parameters:
      shape - the shape.
    • getSegments

      public ConnectorShape.Segment[] getSegments()
      Returns the segments of the connector shape as an array.
      Specified by:
      getSegments in interface ConnectorShape
      Returns:
      segments the segment array.
    • setSegments

      protected void setSegments​(ConnectorShape.Segment[] segments)
      Sets the segment cache that will be returned by getSegments().
      Parameters:
      segments - the segment array.
    • getWayPoints

      public ConnectorShape.WayPoint[] getWayPoints()
      Returns the waypoints of the connector shape as an array.
      Specified by:
      getWayPoints in interface ConnectorShape
      Returns:
      waypoints the waypoint array.
    • setWayPoints

      public void setWayPoints​(ConnectorShape.WayPoint[] waypoints)
      Sets the waypoints cache that will be returned by getWayPoints().
      Parameters:
      waypoints - the waypoint array.