GEOS 3.11.1
LengthLocationMap.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
7 * Copyright (C) 2005-2006 Refractions Research Inc.
8 * Copyright (C) 2001-2002 Vivid Solutions Inc.
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 **********************************************************************
16 *
17 * Last port: linearref/LengthLocationMap.java r463
18 *
19 **********************************************************************/
20
21#pragma once
22
23#include <geos/geom/Coordinate.h>
24#include <geos/geom/Geometry.h>
25#include <geos/linearref/LinearLocation.h>
26
27namespace geos {
28namespace linearref { // geos::linearref
29
38
39
40private:
41 const geom::Geometry* linearGeom;
42
43 LinearLocation getLocationForward(double length) const;
44
45 LinearLocation resolveHigher(const LinearLocation& loc) const;
46
47public:
48
49 // TODO: cache computed cumulative length for each vertex
50 // TODO: support user-defined measures
51 // TODO: support measure index for fast mapping to a location
52
62 static LinearLocation
63 getLocation(const geom::Geometry* linearGeom, double length)
64 {
65 LengthLocationMap locater(linearGeom);
66 return locater.getLocation(length);
67 }
68
80 static LinearLocation
81 getLocation(const geom::Geometry* linearGeom, double length, bool resolveLower)
82 {
83 LengthLocationMap locater(linearGeom);
84 return locater.getLocation(length, resolveLower);
85 }
86
95 static double getLength(const geom::Geometry* linearGeom, const LinearLocation& loc);
96
97 LengthLocationMap(const geom::Geometry* linearGeom);
98
113 LinearLocation getLocation(double length, bool resolveLower) const;
114
126 LinearLocation getLocation(double length) const;
127
128 double getLength(const LinearLocation& loc) const;
129
130};
131
132} // geos.linearref
133} // geos
134
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
Computes the LinearLocation for a given length along a linear Geometry.
Definition: LengthLocationMap.h:37
static LinearLocation getLocation(const geom::Geometry *linearGeom, double length, bool resolveLower)
Computes the LinearLocation for a given length along a linear [Geometry].
Definition: LengthLocationMap.h:81
static double getLength(const geom::Geometry *linearGeom, const LinearLocation &loc)
static LinearLocation getLocation(const geom::Geometry *linearGeom, double length)
Computes the LinearLocation for a given length along a linear Geometry.
Definition: LengthLocationMap.h:63
LinearLocation getLocation(double length) const
Compute the LinearLocation corresponding to a length.
LinearLocation getLocation(double length, bool resolveLower) const
Compute the LinearLocation corresponding to a length.
Represents a location along a LineString or MultiLineString.
Definition: LinearLocation.h:43
Basic namespace for all GEOS functionalities.
Definition: geos.h:39