GEOS  3.9.0dev
VoronoiDiagramBuilder.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/VoronoiDiagramBuilder.java r524
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_TRIANGULATE_VORONOIDIAGRAMBUILDER_H
20 #define GEOS_TRIANGULATE_VORONOIDIAGRAMBUILDER_H
21 
22 #include <geos/triangulate/quadedge/QuadEdgeSubdivision.h>
23 #include <geos/geom/Envelope.h> // for composition
24 #include <memory>
25 #include <iostream>
26 
27 namespace geos {
28 namespace geom {
29 class Geometry;
30 class CoordinateSequence;
31 class GeometryCollection;
32 class GeometryFactory;
33 }
34 namespace triangulate { //geos.triangulate
35 
46 class GEOS_DLL VoronoiDiagramBuilder {
47 public:
53 
54  ~VoronoiDiagramBuilder() = default;
55 
62  void setSites(const geom::Geometry& geom);
63 
70  void setSites(const geom::CoordinateSequence& coords);
71 
82  void setClipEnvelope(const geom::Envelope* clipEnv);
83 
92  void setTolerance(double tolerance);
93 
99  std::unique_ptr<quadedge::QuadEdgeSubdivision> getSubdivision();
100 
108  std::unique_ptr<geom::GeometryCollection> getDiagram(const geom::GeometryFactory& geomFact);
109 
117  std::unique_ptr<geom::Geometry> getDiagramEdges(const geom::GeometryFactory& geomFact);
118 
119 private:
120 
121  std::unique_ptr<geom::CoordinateSequence> siteCoords;
122  double tolerance;
123  std::unique_ptr<quadedge::QuadEdgeSubdivision> subdiv;
124  const geom::Envelope* clipEnv; // externally owned
125  geom::Envelope diagramEnv;
126 
127  void create();
128 
129  static std::unique_ptr<geom::GeometryCollection>
130  clipGeometryCollection(std::vector<std::unique_ptr<geom::Geometry>> & geoms, const geom::Envelope& clipEnv);
131 
132 };
133 
134 } //namespace geos.triangulate
135 } //namespace geos
136 
137 #endif //GEOS_TRIANGULATE_VORONOIDIAGRAMBUILDER_H
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
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:68
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
A utility class which creates Voronoi Diagrams from collections of points.
Definition: VoronoiDiagramBuilder.h:46
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58