GEOS 3.11.1
ScaledNoder.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 Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************
14 *
15 * Last port: noding/ScaledNoder.java rev. 1.3 (JTS-1.7.1)
16 *
17 **********************************************************************/
18
19#pragma once
20
21#include <geos/export.h>
22
23#include <cassert>
24#include <vector>
25
26#include <geos/noding/Noder.h> // for inheritance
27#include <geos/util.h>
28
29#ifdef _MSC_VER
30#pragma warning(push)
31#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
32#endif
33
34// Forward declarations
35namespace geos {
36namespace geom {
37class Coordinate;
38class CoordinateSequence;
39}
40namespace noding {
41class SegmentString;
42}
43}
44
45namespace geos {
46namespace noding { // geos.noding
47
58class GEOS_DLL ScaledNoder : public Noder { // , public geom::CoordinateFilter { // implements Noder
59
60public:
61
62 bool
63 isIntegerPrecision()
64 {
65 return (scaleFactor == 1.0);
66 }
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() override;
79
80 std::vector<SegmentString*>* getNodedSubstrings() const override;
81
82 void computeNodes(std::vector<SegmentString*>* inputSegStr) override;
83
84 //void filter(Coordinate& c);
85
86 void
87 filter_ro(const geom::Coordinate* c)
88 {
89 ::geos::ignore_unused_variable_warning(c);
90 assert(0);
91 }
92
93 void filter_rw(geom::Coordinate* c) const;
94
95private:
96
97 Noder& noder;
98
99 double scaleFactor;
100
101 double offsetX;
102
103 double offsetY;
104
105 bool isScaled;
106
107 void rescale(std::vector<SegmentString*>& segStrings) const;
108
109 void scale(std::vector<SegmentString*>& segStrings) const;
110
111 class Scaler;
112
113 class ReScaler;
114
115 friend class ScaledNoder::Scaler;
116
117 friend class ScaledNoder::ReScaler;
118
119 mutable std::vector<geom::CoordinateSequence*> newCoordSeq;
120
121 // Declare type as noncopyable
122 ScaledNoder(const ScaledNoder& other) = delete;
123 ScaledNoder& operator=(const ScaledNoder& rhs) = delete;
124};
125
126} // namespace geos.noding
127} // namespace geos
128
129#ifdef _MSC_VER
130#pragma warning(pop)
131#endif
132
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
Computes all intersections between segments in a set of SegmentString.
Definition: Noder.h:46
Wraps a Noder and transforms its input into the integer domain.
Definition: ScaledNoder.h:58
void computeNodes(std::vector< SegmentString * > *inputSegStr) override
Computes the noding for a collection of SegmentStrings.
std::vector< SegmentString * > * getNodedSubstrings() const override
Returns a collection of fully noded SegmentStrings. The SegmentStrings have the same context as their...
Basic namespace for all GEOS functionalities.
Definition: geos.h:39