GEOS  3.8.0dev
Densifier.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2010 Sandro Santilli <strk@kbt.io>
7  * Copyright (C) 2006 Refractions Research Inc.
8  * Copyright (C) 2001-2002 Vivid Solutions Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************
16  *
17  * Last port: operation/polygonize/Polygonizer.java rev. 1.6 (JTS-1.10)
18  *
19  **********************************************************************/
20 
21 #ifndef GEOS_DENSIFIER_H
22 #define GEOS_DENSIFIER_H
23 
24 #include <geos/export.h>
25 #include <geos/geom/Geometry.h>
26 #include <geos/geom/util/GeometryTransformer.h>
27 #include <geos/geom/util/Densifier.h>
28 #include <geos/util/Interrupt.h>
29 
30 #include <vector>
31 
32 #ifdef _MSC_VER
33 #pragma warning(push)
34 /* warning C4251: needs to have dll-interface to be used by */
35 /* clients of class */
36 #pragma warning(disable: 4251)
37 #endif
38 
39 
40 namespace geos {
41 namespace geom {
42 namespace util {
43 
58 class GEOS_DLL Densifier {
59 public:
60  Densifier(const Geometry* inputGeom);
61 
62  Geometry::Ptr densify(const Geometry* geom, double distanceTolerance);
63  void setDistanceTolerance(double distanceTolerance);
64  Geometry::Ptr getResultGeometry() const;
65 
66 private:
67  double distanceTolerance;
68  const Geometry* inputGeom;
69  static std::unique_ptr<Coordinate::Vect> densifyPoints(const Coordinate::Vect pts, double distanceTolerance,
70  const PrecisionModel* precModel);
71 
72  class GEOS_DLL DensifyTransformer: public GeometryTransformer {
73  public:
74  DensifyTransformer(double distanceTolerance);
75  double distanceTolerance;
76  CoordinateSequence::Ptr transformCoordinates(const CoordinateSequence* coords, const Geometry* parent) override;
77  Geometry::Ptr transformPolygon(const Polygon* geom, const Geometry* parent) override;
78  Geometry::Ptr transformMultiPolygon(const MultiPolygon* geom, const Geometry* parent) override;
79  Geometry::Ptr createValidArea(const Geometry* roughAreaGeom);
80  };
81 
82 }; // Densifier
83 
84 } // namespace geos.geom.util
85 } // namespace geos.geom
86 } // namespace geos
87 
88 #ifdef _MSC_VER
89 #pragma warning(pop)
90 #endif
91 
92 #endif // GEOS_DENSIFIER_H
A framework for processes which transform an input Geometry into an output Geometry, possibly changing its structure and type(s).
Definition: GeometryTransformer.h:89
Models a collection of Polygons.
Definition: MultiPolygon.h:59
Specifies the precision model of the Coordinate in a Geometry.
Definition: PrecisionModel.h:87
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Represents a linear polygon, which may include holes.
Definition: Polygon.h:64
Definition: Densifier.h:58
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
std::vector< Coordinate > Vect
A vector of Coordinate objects (real object, not pointers)
Definition: Coordinate.h:77
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
std::unique_ptr< Geometry > Ptr
An unique_ptr of Geometry.
Definition: Geometry.h:201