Package org.locationtech.jts.geom.util
Class LinearComponentExtracter
java.lang.Object
org.locationtech.jts.geom.util.LinearComponentExtracter
- All Implemented Interfaces:
GeometryComponentFilter
Extracts all the 1-dimensional (
LineString
) components from a Geometry
.
For polygonal geometries, this will extract all the component LinearRing
s.
If desired, LinearRing
s can be forced to be returned as LineString
s.- Version:
- 1.7
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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
Modifier and TypeMethodDescriptionvoid
Performs an operation with or on a geometry component.static Geometry
getGeometry
(Geometry geom) Extracts the linear components from a singleGeometry
and returns them as either aLineString
orMultiLineString
.static Geometry
getGeometry
(Geometry geom, boolean forceToLineString) Extracts the linear components from a singleGeometry
and returns them as either aLineString
orMultiLineString
.static Collection
getLines
(Collection geoms, Collection lines) Extracts the linear components from a singleGeometry
and adds them to the providedCollection
.static Collection
getLines
(Collection geoms, Collection lines, boolean forceToLineString) Extracts the linear components from a singleGeometry
and adds them to the providedCollection
.static List
Extracts the linear components from a single geometry.static List
Extracts the linear components from a single geometry.static Collection
getLines
(Geometry geom, Collection lines) Extracts the linear components from a singleGeometry
and adds them to the providedCollection
.static Collection
getLines
(Geometry geom, Collection lines, boolean forceToLineString) Extracts the linear components from a singleGeometry
and adds them to the providedCollection
.void
setForceToLineString
(boolean isForcedToLineString) Indicates that LinearRing components should be converted to pure LineStrings.
-
Constructor Details
-
LinearComponentExtracter
Constructs a LineExtracterFilter with a list in which to store LineStrings found. -
LinearComponentExtracter
Constructs a LineExtracterFilter with a list in which to store LineStrings found.
-
-
Method Details
-
getLines
Extracts the linear components from a singleGeometry
and 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
Extracts the linear components from a singleGeometry
and 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
Extracts the linear components from a singleGeometry
and 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
Extracts the linear components from a singleGeometry
and 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
Extracts the linear components from a single geometry. If more than one geometry is to be processed, it is more efficient to create a singleLinearComponentExtracter
instance and pass it to multiple geometries.- Parameters:
geom
- the geometry from which to extract linear components- Returns:
- the list of linear components
-
getLines
Extracts the linear components from a single geometry. If more than one geometry is to be processed, it is more efficient to create a singleLinearComponentExtracter
instance 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
Extracts the linear components from a singleGeometry
and returns them as either aLineString
orMultiLineString
.- Parameters:
geom
- the geometry from which to extract- Returns:
- a linear geometry
-
getGeometry
Extracts the linear components from a singleGeometry
and returns them as either aLineString
orMultiLineString
.- 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
Description copied from interface:GeometryComponentFilter
Performs an operation with or on a geometry component.- Specified by:
filter
in interfaceGeometryComponentFilter
- Parameters:
geom
- a component of the geometry to which the filter is applied.
-