GEOS: GeometryPrecisionReducer.h Source File

GEOS 3.5.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

GeometryPrecisionReducer.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2012 Sandro Santilli <strk@keybit.net>
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 ***********************************************************************
14 *
15 * Last port: precision/GeometryPrecisionReducer.cpp rev. 1.10 (JTS-1.7)
16 *
17 **********************************************************************/
18
19 #ifndef GEOS_PRECISION_GEOMETRYPRECISIONREDUCER_H
20 #define GEOS_PRECISION_GEOMETRYPRECISIONREDUCER_H
21
22 #include <geos/export.h>
23 #include <memory> // for auto_ptr
24
25 // Forward declarations
26 namespace geos {
27 namespace geom {
28 class PrecisionModel;
29 class GeometryFactory;
30 class Geometry;
31 }
32 }
33
34 namespace geos {
35 namespace precision { // geos.precision
36
42 class GEOS_DLL GeometryPrecisionReducer {
43
44 private:
45
46 // Externally owned
47 const geom::GeometryFactory *newFactory;
48
49 const geom::PrecisionModel &targetPM;
50
51 bool removeCollapsed;
52
53 bool isPointwise;
54
55 std::auto_ptr<geom::Geometry> reducePointwise( const geom::Geometry& geom );
56
57 std::auto_ptr<geom::Geometry> fixPolygonalTopology(
58 const geom::Geometry& geom );
59
60 std::auto_ptr<geom::GeometryFactory> createFactory(
61 const geom::GeometryFactory& oldGF,
62 const geom::PrecisionModel& newPM );
63
64 GeometryPrecisionReducer(GeometryPrecisionReducer const&); /*= delete*/
65 GeometryPrecisionReducer& operator=(GeometryPrecisionReducer const&); /*= delete*/
66
67 public:
68
80 static std::auto_ptr<geom::Geometry> reduce(
81 const geom::Geometry &g,
82 const geom::PrecisionModel &precModel )
83 {
84 GeometryPrecisionReducer reducer(precModel);
85 return reducer.reduce(g);
86 }
87
99 static std::auto_ptr<geom::Geometry> reducePointwise(
100 const geom::Geometry &g,
101 const geom::PrecisionModel &precModel )
102 {
103 GeometryPrecisionReducer reducer(precModel);
104 reducer.setPointwise(true);
105 return reducer.reduce(g);
106 }
107
108 GeometryPrecisionReducer(const geom::PrecisionModel &pm)
109 :
110 newFactory(0),
111 targetPM(pm),
112 removeCollapsed(true),
113 isPointwise(false)
114 {}
115
126 GeometryPrecisionReducer(const geom::GeometryFactory &gf);
127
135 void setRemoveCollapsedComponents(bool remove) {
136 removeCollapsed = remove;
137 }
138
150 void setPointwise(bool pointwise)
151 {
152 isPointwise = pointwise;
153 }
154
155 std::auto_ptr<geom::Geometry> reduce(const geom::Geometry& geom);
156
157 };
158
159 } // namespace geos.precision
160 } // namespace geos
161
162 #endif // GEOS_PRECISION_GEOMETRYPRECISIONREDUCER_H
geos::precision::GeometryPrecisionReducer::reducePointwise
static std::auto_ptr< geom::Geometry > reducePointwise(const geom::Geometry &g, const geom::PrecisionModel &precModel)
Definition: GeometryPrecisionReducer.h:99
geos::precision::GeometryPrecisionReducer::setRemoveCollapsedComponents
void setRemoveCollapsedComponents(bool remove)
Definition: GeometryPrecisionReducer.h:135
geos::geom::PrecisionModel
Specifies the precision model of the Coordinate in a Geometry.
Definition: PrecisionModel.h:87
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:167
geos::geom::GeometryFactory
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
geos::precision::GeometryPrecisionReducer
Reduces the precision of a Geometry according to the supplied PrecisionModel, ensuring that the resul...
Definition: GeometryPrecisionReducer.h:42
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::precision::GeometryPrecisionReducer::reduce
static std::auto_ptr< geom::Geometry > reduce(const geom::Geometry &g, const geom::PrecisionModel &precModel)
Definition: GeometryPrecisionReducer.h:80
geos::precision::GeometryPrecisionReducer::setPointwise
void setPointwise(bool pointwise)
Sets whether the precision reduction will be done in pointwise fashion only.
Definition: GeometryPrecisionReducer.h:150