19 #ifndef GEOS_LINEARREF_LOCATIONINDEXEDLINE_H
20 #define GEOS_LINEARREF_LOCATIONINDEXEDLINE_H
22 #include <geos/export.h>
23 #include <geos/geom/Coordinate.h>
24 #include <geos/geom/Geometry.h>
25 #include <geos/geom/Lineal.h>
26 #include <geos/linearref/LinearLocation.h>
27 #include <geos/linearref/LocationIndexOfPoint.h>
28 #include <geos/linearref/LocationIndexOfLine.h>
29 #include <geos/util/IllegalArgumentException.h>
40 class GEOS_DLL LocationIndexedLine
43 const geom::Geometry *linearGeom;
45 void checkGeometryType()
47 if ( !
dynamic_cast<const geom::Lineal*
>(linearGeom) )
48 throw util::IllegalArgumentException(
"Input geometry must be linear");
60 LocationIndexedLine(
const geom::Geometry *linearGeom)
61 : linearGeom(linearGeom)
79 geom::Coordinate extractPoint(
const LinearLocation& index)
const
81 return index.getCoordinate(linearGeom);
103 geom::Coordinate extractPoint(
const LinearLocation& index,
104 double offsetDistance)
const
106 geom::Coordinate ret;
107 index.getSegment(linearGeom)->pointAlongOffset(
108 index.getSegmentFraction(), offsetDistance, ret
149 return LocationIndexOfPoint::indexOf(linearGeom, pt);
179 return LocationIndexOfPoint::indexOfAfter(linearGeom, pt, &minIndex);
212 return LocationIndexOfPoint::indexOf(linearGeom, pt);
221 LinearLocation getStartIndex()
const
223 return LinearLocation();
244 bool isValidIndex(
const LinearLocation& index)
const
246 return index.isValid(linearGeom);
257 LinearLocation clampIndex(
const LinearLocation& index)
const
260 loc.
clamp(linearGeom);