File Coverage

/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/XS/libgeos.x/i/geos/noding/ScaledNoder.h
Criterion Covered Total %
statement 4 4 100.0
branch n/a
condition n/a
subroutine n/a
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
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
23              
24             #include
25             #include
26              
27             #include
28             #include // for inheritance
29             //#include // for inheritance
30             #include
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              
51             /** \brief
52             * Wraps a {@link Noder} and transforms its input
53             * into the integer domain.
54             *
55             * This is intended for use with Snap-Rounding noders,
56             * which typically are only intended to work in the integer domain.
57             * Offsets can be provided to increase the number of digits of
58             * available precision.
59             *
60             */
61             class GEOS_DLL ScaledNoder : public Noder { // , public geom::CoordinateFilter { // implements Noder
62              
63             public:
64              
65 2           bool isIntegerPrecision() { return (scaleFactor == 1.0); }
66              
67 1           ScaledNoder(Noder& n, double nScaleFactor,
68             double nOffsetX=0.0, double nOffsetY=0.0)
69             :
70             noder(n),
71             scaleFactor(nScaleFactor),
72             offsetX(nOffsetX),
73             offsetY(nOffsetY),
74 1           isScaled(nScaleFactor!=1.0)
75 1           {}
76              
77             ~ScaledNoder() override;
78              
79             std::vector* getNodedSubstrings() const override;
80              
81             void computeNodes(std::vector* inputSegStr) override;
82              
83             //void filter(Coordinate& c);
84              
85             void filter_ro(const geom::Coordinate* c)
86             {
87             ::geos::ignore_unused_variable_warning(c);
88             assert(0);
89             }
90              
91             void filter_rw(geom::Coordinate* c) const;
92              
93             private:
94              
95             Noder& noder;
96              
97             double scaleFactor;
98              
99             double offsetX;
100              
101             double offsetY;
102              
103             bool isScaled;
104              
105             void rescale(std::vector& segStrings) const;
106              
107             void scale(std::vector& segStrings) const;
108              
109             class Scaler;
110              
111             class ReScaler;
112              
113             friend class ScaledNoder::Scaler;
114              
115             friend class ScaledNoder::ReScaler;
116              
117             mutable std::vector newCoordSeq;
118              
119             // Declare type as noncopyable
120             ScaledNoder(const ScaledNoder& other) = delete;
121             ScaledNoder& operator=(const ScaledNoder& rhs) = delete;
122             };
123              
124             } // namespace geos.noding
125             } // namespace geos
126              
127             #ifdef _MSC_VER
128             #pragma warning(pop)
129             #endif
130              
131             #endif // GEOS_NODING_SCALEDNODER_H