00001 /********************************************************************** 00002 * $Id: LengthIndexedLine.h 2809 2009-12-06 01:05:24Z mloskot $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 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/LengthIndexedLine.java rev. 1.10 00018 * 00019 **********************************************************************/ 00020 00021 #ifndef GEOS_LINEARREF_LENGTHINDEXEDLINE_H 00022 #define GEOS_LINEARREF_LENGTHINDEXEDLINE_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 { 00030 namespace linearref // geos::linearref 00031 { 00032 00044 class LengthIndexedLine 00045 { 00046 private: 00047 const geom::Geometry *linearGeom; 00048 LinearLocation locationOf(double index) const; 00049 00050 public: 00051 00059 LengthIndexedLine(const geom::Geometry *linearGeom); 00060 00072 geom::Coordinate extractPoint(double index) const; 00073 00074 00091 geom::Coordinate extractPoint(double index, double offsetDistance) const; 00092 00103 geom::Geometry *extractLine(double startIndex, double endIndex) const; 00104 00105 00123 double indexOf(const geom::Coordinate& pt) const; 00124 00147 double indexOfAfter(const geom::Coordinate& pt, double minIndex) const; 00148 00158 double* indicesOf(const geom::Geometry *subLine) const; 00159 00160 00170 double project(const geom::Coordinate& pt) const; 00171 00176 double getStartIndex() const; 00177 00182 double getEndIndex() const; 00183 00190 bool isValidIndex(double index) const; 00191 00192 00199 double clampIndex(double index) const; 00200 }; 00201 } 00202 } 00203 #endif