GEOS 3.9.1
DouglasPeuckerLineSimplifier.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
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: simplify/DouglasPeuckerLineSimplifier.java rev. 1.4
16 *
17 **********************************************************************/
18
19#ifndef GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
20#define GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
21
22#include <geos/export.h>
23#include <vector>
24#include <memory> // for unique_ptr
25
26#ifdef _MSC_VER
27#pragma warning(push)
28#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
29#endif
30
31// Forward declarations
32namespace geos {
33namespace geom {
34class Coordinate;
35}
36}
37
38namespace geos {
39namespace simplify { // geos::simplify
40
46
47public:
48
49 typedef std::vector<short int> BoolVect;
50 typedef std::unique_ptr<BoolVect> BoolVectAutoPtr;
51
52 typedef std::vector<geom::Coordinate> CoordsVect;
53 typedef std::unique_ptr<CoordsVect> CoordsVectAutoPtr;
54
55
60 static CoordsVectAutoPtr simplify(
61 const CoordsVect& nPts,
62 double distanceTolerance);
63
64 DouglasPeuckerLineSimplifier(const CoordsVect& nPts);
65
74 void setDistanceTolerance(double nDistanceTolerance);
75
80 CoordsVectAutoPtr simplify();
81
82private:
83
84 const CoordsVect& pts;
85 BoolVectAutoPtr usePt;
86 double distanceTolerance;
87
88 void simplifySection(std::size_t i, std::size_t j);
89
90 // Declare type as noncopyable
92 DouglasPeuckerLineSimplifier& operator=(const DouglasPeuckerLineSimplifier& rhs) = delete;
93};
94
95} // namespace geos::simplify
96} // namespace geos
97
98#ifdef _MSC_VER
99#pragma warning(pop)
100#endif
101
102#endif // GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
Simplifies a linestring (sequence of points) using the standard Douglas-Peucker algorithm.
Definition DouglasPeuckerLineSimplifier.h:45
static CoordsVectAutoPtr simplify(const CoordsVect &nPts, double distanceTolerance)
Returns a newly allocated Coordinate vector, wrapped into an unique_ptr.
void setDistanceTolerance(double nDistanceTolerance)
Sets the distance tolerance for the simplification.
CoordsVectAutoPtr simplify()
Returns a newly allocated Coordinate vector, wrapped into an unique_ptr.
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:26