GEOS
3.3.9
|
00001 /********************************************************************** 00002 * $Id: LinearGeometryBuilder.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/LinearGeometryBuilder.java rev. 1.1 00018 * 00019 **********************************************************************/ 00020 00021 #ifndef GEOS_LINEARREF_LINEARGEOMETRYBUILDER_H 00022 #define GEOS_LINEARREF_LINEARGEOMETRYBUILDER_H 00023 00024 #include <geos/geom/Coordinate.h> 00025 #include <geos/geom/CoordinateList.h> 00026 #include <geos/geom/Geometry.h> 00027 #include <geos/geom/GeometryFactory.h> 00028 #include <geos/linearref/LinearLocation.h> 00029 00030 #include <vector> 00031 00032 namespace geos 00033 { 00034 namespace linearref // geos::linearref 00035 { 00036 00043 class LinearGeometryBuilder 00044 { 00045 private: 00046 const geom::GeometryFactory* geomFact; 00047 00048 typedef std::vector<geom::Geometry *> GeomPtrVect; 00049 00050 // Geometry elements owned by this class 00051 GeomPtrVect lines; 00052 00053 bool ignoreInvalidLines; 00054 bool fixInvalidLines; 00055 geom::CoordinateSequence* coordList; 00056 00057 geom::Coordinate lastPt; 00058 00059 public: 00060 LinearGeometryBuilder(const geom::GeometryFactory* geomFact); 00061 00062 ~LinearGeometryBuilder(); 00063 00071 void setIgnoreInvalidLines(bool ignoreInvalidLines); 00072 00080 void setFixInvalidLines(bool fixInvalidLines); 00081 00087 void add(const geom::Coordinate& pt); 00088 00094 void add(const geom::Coordinate& pt, bool allowRepeatedPoints); 00095 00097 geom::Coordinate getLastCoordinate() const; 00098 00100 void endLine(); 00101 00102 geom::Geometry *getGeometry(); 00103 }; 00104 00105 } // namespace geos.linearref 00106 } // namespace geos 00107 00108 #endif