GEOS  3.3.3
LengthLocationMap.h
1 /**********************************************************************
2  * $Id: LengthLocationMap.h 2809 2009-12-06 01:05:24Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
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 rev. 1.10
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 
28 namespace geos
29 {
30 namespace linearref // geos::linearref
31 {
32 
40 {
41 
42 
43 private:
44  const geom::Geometry *linearGeom;
45 
46  LinearLocation getLocationForward(double length) const;
47 
48 public:
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 
62  static LinearLocation getLocation(const geom::Geometry *linearGeom, double length);
63 
72  static double getLength(const geom::Geometry *linearGeom, const LinearLocation& loc);
73 
74  LengthLocationMap(const geom::Geometry *linearGeom);
75 
84  LinearLocation getLocation(double length) const;
85 
86  double getLength(const LinearLocation& loc) const;
87 
88 };
89 }
90 }
91 #endif