@@ -79,26 +79,22 @@ struct Projection
7979 ProjectionType projectionType;
8080 ReferencePoint referencePoint;
8181
82- virtual ~Projection () {}
83-
84- friend bool operator ==(const Projection& lhs, const Projection& rhs)
85- {
86- return lhs.equalTo (rhs);
87- }
88-
89- friend bool operator !=(const Projection& lhs, const Projection& rhs)
90- {
91- return !(lhs == rhs);
92- }
82+ virtual ~Projection () = default ;
9383
9484 // ! Pure
9585 virtual Projection* clone () const = 0;
9686 virtual bool isMeasurable () const { return false ; }
9787
98- private:
9988 virtual bool equalTo (const Projection& rhs) const = 0;
100-
10189};
90+ inline bool operator ==(const Projection& lhs, const Projection& rhs)
91+ {
92+ return lhs.equalTo (rhs) && rhs.equalTo (lhs);
93+ }
94+ inline bool operator !=(const Projection& lhs, const Projection& rhs)
95+ {
96+ return !(lhs == rhs);
97+ }
10298
10399/* !
104100 * \struct PolynomialProjection
@@ -115,7 +111,7 @@ struct PolynomialProjection : public Projection
115111 this ->projectionType = ProjectionType::POLYNOMIAL;
116112 }
117113
118- virtual ~PolynomialProjection () {}
114+ virtual ~PolynomialProjection () = default ;
119115
120116 /* !
121117 * Define a copy operator
@@ -142,10 +138,13 @@ struct PolynomialProjection : public Projection
142138 // ! Find a col in the image associated with a lat-lon
143139 Poly2D latLonToCol;
144140
145- bool operator ==(const PolynomialProjection& rhs) const ;
146-
141+ bool operator ==(const PolynomialProjection& rhs) const // need member-function for SWIG
142+ {
143+ return static_cast <const Projection&>(*this ) == static_cast <const Projection&>(rhs);
144+ }
147145private:
148- virtual bool equalTo (const Projection& rhs) const override ;
146+ bool operator_eq (const PolynomialProjection& rhs) const ;
147+ bool equalTo (const Projection& rhs) const override ;
149148};
150149
151150/* !
@@ -154,7 +153,7 @@ struct PolynomialProjection : public Projection
154153 */
155154struct MeasurableProjection : public Projection
156155{
157- virtual ~MeasurableProjection () {}
156+ virtual ~MeasurableProjection () = default ;
158157
159158 RowColDouble sampleSpacing;
160159
@@ -163,10 +162,13 @@ struct MeasurableProjection : public Projection
163162
164163 bool isMeasurable () const { return true ; }
165164
166- bool operator ==(const MeasurableProjection& rhs) const ;
167-
165+ bool operator_eq (const MeasurableProjection& rhs) const ;
166+ bool operator ==(const MeasurableProjection& rhs) const // need member-function for SWIG
167+ {
168+ return static_cast <const Projection&>(*this ) == static_cast <const Projection&>(rhs);
169+ }
168170private:
169- virtual bool equalTo (const Projection& rhs) const override ;
171+ bool equalTo (const Projection& rhs) const override ;
170172};
171173
172174/* !
@@ -179,7 +181,6 @@ struct MeasurableProjection : public Projection
179181 */
180182struct GeographicProjection : public MeasurableProjection
181183{
182-
183184 // ! Initialize base class projection type
184185 GeographicProjection ()
185186 {
@@ -191,10 +192,15 @@ struct GeographicProjection : public MeasurableProjection
191192 {
192193 return new GeographicProjection (*this );
193194 }
194- virtual ~GeographicProjection () {}
195+ virtual ~GeographicProjection () = default ;
195196
197+ bool operator ==(const GeographicProjection& rhs) const // need member-function for SWIG
198+ {
199+ return static_cast <const Projection&>(*this ) == static_cast <const Projection&>(rhs);
200+ }
196201private:
197- virtual bool equalTo (const Projection& rhs) const override ;
202+ bool operator_eq (const GeographicProjection& rhs) const ;
203+ bool equalTo (const Projection& rhs) const override ;
198204};
199205
200206/* !
@@ -215,7 +221,7 @@ struct CylindricalProjection : public MeasurableProjection
215221 this ->curvatureRadius = Init::undefined<double >();
216222 }
217223
218- virtual ~CylindricalProjection () {}
224+ virtual ~CylindricalProjection () = default ;
219225
220226 /* !
221227 * Define a copy operator
@@ -236,10 +242,13 @@ struct CylindricalProjection : public MeasurableProjection
236242 */
237243 double curvatureRadius;
238244
239- bool operator ==(const CylindricalProjection& rhs) const ;
240-
245+ bool operator ==(const CylindricalProjection& rhs) const // need member-function for SWIG
246+ {
247+ return static_cast <const Projection&>(*this ) == static_cast <const Projection&>(rhs);
248+ }
241249private:
242- virtual bool equalTo (const Projection& rhs) const override ;
250+ bool operator_eq (const CylindricalProjection& rhs) const ;
251+ bool equalTo (const Projection& rhs) const override ;
243252};
244253
245254/* !
@@ -257,7 +266,7 @@ struct PlaneProjection : public MeasurableProjection
257266 this ->projectionType = ProjectionType::PLANE;
258267 }
259268
260- virtual ~PlaneProjection () {}
269+ virtual ~PlaneProjection () = default ;
261270
262271 // ! Clone operation
263272 virtual Projection* clone () const
@@ -268,10 +277,13 @@ struct PlaneProjection : public MeasurableProjection
268277 // ! Product plane definition (defined by a basis)
269278 ProductPlane productPlane;
270279
271- bool operator ==(const PlaneProjection& rhs) const ;
272-
280+ bool operator ==(const PlaneProjection& rhs) const // need member-function for SWIG
281+ {
282+ return static_cast <const Projection&>(*this ) == static_cast <const Projection&>(rhs);
283+ }
273284private:
274- virtual bool equalTo (const Projection& rhs) const override ;
285+ bool operator_eq (const PlaneProjection& rhs) const ;
286+ bool equalTo (const Projection& rhs) const override ;
275287};
276288
277289/* !
0 commit comments