Class FreeConnectorShape

java.lang.Object
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
  • Constructor Details

    • FreeConnectorShape

      public FreeConnectorShape()
      Constructor for free connector shape.
  • Method Details

    • recalculateShape

      public void recalculateShape​(ConnectorRestrictions restrictions)
      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

      public boolean hasValidWaypoints​(ConnectorRestrictions restrictions)
      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

      private int getNrSegments​(ConnectorRestrictions restrictions)
      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.