GEOS 3.3.8

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

- File List

ScaledNoder.h
1 /**********************************************************************
2 * $Id: ScaledNoder.h 3255 2011-03-01 17:56:10Z mloskot $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2006 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: noding/ScaledNoder.java rev. 1.3 (JTS-1.7.1)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_NODING_SCALEDNODER_H
21 #define GEOS_NODING_SCALEDNODER_H
22
23 #include <geos/export.h>
24
25 #include <cassert>
26 #include <vector>
27
28 #include <geos/inline.h>
29 #include <geos/noding/Noder.h> // for inheritance
30 //#include <geos/geom/CoordinateFilter.h> // for inheritance
31 #include <geos/util.h>
32
33 #ifdef _MSC_VER
34 #pragma warning(push)
35 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
36 #endif
37
38 // Forward declarations
39 namespace geos {
40 namespace geom {
41 class Coordinate;
42 class CoordinateSequence;
43 }
44 namespace noding {
45 class SegmentString;
46 }
47 }
48
49 namespace geos {
50 namespace noding { // geos.noding
51
62 class GEOS_DLL ScaledNoder : public Noder { // , public geom::CoordinateFilter { // implements Noder
63
64 public:
65
66 bool isIntegerPrecision() { return (scaleFactor == 1.0); }
67
68 ScaledNoder(Noder& n, double nScaleFactor,
69 double nOffsetX=0.0, double nOffsetY=0.0)
70 :
71 noder(n),
72 scaleFactor(nScaleFactor),
73 offsetX(nOffsetX),
74 offsetY(nOffsetY),
75 isScaled(nScaleFactor!=1.0)
76 {}
77
78 ~ScaledNoder();
79
80 std::vector<SegmentString*>* getNodedSubstrings() const;
81
82 void computeNodes(std::vector<SegmentString*>* inputSegStr);
83
84 //void filter(Coordinate& c);
85
86 void filter_ro(const geom::Coordinate* c)
87 {
88 ::geos::ignore_unused_variable_warning(c);
89 assert(0);
90 }
91
92 void filter_rw(geom::Coordinate* c) const;
93
94 private:
95
96 Noder& noder;
97
98 double scaleFactor;
99
100 double offsetX;
101
102 double offsetY;
103
104 bool isScaled;
105
106 void rescale(std::vector<SegmentString*>& segStrings) const;
107
108 void scale(std::vector<SegmentString*>& segStrings) const;
109
110 class Scaler;
111
112 class ReScaler;
113
114 friend class ScaledNoder::Scaler;
115
116 friend class ScaledNoder::ReScaler;
117
118 mutable std::vector<geom::CoordinateSequence*> newCoordSeq;
119
120 // Declare type as noncopyable
121 ScaledNoder(const ScaledNoder& other);
122 ScaledNoder& operator=(const ScaledNoder& rhs);
123 };
124
125 } // namespace geos.noding
126 } // namespace geos
127
128 #ifdef _MSC_VER
129 #pragma warning(pop)
130 #endif
131
132 //#ifdef GEOS_INLINE
133 //# include "geos/noding/ScaledNoder.inl"
134 //#endif
135
136 #endif // GEOS_NODING_SCALEDNODER_H
137
138 /**********************************************************************
139 * $Log$
140 * Revision 1.8 2006/06/19 23:33:03 strk
141 * Don't *require* CoordinateFilters to define both read-only and read-write methods.
142 *
143 * Revision 1.7 2006/05/04 06:36:00 strk
144 * Extended definition to take new CoordinateSequence tracking into account
145 *
146 * Revision 1.6 2006/05/03 15:04:33 strk
147 * removed reduntant port info
148 *
149 * Revision 1.5 2006/05/03 15:00:42 strk
150 * Fixed scale() function to remove repeated points *after* rounding. Added brief doxygen class description.
151 *
152 * Revision 1.4 2006/05/03 09:14:22 strk
153 * * source/operation/buffer/OffsetCurveSetBuilder.cpp: used auto_ptr to protect leaks of CoordinateSequence
154 * * source/noding/ScaledNoder.cpp, source/headers/geos/noding/ScaledNoder.h: ported JTS bugfix in scale method.
155 *
156 * Revision 1.3 2006/03/24 09:52:41 strk
157 * USE_INLINE => GEOS_INLINE
158 *
159 * Revision 1.2 2006/03/13 21:19:51 strk
160 * Fixed bug in ScaledNoder scaling mechanism (hugly code, due to CoordinateSequence visitor pattern design). Tests are still failing so this possibly needs some other fix. Streamlined includes by implementation file.
161 *
162 * Revision 1.1 2006/03/09 16:46:49 strk
163 * geos::geom namespace definition, first pass at headers split
164 *
165 **********************************************************************/
166