GEOS: TaggedLinesSimplifier.h Source File

GEOS 3.5.0

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

- File List

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 #ifndef GEOS_SIMPLIFY_TAGGEDLINESSIMPLIFIER_H
27 #define GEOS_SIMPLIFY_TAGGEDLINESSIMPLIFIER_H
28
29 #include <geos/export.h>
30 #include <vector>
31 #include <memory>
32 #include <cassert>
33
34 #include <geos/simplify/LineSegmentIndex.h> // for templated function body
35 #include <geos/simplify/TaggedLineStringSimplifier.h>
36
37 #ifdef _MSC_VER
38 #pragma warning(push)
39 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
40 #endif
41
42 // Forward declarations
43 namespace geos {
44 namespace simplify {
45 class TaggedLineString;
46 }
47 }
48
49 namespace geos {
50 namespace simplify { // geos::simplify
51
56 class GEOS_DLL TaggedLinesSimplifier {
57
58 public:
59
60 TaggedLinesSimplifier();
61
70 void setDistanceTolerance(double tolerance);
71
85 template <class iterator_type>
86 void simplify(
87 iterator_type begin,
88 iterator_type end)
89 {
90 // add lines to the index
91 for (iterator_type it=begin; it != end; ++it) {
92 assert(*it);
93 inputIndex->add(*(*it));
94 }
95
96 // Simplify lines
97 for (iterator_type it=begin; it != end; ++it) {
98 assert(*it);
99 simplify(*(*it));
100 }
101 }
102
103
104 private:
105
106 void simplify(TaggedLineString& line);
107
108 std::auto_ptr<LineSegmentIndex> inputIndex;
109
110 std::auto_ptr<LineSegmentIndex> outputIndex;
111
112 std::auto_ptr<TaggedLineStringSimplifier> taggedlineSimplifier;
113 };
114
115 } // namespace geos::simplify
116 } // namespace geos
117
118 #ifdef _MSC_VER
119 #pragma warning(pop)
120 #endif
121
122 #endif // GEOS_SIMPLIFY_TAGGEDLINESSIMPLIFIER_H
geos::simplify::TaggedLinesSimplifier
Simplifies a collection of TaggedLineStrings, preserving topology (in the sense that no new intersect...
Definition: TaggedLinesSimplifier.h:56
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::simplify::TaggedLineString
Contains and owns a list of TaggedLineSegments.
Definition: TaggedLineString.h:60
geos::simplify::TaggedLinesSimplifier::simplify
void simplify(iterator_type begin, iterator_type end)
Definition: TaggedLinesSimplifier.h:86