Class AbstractLinePathConnector

Direct Known Subclasses:
InteriorAngleLinePathConnector

public abstract class AbstractLinePathConnector extends AbstractPathConnector<AbstractLinePathConnector.ConnectableLineSubset>
Abstract class for joining collections of line subsets into connected paths. This class is not thread-safe.
  • Constructor Details

    • AbstractLinePathConnector

      public AbstractLinePathConnector()
  • Method Details

    • add

      public void add(LineConvexSubset subset)
      Add a line subset to the connector, leaving it unconnected until a later call to to connect(Iterable) or connectAll().
      Parameters:
      subset - line subset to add
      See Also:
    • add

      public void add(Iterable<? extends LineConvexSubset> subsets)
      Add a collection of line subsets to the connector, leaving them unconnected until a later call to connect(Iterable) or connectAll().
      Parameters:
      subsets - line subsets to add
      See Also:
    • connect

      public void connect(Iterable<? extends LineConvexSubset> subsets)
      Add a collection of line subsets to the connector and attempt to connect each new line subset with existing subsets. Connections made at this time will not be overwritten by subsequent calls to this or other connection methods. (eg, connectAll()).

      The connector is not reset by this call. Additional line subsets can still be added to the current set of paths.

      Parameters:
      subsets - line subsets to connect
      See Also:
    • connectAll

      public List<LinePath> connectAll(Iterable<LineConvexSubset> subsets)
      Add the given line subsets to this instance and connect all current subsets into connected paths. This call is equivalent to
            connector.add(subsets);
            List<LinePath> result = connector.connectAll();
       

      The connector is reset after this call. Further calls to add or connect line subsets will result in new paths being generated.

      Parameters:
      subsets - line subsets to add
      Returns:
      the connected 2D paths
      See Also:
    • connectAll

      public List<LinePath> connectAll()
      Connect all current line subsets into connected paths, returning the result as a list of line paths.

      The connector is reset after this call. Further calls to add or connect line subsets will result in new paths being generated.

      Returns:
      the connected 2D paths
    • toPath

      Convert the linked list of path elements starting at the argument into a LinePath.
      Parameters:
      root - root of a connected path linked list
      Returns:
      a line path representing the linked list path