Package org.locationtech.jts.geom.util
Class LinearComponentExtracter
- java.lang.Object
-
- org.locationtech.jts.geom.util.LinearComponentExtracter
-
- All Implemented Interfaces:
GeometryComponentFilter
public class LinearComponentExtracter extends Object implements GeometryComponentFilter
Extracts all the 1-dimensional (LineString) components from aGeometry. For polygonal geometries, this will extract all the componentLinearRings. If desired,LinearRings can be forced to be returned asLineStrings.- Version:
- 1.7
-
-
Constructor Summary
Constructors Constructor Description LinearComponentExtracter(Collection lines)Constructs a LineExtracterFilter with a list in which to store LineStrings found.LinearComponentExtracter(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 voidfilter(Geometry geom)Performs an operation with or ongeom.static GeometrygetGeometry(Geometry geom)Extracts the linear components from a singleGeometryand returns them as either aLineStringorMultiLineString.static GeometrygetGeometry(Geometry geom, boolean forceToLineString)Extracts the linear components from a singleGeometryand returns them as either aLineStringorMultiLineString.static CollectiongetLines(Collection geoms, Collection lines)Extracts the linear components from a singleGeometryand adds them to the providedCollection.static CollectiongetLines(Collection geoms, Collection lines, boolean forceToLineString)Extracts the linear components from a singleGeometryand adds them to the providedCollection.static ListgetLines(Geometry geom)Extracts the linear components from a single geometry.static ListgetLines(Geometry geom, boolean forceToLineString)Extracts the linear components from a single geometry.static CollectiongetLines(Geometry geom, Collection lines)Extracts the linear components from a singleGeometryand adds them to the providedCollection.static CollectiongetLines(Geometry geom, Collection lines, boolean forceToLineString)Extracts the linear components from a singleGeometryand adds them to the providedCollection.voidsetForceToLineString(boolean isForcedToLineString)Indicates that LinearRing components should be converted to pure LineStrings.
-
-
-
Constructor Detail
-
LinearComponentExtracter
public LinearComponentExtracter(Collection lines)
Constructs a LineExtracterFilter with a list in which to store LineStrings found.
-
LinearComponentExtracter
public LinearComponentExtracter(Collection lines, boolean isForcedToLineString)
Constructs a LineExtracterFilter with a list in which to store LineStrings found.
-
-
Method Detail
-
getLines
public static Collection getLines(Collection geoms, Collection lines)
Extracts the linear components from a singleGeometryand adds them to the providedCollection.- Parameters:
geoms- the collection of geometries from which to extract linear componentslines- the collection to add the extracted linear components to- Returns:
- the collection of linear components (LineStrings or LinearRings)
-
getLines
public static Collection getLines(Collection geoms, Collection lines, boolean forceToLineString)
Extracts the linear components from a singleGeometryand adds them to the providedCollection.- Parameters:
geoms- the Collection of geometries from which to extract linear componentslines- the collection to add the extracted linear components toforceToLineString- true if LinearRings should be converted to LineStrings- Returns:
- the collection of linear components (LineStrings or LinearRings)
-
getLines
public static Collection getLines(Geometry geom, Collection lines)
Extracts the linear components from a singleGeometryand adds them to the providedCollection.- Parameters:
geom- the geometry from which to extract linear componentslines- the Collection to add the extracted linear components to- Returns:
- the Collection of linear components (LineStrings or LinearRings)
-
getLines
public static Collection getLines(Geometry geom, Collection lines, boolean forceToLineString)
Extracts the linear components from a singleGeometryand adds them to the providedCollection.- Parameters:
geom- the geometry from which to extract linear componentslines- the Collection to add the extracted linear components toforceToLineString- true if LinearRings should be converted to LineStrings- Returns:
- the Collection of linear components (LineStrings or LinearRings)
-
getLines
public static 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 singleLinearComponentExtracterinstance 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 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 singleLinearComponentExtracterinstance and pass it to multiple geometries.- Parameters:
geom- the geometry from which to extract linear componentsforceToLineString- 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 singleGeometryand returns them as either aLineStringorMultiLineString.- 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 singleGeometryand returns them as either aLineStringorMultiLineString.- Parameters:
geom- the geometry from which to extractforceToLineString- 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
-
filter
public void filter(Geometry geom)
Description copied from interface:GeometryComponentFilterPerforms an operation with or ongeom.- Specified by:
filterin interfaceGeometryComponentFilter- Parameters:
geom- aGeometryto which the filter is applied.
-
-