GEOS
3.6.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2011 Sandro Santilli <strk@keybit.net> 00007 * Copyright (C) 2005-2006 Refractions Research Inc. 00008 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00009 * 00010 * This is free software; you can redistribute and/or modify it under 00011 * the terms of the GNU Lesser General Public Licence as published 00012 * by the Free Software Foundation. 00013 * See the COPYING file for more information. 00014 * 00015 ********************************************************************** 00016 * 00017 * Last port: linearref/LengthLocationMap.java r463 00018 * 00019 **********************************************************************/ 00020 00021 #ifndef GEOS_LINEARREF_LENGTHLOCATIONMAP_H 00022 #define GEOS_LINEARREF_LENGTHLOCATIONMAP_H 00023 00024 #include <geos/geom/Coordinate.h> 00025 #include <geos/geom/Geometry.h> 00026 #include <geos/linearref/LinearLocation.h> 00027 00028 namespace geos { 00029 namespace linearref { // geos::linearref 00030 00037 class LengthLocationMap 00038 { 00039 00040 00041 private: 00042 const geom::Geometry *linearGeom; 00043 00044 LinearLocation getLocationForward(double length) const; 00045 00046 LinearLocation resolveHigher(const LinearLocation& loc) const; 00047 00048 public: 00049 00050 // TODO: cache computed cumulative length for each vertex 00051 // TODO: support user-defined measures 00052 // TODO: support measure index for fast mapping to a location 00053 00063 static LinearLocation getLocation(const geom::Geometry *linearGeom, double length) 00064 { 00065 LengthLocationMap locater(linearGeom); 00066 return locater.getLocation(length); 00067 } 00068 00080 static LinearLocation getLocation(const geom::Geometry *linearGeom, double length, bool resolveLower) 00081 { 00082 LengthLocationMap locater(linearGeom); 00083 return locater.getLocation(length, resolveLower); 00084 } 00085 00094 static double getLength(const geom::Geometry *linearGeom, const LinearLocation& loc); 00095 00096 LengthLocationMap(const geom::Geometry *linearGeom); 00097 00110 LinearLocation getLocation(double length, bool resolveLower) const; 00111 00123 LinearLocation getLocation(double length) const; 00124 00125 double getLength(const LinearLocation& loc) const; 00126 00127 }; 00128 00129 } // geos.linearref 00130 } // geos 00131 00132 #endif