GEOS  3.9.1dev
ScaledNoder.h
Go to the documentation of this file.
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 #ifndef GEOS_NODING_SCALEDNODER_H
20 #define GEOS_NODING_SCALEDNODER_H
21 
22 #include <geos/export.h>
23 
24 #include <cassert>
25 #include <vector>
26 
27 #include <geos/inline.h>
28 #include <geos/noding/Noder.h> // for inheritance
29 //#include <geos/geom/CoordinateFilter.h> // for inheritance
30 #include <geos/util.h>
31 
32 #ifdef _MSC_VER
33 #pragma warning(push)
34 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
35 #endif
36 
37 // Forward declarations
38 namespace geos {
39 namespace geom {
40 class Coordinate;
41 class CoordinateSequence;
42 }
43 namespace noding {
44 class SegmentString;
45 }
46 }
47 
48 namespace geos {
49 namespace noding { // geos.noding
50 
61 class GEOS_DLL ScaledNoder : public Noder { // , public geom::CoordinateFilter { // implements Noder
62 
63 public:
64 
65  bool
67  {
68  return (scaleFactor == 1.0);
69  }
70 
71  ScaledNoder(Noder& n, double nScaleFactor,
72  double nOffsetX = 0.0, double nOffsetY = 0.0)
73  :
74  noder(n),
75  scaleFactor(nScaleFactor),
76  offsetX(nOffsetX),
77  offsetY(nOffsetY),
78  isScaled(nScaleFactor != 1.0)
79  {}
80 
81  ~ScaledNoder() override;
82 
83  std::vector<SegmentString*>* getNodedSubstrings() const override;
84 
85  void computeNodes(std::vector<SegmentString*>* inputSegStr) override;
86 
87  //void filter(Coordinate& c);
88 
89  void
91  {
93  assert(0);
94  }
95 
96  void filter_rw(geom::Coordinate* c) const;
97 
98 private:
99 
101 
102  double scaleFactor;
103 
104  double offsetX;
105 
106  double offsetY;
107 
108  bool isScaled;
109 
110  void rescale(std::vector<SegmentString*>& segStrings) const;
111 
112  void scale(std::vector<SegmentString*>& segStrings) const;
113 
114  class Scaler;
115 
116  class ReScaler;
117 
118  friend class ScaledNoder::Scaler;
119 
120  friend class ScaledNoder::ReScaler;
121 
122  mutable std::vector<geom::CoordinateSequence*> newCoordSeq;
123 
124  // Declare type as noncopyable
125  ScaledNoder(const ScaledNoder& other) = delete;
126  ScaledNoder& operator=(const ScaledNoder& rhs) = delete;
127 };
128 
129 } // namespace geos.noding
130 } // namespace geos
131 
132 #ifdef _MSC_VER
133 #pragma warning(pop)
134 #endif
135 
136 #endif // GEOS_NODING_SCALEDNODER_H
#define GEOS_DLL
Definition: export.h:28
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Wraps a Noder and transforms its input into the integer domain.
Definition: ScaledNoder.h:61
ScaledNoder(Noder &n, double nScaleFactor, double nOffsetX=0.0, double nOffsetY=0.0)
Definition: ScaledNoder.h:71
std::vector< geom::CoordinateSequence * > newCoordSeq
Definition: ScaledNoder.h:122
Basic namespace for all GEOS functionalities.
Computes all intersections between segments in a set of SegmentString.
Definition: Noder.h:49
void ignore_unused_variable_warning(T const &)
Definition: util.h:44
void filter_ro(const geom::Coordinate *c)
Definition: ScaledNoder.h:90