GEOS  3.4.2
LengthIndexedLine.h
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/LengthIndexedLine.java r463
00018  *
00019  **********************************************************************/
00020 
00021 #ifndef GEOS_LINEARREF_LENGTHINDEXEDLINE_H
00022 #define GEOS_LINEARREF_LENGTHINDEXEDLINE_H
00023 
00024 #include <geos/export.h>
00025 #include <geos/geom/Coordinate.h>
00026 #include <geos/geom/Geometry.h>
00027 #include <geos/linearref/LinearLocation.h>
00028 
00029 namespace geos
00030 {
00031 namespace linearref   // geos::linearref
00032 {
00033 
00045 class GEOS_DLL LengthIndexedLine
00046 {
00047 private:
00048         const geom::Geometry *linearGeom;
00049         LinearLocation locationOf(double index) const;
00050         LinearLocation locationOf(double index, bool resolveLower) const;
00051         double positiveIndex(double index) const;
00052 
00053 public:
00054 
00062         LengthIndexedLine(const geom::Geometry *linearGeom);
00063 
00075         geom::Coordinate extractPoint(double index) const;
00076 
00077 
00096         geom::Coordinate extractPoint(double index, double offsetDistance) const;
00097 
00108         geom::Geometry *extractLine(double startIndex, double endIndex) const;
00109 
00110 
00128         double indexOf(const geom::Coordinate& pt) const;
00129 
00152         double indexOfAfter(const geom::Coordinate& pt, double minIndex) const;
00153 
00163         double* indicesOf(const geom::Geometry *subLine) const;
00164 
00165 
00175         double project(const geom::Coordinate& pt) const;
00176 
00181         double getStartIndex() const;
00182 
00187         double getEndIndex() const;
00188 
00195         bool isValidIndex(double index) const;
00196 
00197 
00204         double clampIndex(double index) const;
00205 };
00206 }
00207 }
00208 #endif