Class GeometryLocation
- java.lang.Object
-
- org.locationtech.jts.operation.distance.GeometryLocation
-
public class GeometryLocation extends java.lang.Object
Represents the location of a point on a Geometry. Maintains both the actual point location (which may not be exact, if the point is not a vertex) as well as information about the component and segment index where the point occurs. Locations inside area Geometrys will not have an associated segment index, so in this case the segment index will have the sentinel value ofINSIDE_AREA
.- Version:
- 1.7
-
-
Field Summary
Fields Modifier and Type Field Description static int
INSIDE_AREA
A special value of segmentIndex used for locations inside area geometries.
-
Constructor Summary
Constructors Constructor Description GeometryLocation(Geometry component, int segIndex, Coordinate pt)
Constructs a GeometryLocation specifying a point on a geometry, as well as the segment that the point is on (orINSIDE_AREA
if the point is not on a segment).GeometryLocation(Geometry component, Coordinate pt)
Constructs a GeometryLocation specifying a point inside an area geometry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Coordinate
getCoordinate()
Returns theCoordinate
of this location.Geometry
getGeometryComponent()
Returns the geometry component on (or in) which this location occurs.int
getSegmentIndex()
Returns the segment index for this location.boolean
isInsideArea()
Tests whether this location represents a point inside an area geometry.java.lang.String
toString()
-
-
-
Field Detail
-
INSIDE_AREA
public static final int INSIDE_AREA
A special value of segmentIndex used for locations inside area geometries. These locations are not located on a segment, and thus do not have an associated segment index.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GeometryLocation
public GeometryLocation(Geometry component, int segIndex, Coordinate pt)
Constructs a GeometryLocation specifying a point on a geometry, as well as the segment that the point is on (orINSIDE_AREA
if the point is not on a segment).- Parameters:
component
- the component of the geometry containing the pointsegIndex
- the segment index of the location, or INSIDE_AREApt
- the coordinate of the location
-
GeometryLocation
public GeometryLocation(Geometry component, Coordinate pt)
Constructs a GeometryLocation specifying a point inside an area geometry.- Parameters:
component
- the component of the geometry containing the pointpt
- the coordinate of the location
-
-
Method Detail
-
getGeometryComponent
public Geometry getGeometryComponent()
Returns the geometry component on (or in) which this location occurs.
-
getSegmentIndex
public int getSegmentIndex()
Returns the segment index for this location. If the location is inside an area, the index will have the valueINSIDE_AREA
;- Returns:
- the segment index for the location, or INSIDE_AREA
-
getCoordinate
public Coordinate getCoordinate()
Returns theCoordinate
of this location.
-
isInsideArea
public boolean isInsideArea()
Tests whether this location represents a point inside an area geometry.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-