Class LinearComponentExtracter

  • All Implemented Interfaces:
    GeometryComponentFilter

    public class LinearComponentExtracter
    extends java.lang.Object
    implements GeometryComponentFilter
    Extracts all the 1-dimensional (LineString) components from a Geometry. For polygonal geometries, this will extract all the component LinearRings. If desired, LinearRings can be forced to be returned as LineStrings.
    Version:
    1.7
    • Constructor Summary

      Constructors 
      Constructor Description
      LinearComponentExtracter​(java.util.Collection lines)
      Constructs a LineExtracterFilter with a list in which to store LineStrings found.
      LinearComponentExtracter​(java.util.Collection lines, boolean isForcedToLineString)
      Constructs a LineExtracterFilter with a list in which to store LineStrings found.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void filter​(Geometry geom)
      Performs an operation with or on geom.
      static Geometry getGeometry​(Geometry geom)
      Extracts the linear components from a single Geometry and returns them as either a LineString or MultiLineString.
      static Geometry getGeometry​(Geometry geom, boolean forceToLineString)
      Extracts the linear components from a single Geometry and returns them as either a LineString or MultiLineString.
      static java.util.Collection getLines​(java.util.Collection geoms, java.util.Collection lines)
      Extracts the linear components from a single Geometry and adds them to the provided Collection.
      static java.util.Collection getLines​(java.util.Collection geoms, java.util.Collection lines, boolean forceToLineString)
      Extracts the linear components from a single Geometry and adds them to the provided Collection.
      static java.util.List getLines​(Geometry geom)
      Extracts the linear components from a single geometry.
      static java.util.List getLines​(Geometry geom, boolean forceToLineString)
      Extracts the linear components from a single geometry.
      static java.util.Collection getLines​(Geometry geom, java.util.Collection lines)
      Extracts the linear components from a single Geometry and adds them to the provided Collection.
      static java.util.Collection getLines​(Geometry geom, java.util.Collection lines, boolean forceToLineString)
      Extracts the linear components from a single Geometry and adds them to the provided Collection.
      void setForceToLineString​(boolean isForcedToLineString)
      Indicates that LinearRing components should be converted to pure LineStrings.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LinearComponentExtracter

        public LinearComponentExtracter​(java.util.Collection lines)
        Constructs a LineExtracterFilter with a list in which to store LineStrings found.
      • LinearComponentExtracter

        public LinearComponentExtracter​(java.util.Collection lines,
                                        boolean isForcedToLineString)
        Constructs a LineExtracterFilter with a list in which to store LineStrings found.
    • Method Detail

      • getLines

        public static java.util.Collection getLines​(java.util.Collection geoms,
                                                    java.util.Collection lines)
        Extracts the linear components from a single Geometry and adds them to the provided Collection.
        Parameters:
        geoms - the collection of geometries from which to extract linear components
        lines - the collection to add the extracted linear components to
        Returns:
        the collection of linear components (LineStrings or LinearRings)
      • getLines

        public static java.util.Collection getLines​(java.util.Collection geoms,
                                                    java.util.Collection lines,
                                                    boolean forceToLineString)
        Extracts the linear components from a single Geometry and adds them to the provided Collection.
        Parameters:
        geoms - the Collection of geometries from which to extract linear components
        lines - the collection to add the extracted linear components to
        forceToLineString - true if LinearRings should be converted to LineStrings
        Returns:
        the collection of linear components (LineStrings or LinearRings)
      • getLines

        public static java.util.Collection getLines​(Geometry geom,
                                                    java.util.Collection lines)
        Extracts the linear components from a single Geometry and adds them to the provided Collection.
        Parameters:
        geom - the geometry from which to extract linear components
        lines - the Collection to add the extracted linear components to
        Returns:
        the Collection of linear components (LineStrings or LinearRings)
      • getLines

        public static java.util.Collection getLines​(Geometry geom,
                                                    java.util.Collection lines,
                                                    boolean forceToLineString)
        Extracts the linear components from a single Geometry and adds them to the provided Collection.
        Parameters:
        geom - the geometry from which to extract linear components
        lines - the Collection to add the extracted linear components to
        forceToLineString - true if LinearRings should be converted to LineStrings
        Returns:
        the Collection of linear components (LineStrings or LinearRings)
      • getLines

        public static java.util.List getLines​(Geometry geom)
        Extracts the linear components from a single geometry. If more than one geometry is to be processed, it is more efficient to create a single LinearComponentExtracter instance and pass it to multiple geometries.
        Parameters:
        geom - the geometry from which to extract linear components
        Returns:
        the list of linear components
      • getLines

        public static java.util.List getLines​(Geometry geom,
                                              boolean forceToLineString)
        Extracts the linear components from a single geometry. If more than one geometry is to be processed, it is more efficient to create a single LinearComponentExtracter instance and pass it to multiple geometries.
        Parameters:
        geom - the geometry from which to extract linear components
        forceToLineString - true if LinearRings should be converted to LineStrings
        Returns:
        the list of linear components
      • getGeometry

        public static Geometry getGeometry​(Geometry geom)
        Extracts the linear components from a single Geometry and returns them as either a LineString or MultiLineString.
        Parameters:
        geom - the geometry from which to extract
        Returns:
        a linear geometry
      • getGeometry

        public static Geometry getGeometry​(Geometry geom,
                                           boolean forceToLineString)
        Extracts the linear components from a single Geometry and returns them as either a LineString or MultiLineString.
        Parameters:
        geom - the geometry from which to extract
        forceToLineString - true if LinearRings should be converted to LineStrings
        Returns:
        a linear geometry
      • setForceToLineString

        public void setForceToLineString​(boolean isForcedToLineString)
        Indicates that LinearRing components should be converted to pure LineStrings.
        Parameters:
        isForcedToLineString - true if LinearRings should be converted to LineStrings