GEOS  3.12.0
TaggedLinesSimplifier.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/TaggedLinesSimplifier.java rev. 1.4 (JTS-1.7.1)
16  *
17  **********************************************************************
18  *
19  * NOTES: changed from JTS design adding a private
20  * TaggedLineStringSimplifier member and making
21  * simplify(collection) method become a templated
22  * function.
23  *
24  **********************************************************************/
25 
26 #pragma once
27 
28 #include <geos/export.h>
29 #include <vector>
30 #include <memory>
31 #include <cassert>
32 
33 #include <geos/simplify/LineSegmentIndex.h> // for templated function body
34 #include <geos/simplify/TaggedLineStringSimplifier.h>
35 
36 #ifdef _MSC_VER
37 #pragma warning(push)
38 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
39 #endif
40 
41 // Forward declarations
42 namespace geos {
43 namespace simplify {
44 class TaggedLineString;
45 }
46 }
47 
48 namespace geos {
49 namespace simplify { // geos::simplify
50 
55 class GEOS_DLL TaggedLinesSimplifier {
56 
57 public:
58 
60 
69  void setDistanceTolerance(double tolerance);
70 
80  template <class iterator_type>
81  void
83  iterator_type begin,
84  iterator_type end)
85  {
86  // add lines to the index
87  for(iterator_type it = begin; it != end; ++it) {
88  assert(*it);
89  inputIndex->add(*(*it));
90  }
91 
92  // Simplify lines
93  for(iterator_type it = begin; it != end; ++it) {
94  assert(*it);
95  simplify(*(*it));
96  }
97  }
98 
99 
100 private:
101 
102  void simplify(TaggedLineString& line);
103 
104  std::unique_ptr<LineSegmentIndex> inputIndex;
105 
106  std::unique_ptr<LineSegmentIndex> outputIndex;
107 
108  std::unique_ptr<TaggedLineStringSimplifier> taggedlineSimplifier;
109 };
110 
111 } // namespace geos::simplify
112 } // namespace geos
113 
114 #ifdef _MSC_VER
115 #pragma warning(pop)
116 #endif
117 
Simplifies a collection of TaggedLineStrings, preserving topology (in the sense that no new intersect...
Definition: TaggedLinesSimplifier.h:55
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25
Contains and owns a list of TaggedLineSegments.
Definition: TaggedLineString.h:57
void simplify(iterator_type begin, iterator_type end)
Simplify a set of TaggedLineStrings.
Definition: TaggedLinesSimplifier.h:82