GEOS  3.8.0dev
DelaunayTriangulationBuilder.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2012 Excensus LLC.
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************
14  *
15  * Last port: triangulate/DelaunayTriangulationBuilder.java r524
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_TRIANGULATE_DELAUNAYTRIANGULATIONBUILDER_H
20 #define GEOS_TRIANGULATE_DELAUNAYTRIANGULATIONBUILDER_H
21 
22 #include <geos/triangulate/IncrementalDelaunayTriangulator.h>
23 #include <geos/geom/CoordinateSequence.h>
24 
25 #include <memory>
26 
27 namespace geos {
28 namespace geom {
29 class Geometry;
30 class MultiLineString;
31 class GeometryCollection;
32 class GeometryFactory;
33 class Envelope;
34 }
35 namespace triangulate {
36 namespace quadedge {
37 class QuadEdgeSubdivision;
38 }
39 }
40 }
41 
42 namespace geos {
43 namespace triangulate { //geos.triangulate
44 
45 
56 public:
64  static std::unique_ptr<geom::CoordinateSequence> extractUniqueCoordinates(const geom::Geometry& geom);
65 
73  static IncrementalDelaunayTriangulator::VertexList toVertices(const geom::CoordinateSequence& coords);
74 
80  static std::unique_ptr<geom::CoordinateSequence> unique(const geom::CoordinateSequence* seq);
81 
82 private:
83  std::unique_ptr<geom::CoordinateSequence> siteCoords;
84  double tolerance;
85  std::unique_ptr<quadedge::QuadEdgeSubdivision> subdiv;
86 
87 public:
93 
94  ~DelaunayTriangulationBuilder() = default;
95 
102  void setSites(const geom::Geometry& geom);
103 
110  void setSites(const geom::CoordinateSequence& coords);
111 
119  inline void
120  setTolerance(double p_tolerance)
121  {
122  this->tolerance = p_tolerance;
123  }
124 
125 private:
126  void create();
127 
128 public:
134  quadedge::QuadEdgeSubdivision& getSubdivision();
135 
142  std::unique_ptr<geom::MultiLineString> getEdges(const geom::GeometryFactory& geomFact);
143 
151  std::unique_ptr<geom::GeometryCollection> getTriangles(const geom::GeometryFactory& geomFact);
152 
161  static geom::Envelope envelope(const geom::CoordinateSequence& coords);
162 
163 };
164 
165 } //namespace geos.triangulate
166 } //namespace goes
167 
168 #endif //GEOS_TRIANGULATE_QUADEDGE_DELAUNAYTRIANGULATIONBUILDER_H
169 
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Definition: DelaunayTriangulationBuilder.h:55
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:66
A class that contains the QuadEdges representing a planar subdivision that models a triangulation...
Definition: QuadEdgeSubdivision.h:78
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
void setTolerance(double p_tolerance)
Definition: DelaunayTriangulationBuilder.h:120