GEOS
3.6.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2012 Excensus LLC. 00007 * 00008 * This is free software; you can redistribute and/or modify it under 00009 * the terms of the GNU Lesser General Licence as published 00010 * by the Free Software Foundation. 00011 * See the COPYING file for more information. 00012 * 00013 ********************************************************************** 00014 * 00015 * Last port: triangulate/DelaunayTriangulationBuilder.java r524 00016 * 00017 **********************************************************************/ 00018 00019 #ifndef GEOS_TRIANGULATE_DELAUNAYTRIANGULATIONBUILDER_H 00020 #define GEOS_TRIANGULATE_DELAUNAYTRIANGULATIONBUILDER_H 00021 00022 #include <geos/triangulate/IncrementalDelaunayTriangulator.h> 00023 00024 00025 namespace geos { 00026 namespace geom{ 00027 class CoordinateSequence; 00028 class Geometry; 00029 class MultiLineString; 00030 class GeometryCollection; 00031 class GeometryFactory; 00032 class Envelope; 00033 } 00034 namespace triangulate { 00035 namespace quadedge { 00036 class QuadEdgeSubdivision; 00037 } 00038 } 00039 } 00040 00041 namespace geos { 00042 namespace triangulate { //geos.triangulate 00043 00044 00054 class GEOS_DLL DelaunayTriangulationBuilder 00055 { 00056 public: 00062 static geom::CoordinateSequence* extractUniqueCoordinates(const geom::Geometry& geom); 00063 00064 static void unique(geom::CoordinateSequence& coords); 00065 00071 static IncrementalDelaunayTriangulator::VertexList* toVertices(const geom::CoordinateSequence &coords); 00072 00073 private: 00074 geom::CoordinateSequence* siteCoords; 00075 double tolerance; 00076 quadedge::QuadEdgeSubdivision *subdiv; 00077 00078 public: 00083 DelaunayTriangulationBuilder(); 00084 00085 ~DelaunayTriangulationBuilder(); 00086 00093 void setSites(const geom::Geometry& geom); 00094 00101 void setSites(const geom::CoordinateSequence& coords); 00102 00110 inline void setTolerance(double tolerance) 00111 { 00112 this->tolerance = tolerance; 00113 } 00114 00115 private: 00116 void create(); 00117 00118 public: 00124 quadedge::QuadEdgeSubdivision& getSubdivision(); 00125 00132 std::auto_ptr<geom::MultiLineString> getEdges(const geom::GeometryFactory &geomFact); 00133 00141 std::auto_ptr<geom::GeometryCollection> getTriangles(const geom::GeometryFactory& geomFact); 00142 00150 static geom::Envelope envelope(const geom::CoordinateSequence& coords); 00151 00152 }; 00153 00154 } //namespace geos.triangulate 00155 } //namespace goes 00156 00157 #endif //GEOS_TRIANGULATE_QUADEDGE_DELAUNAYTRIANGULATIONBUILDER_H 00158