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/linearref/LinearLocation.h>
26 #include <geos/linearref/LocationIndexOfPoint.h>
27 #include <geos/linearref/LocationIndexOfLine.h>
28 #include <geos/util/IllegalArgumentException.h>
39 class GEOS_DLL LocationIndexedLine {
41 const geom::Geometry* linearGeom;
46 if(!linearGeom->isLineal()) {
47 throw util::IllegalArgumentException(
"Input geometry must be linear");
60 LocationIndexedLine(
const geom::Geometry* p_linearGeom)
61 : linearGeom(p_linearGeom)
80 extractPoint(
const LinearLocation& index)
const
82 return index.getCoordinate(linearGeom);
105 extractPoint(
const LinearLocation& index,
106 double offsetDistance)
const
109 index.getSegment(linearGeom)->pointAlongOffset(
110 index.getSegmentFraction(), offsetDistance, ret
127 std::unique_ptr<geom::Geometry>
153 return LocationIndexOfPoint::indexOf(linearGeom, pt);
184 return LocationIndexOfPoint::indexOfAfter(linearGeom, pt, &minIndex);
219 return LocationIndexOfPoint::indexOf(linearGeom, pt);
229 getStartIndex()
const
254 isValidIndex(
const LinearLocation& index)
const
256 return index.isValid(linearGeom);
268 clampIndex(
const LinearLocation& index)
const
270 LinearLocation loc = index;
271 loc.clamp(linearGeom);