GEOS 3.9.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#ifndef GEOS_LINEARREF_LENGTHLOCATIONMAP_H
22#define GEOS_LINEARREF_LENGTHLOCATIONMAP_H
23
24#include <geos/geom/Coordinate.h>
25#include <geos/geom/Geometry.h>
26#include <geos/linearref/LinearLocation.h>
27
28namespace geos {
29namespace linearref { // geos::linearref
30
39
40
41private:
42 const geom::Geometry* linearGeom;
43
44 LinearLocation getLocationForward(double length) const;
45
46 LinearLocation resolveHigher(const LinearLocation& loc) const;
47
48public:
49
50 // TODO: cache computed cumulative length for each vertex
51 // TODO: support user-defined measures
52 // TODO: support measure index for fast mapping to a location
53
63 static LinearLocation
64 getLocation(const geom::Geometry* linearGeom, double length)
65 {
66 LengthLocationMap locater(linearGeom);
67 return locater.getLocation(length);
68 }
69
81 static LinearLocation
82 getLocation(const geom::Geometry* linearGeom, double length, bool resolveLower)
83 {
84 LengthLocationMap locater(linearGeom);
85 return locater.getLocation(length, resolveLower);
86 }
87
96 static double getLength(const geom::Geometry* linearGeom, const LinearLocation& loc);
97
98 LengthLocationMap(const geom::Geometry* linearGeom);
99
114 LinearLocation getLocation(double length, bool resolveLower) const;
115
127 LinearLocation getLocation(double length) const;
128
129 double getLength(const LinearLocation& loc) const;
130
131};
132
133} // geos.linearref
134} // geos
135
136#endif
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Computes the LinearLocation for a given length along a linear Geometry.
Definition: LengthLocationMap.h:38
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:82
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:64
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:44
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26