GEOS 3.11.1
PrecisionReducerTransformer.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2021 Paul Ramsey <pramsey@cleverelephant.ca>
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#pragma once
16
17#include <geos/export.h>
18#include <memory>
19
20#include <geos/geom/util/GeometryTransformer.h>
21
22// Forward declarations
23namespace geos {
24namespace geom {
25class PrecisionModel;
26class Geometry;
27}
28}
29
30namespace geos {
31namespace precision { // geos.precision
32
47
48private:
49
50 const geom::PrecisionModel& targetPM;
51 bool isRemoveCollapsed;
52
53 std::unique_ptr<geom::Geometry> reduceArea(const geom::Geometry* geom);
54
55 void extend(
56 std::vector<geom::Coordinate>& coords,
57 std::size_t minLength);
58
59
60public:
61
63 const geom::PrecisionModel& p_targetPM,
64 bool p_isRemoveCollapsed = false)
65 : targetPM(p_targetPM)
66 , isRemoveCollapsed(p_isRemoveCollapsed)
67 {};
68
69 static std::unique_ptr<geom::Geometry> reduce(
70 const geom::Geometry& geom,
71 const geom::PrecisionModel& targetPM,
72 bool isRemoveCollapsed = false);
73
74
75protected:
76
77 std::unique_ptr<geom::CoordinateSequence> transformCoordinates(
78 const geom::CoordinateSequence* coords,
79 const geom::Geometry* parent) override;
80
81 std::unique_ptr<geom::Geometry> transformPolygon(
82 const geom::Polygon* geom,
83 const geom::Geometry* parent) override;
84
85 std::unique_ptr<geom::Geometry> transformMultiPolygon(
86 const geom::MultiPolygon* geom,
87 const geom::Geometry* parent) override;
88
89
90};
91
92} // namespace geos.precision
93} // namespace geos
94
95
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:44
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
Definition: MultiPolygon.h:59
Represents a linear polygon, which may include holes.
Definition: Polygon.h:61
Specifies the precision model of the Coordinate in a Geometry.
Definition: PrecisionModel.h:90
A framework for processes which transform an input Geometry into an output Geometry,...
Definition: GeometryTransformer.h:88
Reduces the precision of a geom::Geometry according to the supplied geom::PrecisionModel,...
Definition: PrecisionReducerTransformer.h:46
Basic namespace for all GEOS functionalities.
Definition: geos.h:39