/src/PROJ/include/proj/crs.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Project: PROJ |
4 | | * Purpose: ISO19111:2019 implementation |
5 | | * Author: Even Rouault <even dot rouault at spatialys dot com> |
6 | | * |
7 | | ****************************************************************************** |
8 | | * Copyright (c) 2018, Even Rouault <even dot rouault at spatialys dot com> |
9 | | * |
10 | | * Permission is hereby granted, free of charge, to any person obtaining a |
11 | | * copy of this software and associated documentation files (the "Software"), |
12 | | * to deal in the Software without restriction, including without limitation |
13 | | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
14 | | * and/or sell copies of the Software, and to permit persons to whom the |
15 | | * Software is furnished to do so, subject to the following conditions: |
16 | | * |
17 | | * The above copyright notice and this permission notice shall be included |
18 | | * in all copies or substantial portions of the Software. |
19 | | * |
20 | | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
21 | | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
22 | | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
23 | | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
24 | | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
25 | | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
26 | | * DEALINGS IN THE SOFTWARE. |
27 | | ****************************************************************************/ |
28 | | |
29 | | #ifndef CRS_HH_INCLUDED |
30 | | #define CRS_HH_INCLUDED |
31 | | |
32 | | #include <memory> |
33 | | #include <string> |
34 | | #include <vector> |
35 | | |
36 | | #include "common.hpp" |
37 | | #include "coordinateoperation.hpp" |
38 | | #include "coordinatesystem.hpp" |
39 | | #include "datum.hpp" |
40 | | #include "io.hpp" |
41 | | #include "util.hpp" |
42 | | |
43 | | NS_PROJ_START |
44 | | |
45 | | /** osgeo.proj.crs namespace |
46 | | |
47 | | \brief CRS (coordinate reference system = coordinate system with a datum). |
48 | | */ |
49 | | namespace crs { |
50 | | |
51 | | // --------------------------------------------------------------------------- |
52 | | |
53 | | class GeographicCRS; |
54 | | /** Shared pointer of GeographicCRS */ |
55 | | using GeographicCRSPtr = std::shared_ptr<GeographicCRS>; |
56 | | /** Non-null shared pointer of GeographicCRS */ |
57 | | using GeographicCRSNNPtr = util::nn<GeographicCRSPtr>; |
58 | | |
59 | | class VerticalCRS; |
60 | | /** Shared pointer of VerticalCRS */ |
61 | | using VerticalCRSPtr = std::shared_ptr<VerticalCRS>; |
62 | | /** Non-null shared pointer of VerticalCRS */ |
63 | | using VerticalCRSNNPtr = util::nn<VerticalCRSPtr>; |
64 | | |
65 | | class BoundCRS; |
66 | | /** Shared pointer of BoundCRS */ |
67 | | using BoundCRSPtr = std::shared_ptr<BoundCRS>; |
68 | | /** Non-null shared pointer of BoundCRS */ |
69 | | using BoundCRSNNPtr = util::nn<BoundCRSPtr>; |
70 | | |
71 | | class CompoundCRS; |
72 | | /** Shared pointer of CompoundCRS */ |
73 | | using CompoundCRSPtr = std::shared_ptr<CompoundCRS>; |
74 | | /** Non-null shared pointer of CompoundCRS */ |
75 | | using CompoundCRSNNPtr = util::nn<CompoundCRSPtr>; |
76 | | |
77 | | // --------------------------------------------------------------------------- |
78 | | |
79 | | class CRS; |
80 | | /** Shared pointer of CRS */ |
81 | | using CRSPtr = std::shared_ptr<CRS>; |
82 | | /** Non-null shared pointer of CRS */ |
83 | | using CRSNNPtr = util::nn<CRSPtr>; |
84 | | |
85 | | /** \brief Abstract class modelling a coordinate reference system which is |
86 | | * usually single but may be compound. |
87 | | * |
88 | | * \remark Implements CRS from \ref ISO_19111_2019 |
89 | | */ |
90 | | class PROJ_GCC_DLL CRS : public common::ObjectUsage, |
91 | | public io::IJSONExportable { |
92 | | public: |
93 | | //! @cond Doxygen_Suppress |
94 | | PROJ_DLL ~CRS() override; |
95 | | //! @endcond |
96 | | |
97 | | // Non-standard |
98 | | |
99 | | PROJ_DLL bool isDynamic(bool considerWGS84AsDynamic = false) const; |
100 | | PROJ_DLL GeodeticCRSPtr extractGeodeticCRS() const; |
101 | | PROJ_DLL GeographicCRSPtr extractGeographicCRS() const; |
102 | | PROJ_DLL VerticalCRSPtr extractVerticalCRS() const; |
103 | | PROJ_DLL CRSNNPtr createBoundCRSToWGS84IfPossible( |
104 | | const io::DatabaseContextPtr &dbContext, |
105 | | operation::CoordinateOperationContext::IntermediateCRSUse |
106 | | allowIntermediateCRSUse) const; |
107 | | PROJ_DLL CRSNNPtr stripVerticalComponent() const; |
108 | | |
109 | | PROJ_DLL const BoundCRSPtr &canonicalBoundCRS() PROJ_PURE_DECL; |
110 | | |
111 | | PROJ_DLL std::list<std::pair<CRSNNPtr, int>> |
112 | | identify(const io::AuthorityFactoryPtr &authorityFactory) const; |
113 | | |
114 | | PROJ_DLL std::list<CRSNNPtr> |
115 | | getNonDeprecated(const io::DatabaseContextNNPtr &dbContext) const; |
116 | | |
117 | | PROJ_DLL CRSNNPtr |
118 | | promoteTo3D(const std::string &newName, |
119 | | const io::DatabaseContextPtr &dbContext) const; |
120 | | |
121 | | PROJ_DLL CRSNNPtr demoteTo2D(const std::string &newName, |
122 | | const io::DatabaseContextPtr &dbContext) const; |
123 | | |
124 | | PROJ_PRIVATE : |
125 | | //! @cond Doxygen_Suppress |
126 | | PROJ_INTERNAL const GeodeticCRS * |
127 | | extractGeodeticCRSRaw() const; |
128 | | |
129 | | PROJ_FOR_TEST CRSNNPtr shallowClone() const; |
130 | | |
131 | | PROJ_FOR_TEST CRSNNPtr alterName(const std::string &newName) const; |
132 | | |
133 | | PROJ_FOR_TEST CRSNNPtr alterId(const std::string &authName, |
134 | | const std::string &code) const; |
135 | | |
136 | | PROJ_INTERNAL const std::string &getExtensionProj4() const noexcept; |
137 | | |
138 | | PROJ_FOR_TEST CRSNNPtr |
139 | | alterGeodeticCRS(const GeodeticCRSNNPtr &newGeodCRS) const; |
140 | | |
141 | | PROJ_FOR_TEST CRSNNPtr |
142 | | alterCSLinearUnit(const common::UnitOfMeasure &unit) const; |
143 | | |
144 | | PROJ_INTERNAL bool mustAxisOrderBeSwitchedForVisualization() const; |
145 | | |
146 | | PROJ_INTERNAL CRSNNPtr applyAxisOrderReversal(const char *nameSuffix) const; |
147 | | |
148 | | PROJ_FOR_TEST CRSNNPtr normalizeForVisualization() const; |
149 | | |
150 | | PROJ_INTERNAL CRSNNPtr allowNonConformantWKT1Export() const; |
151 | | |
152 | | PROJ_INTERNAL CRSNNPtr |
153 | | attachOriginalCompoundCRS(const CompoundCRSNNPtr &compoundCRS) const; |
154 | | |
155 | | PROJ_INTERNAL CRSNNPtr promoteTo3D( |
156 | | const std::string &newName, const io::DatabaseContextPtr &dbContext, |
157 | | const cs::CoordinateSystemAxisNNPtr &verticalAxisIfNotAlreadyPresent) |
158 | | const; |
159 | | |
160 | | PROJ_INTERNAL bool hasImplicitCS() const; |
161 | | |
162 | | PROJ_INTERNAL bool hasOver() const; |
163 | | |
164 | | PROJ_INTERNAL static CRSNNPtr |
165 | | getResolvedCRS(const CRSNNPtr &crs, |
166 | | const io::AuthorityFactoryPtr &authFactory, |
167 | | metadata::ExtentPtr &extentOut); |
168 | | //! @endcond |
169 | | |
170 | | protected: |
171 | | PROJ_INTERNAL CRS(); |
172 | | PROJ_INTERNAL CRS(const CRS &other); |
173 | | friend class BoundCRS; |
174 | | PROJ_INTERNAL void setCanonicalBoundCRS(const BoundCRSNNPtr &boundCRS); |
175 | | |
176 | | PROJ_INTERNAL virtual CRSNNPtr _shallowClone() const = 0; |
177 | | |
178 | | PROJ_INTERNAL virtual std::list<std::pair<CRSNNPtr, int>> |
179 | | _identify(const io::AuthorityFactoryPtr &authorityFactory) const; |
180 | | |
181 | | PROJ_INTERNAL void |
182 | | setProperties(const util::PropertyMap |
183 | | &properties); // throw(InvalidValueTypeException) |
184 | | |
185 | | private: |
186 | | PROJ_OPAQUE_PRIVATE_DATA |
187 | | }; |
188 | | |
189 | | // --------------------------------------------------------------------------- |
190 | | |
191 | | /** \brief Abstract class modelling a coordinate reference system consisting of |
192 | | * one Coordinate System and either one datum::Datum or one |
193 | | * datum::DatumEnsemble. |
194 | | * |
195 | | * \remark Implements SingleCRS from \ref ISO_19111_2019 |
196 | | */ |
197 | | class PROJ_GCC_DLL SingleCRS : public CRS { |
198 | | public: |
199 | | //! @cond Doxygen_Suppress |
200 | | PROJ_DLL ~SingleCRS() override; |
201 | | //! @endcond |
202 | | |
203 | | PROJ_DLL const datum::DatumPtr &datum() PROJ_PURE_DECL; |
204 | | PROJ_DLL const datum::DatumEnsemblePtr &datumEnsemble() PROJ_PURE_DECL; |
205 | | PROJ_DLL const cs::CoordinateSystemNNPtr &coordinateSystem() PROJ_PURE_DECL; |
206 | | |
207 | | PROJ_PRIVATE : |
208 | | //! @cond Doxygen_Suppress |
209 | | PROJ_INTERNAL void |
210 | | exportDatumOrDatumEnsembleToWkt(io::WKTFormatter *formatter) |
211 | | const; // throw(io::FormattingException) |
212 | | |
213 | | PROJ_INTERNAL const datum::DatumNNPtr |
214 | | datumNonNull(const io::DatabaseContextPtr &dbContext) const; |
215 | | //! @endcond |
216 | | |
217 | | protected: |
218 | | PROJ_INTERNAL SingleCRS(const datum::DatumPtr &datumIn, |
219 | | const datum::DatumEnsemblePtr &datumEnsembleIn, |
220 | | const cs::CoordinateSystemNNPtr &csIn); |
221 | | PROJ_INTERNAL SingleCRS(const SingleCRS &other); |
222 | | |
223 | | PROJ_INTERNAL bool |
224 | | baseIsEquivalentTo(const util::IComparable *other, |
225 | | util::IComparable::Criterion criterion = |
226 | | util::IComparable::Criterion::STRICT, |
227 | | const io::DatabaseContextPtr &dbContext = nullptr) const; |
228 | | |
229 | | private: |
230 | | PROJ_OPAQUE_PRIVATE_DATA |
231 | | SingleCRS &operator=(const SingleCRS &other) = delete; |
232 | | }; |
233 | | |
234 | | /** Shared pointer of SingleCRS */ |
235 | | using SingleCRSPtr = std::shared_ptr<SingleCRS>; |
236 | | /** Non-null shared pointer of SingleCRS */ |
237 | | using SingleCRSNNPtr = util::nn<SingleCRSPtr>; |
238 | | |
239 | | // --------------------------------------------------------------------------- |
240 | | |
241 | | class GeodeticCRS; |
242 | | /** Shared pointer of GeodeticCRS */ |
243 | | using GeodeticCRSPtr = std::shared_ptr<GeodeticCRS>; |
244 | | /** Non-null shared pointer of GeodeticCRS */ |
245 | | using GeodeticCRSNNPtr = util::nn<GeodeticCRSPtr>; |
246 | | |
247 | | /** \brief A coordinate reference system associated with a geodetic reference |
248 | | * frame and a three-dimensional Cartesian or spherical coordinate system. |
249 | | * |
250 | | * If the geodetic reference frame is dynamic or if the geodetic CRS has an |
251 | | * association to a velocity model then the geodetic CRS is dynamic, else it |
252 | | * is static. |
253 | | * |
254 | | * \remark Implements GeodeticCRS from \ref ISO_19111_2019 |
255 | | */ |
256 | | class PROJ_GCC_DLL GeodeticCRS : virtual public SingleCRS, |
257 | | public io::IPROJStringExportable { |
258 | | public: |
259 | | //! @cond Doxygen_Suppress |
260 | | PROJ_DLL ~GeodeticCRS() override; |
261 | | //! @endcond |
262 | | |
263 | | PROJ_DLL const datum::GeodeticReferenceFramePtr &datum() PROJ_PURE_DECL; |
264 | | |
265 | | PROJ_DLL const datum::PrimeMeridianNNPtr &primeMeridian() PROJ_PURE_DECL; |
266 | | PROJ_DLL const datum::EllipsoidNNPtr &ellipsoid() PROJ_PURE_DECL; |
267 | | |
268 | | // coordinateSystem() returns either a EllipsoidalCS, SphericalCS or |
269 | | // CartesianCS |
270 | | |
271 | | PROJ_DLL const std::vector<operation::PointMotionOperationNNPtr> & |
272 | | velocityModel() PROJ_PURE_DECL; |
273 | | |
274 | | // Non-standard |
275 | | |
276 | | PROJ_DLL bool isGeocentric() PROJ_PURE_DECL; |
277 | | |
278 | | PROJ_DLL bool isSphericalPlanetocentric() PROJ_PURE_DECL; |
279 | | |
280 | | PROJ_DLL static GeodeticCRSNNPtr |
281 | | create(const util::PropertyMap &properties, |
282 | | const datum::GeodeticReferenceFrameNNPtr &datum, |
283 | | const cs::SphericalCSNNPtr &cs); |
284 | | |
285 | | PROJ_DLL static GeodeticCRSNNPtr |
286 | | create(const util::PropertyMap &properties, |
287 | | const datum::GeodeticReferenceFrameNNPtr &datum, |
288 | | const cs::CartesianCSNNPtr &cs); |
289 | | |
290 | | PROJ_DLL static GeodeticCRSNNPtr |
291 | | create(const util::PropertyMap &properties, |
292 | | const datum::GeodeticReferenceFramePtr &datum, |
293 | | const datum::DatumEnsemblePtr &datumEnsemble, |
294 | | const cs::SphericalCSNNPtr &cs); |
295 | | |
296 | | PROJ_DLL static GeodeticCRSNNPtr |
297 | | create(const util::PropertyMap &properties, |
298 | | const datum::GeodeticReferenceFramePtr &datum, |
299 | | const datum::DatumEnsemblePtr &datumEnsemble, |
300 | | const cs::CartesianCSNNPtr &cs); |
301 | | |
302 | | PROJ_DLL static const GeodeticCRSNNPtr EPSG_4978; // WGS 84 Geocentric |
303 | | |
304 | | PROJ_DLL std::list<std::pair<GeodeticCRSNNPtr, int>> |
305 | | identify(const io::AuthorityFactoryPtr &authorityFactory) const; |
306 | | |
307 | | PROJ_PRIVATE : |
308 | | //! @cond Doxygen_Suppress |
309 | | PROJ_INTERNAL void |
310 | | addDatumInfoToPROJString(io::PROJStringFormatter *formatter) const; |
311 | | |
312 | | PROJ_INTERNAL const datum::GeodeticReferenceFrameNNPtr |
313 | | datumNonNull(const io::DatabaseContextPtr &dbContext) const; |
314 | | |
315 | | PROJ_INTERNAL void addGeocentricUnitConversionIntoPROJString( |
316 | | io::PROJStringFormatter *formatter) const; |
317 | | |
318 | | PROJ_INTERNAL void |
319 | | addAngularUnitConvertAndAxisSwap(io::PROJStringFormatter *formatter) const; |
320 | | |
321 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
322 | | const override; // throw(io::FormattingException) |
323 | | |
324 | | PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) |
325 | | const override; // throw(FormattingException) |
326 | | |
327 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
328 | | const override; // throw(FormattingException) |
329 | | |
330 | | PROJ_INTERNAL bool _isEquivalentTo( |
331 | | const util::IComparable *other, |
332 | | util::IComparable::Criterion criterion = |
333 | | util::IComparable::Criterion::STRICT, |
334 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
335 | | |
336 | | //! @endcond |
337 | | |
338 | | protected: |
339 | | PROJ_INTERNAL GeodeticCRS(const datum::GeodeticReferenceFramePtr &datumIn, |
340 | | const datum::DatumEnsemblePtr &datumEnsembleIn, |
341 | | const cs::EllipsoidalCSNNPtr &csIn); |
342 | | PROJ_INTERNAL GeodeticCRS(const datum::GeodeticReferenceFramePtr &datumIn, |
343 | | const datum::DatumEnsemblePtr &datumEnsembleIn, |
344 | | const cs::SphericalCSNNPtr &csIn); |
345 | | PROJ_INTERNAL GeodeticCRS(const datum::GeodeticReferenceFramePtr &datumIn, |
346 | | const datum::DatumEnsemblePtr &datumEnsembleIn, |
347 | | const cs::CartesianCSNNPtr &csIn); |
348 | | PROJ_INTERNAL GeodeticCRS(const GeodeticCRS &other); |
349 | | |
350 | | PROJ_INTERNAL static GeodeticCRSNNPtr createEPSG_4978(); |
351 | | |
352 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
353 | | |
354 | | PROJ_INTERNAL void _exportToJSONInternal( |
355 | | io::JSONFormatter *formatter, |
356 | | const char *objectName) const; // throw(FormattingException) |
357 | | |
358 | | PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>> |
359 | | _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; |
360 | | |
361 | | PROJ_INTERNAL bool |
362 | | _isEquivalentToNoTypeCheck(const util::IComparable *other, |
363 | | util::IComparable::Criterion criterion, |
364 | | const io::DatabaseContextPtr &dbContext) const; |
365 | | |
366 | | INLINED_MAKE_SHARED |
367 | | |
368 | | private: |
369 | | PROJ_OPAQUE_PRIVATE_DATA |
370 | | |
371 | | GeodeticCRS &operator=(const GeodeticCRS &other) = delete; |
372 | | }; |
373 | | |
374 | | // --------------------------------------------------------------------------- |
375 | | |
376 | | /** \brief A coordinate reference system associated with a geodetic reference |
377 | | * frame and a two- or three-dimensional ellipsoidal coordinate system. |
378 | | * |
379 | | * If the geodetic reference frame is dynamic or if the geographic CRS has an |
380 | | * association to a velocity model then the geodetic CRS is dynamic, else it is |
381 | | * static. |
382 | | * |
383 | | * \remark Implements GeographicCRS from \ref ISO_19111_2019 |
384 | | */ |
385 | | class PROJ_GCC_DLL GeographicCRS : public GeodeticCRS { |
386 | | public: |
387 | | //! @cond Doxygen_Suppress |
388 | | PROJ_DLL ~GeographicCRS() override; |
389 | | //! @endcond |
390 | | |
391 | | PROJ_DLL const cs::EllipsoidalCSNNPtr &coordinateSystem() PROJ_PURE_DECL; |
392 | | |
393 | | // Non-standard |
394 | | PROJ_DLL static GeographicCRSNNPtr |
395 | | create(const util::PropertyMap &properties, |
396 | | const datum::GeodeticReferenceFrameNNPtr &datum, |
397 | | const cs::EllipsoidalCSNNPtr &cs); |
398 | | PROJ_DLL static GeographicCRSNNPtr |
399 | | create(const util::PropertyMap &properties, |
400 | | const datum::GeodeticReferenceFramePtr &datum, |
401 | | const datum::DatumEnsemblePtr &datumEnsemble, |
402 | | const cs::EllipsoidalCSNNPtr &cs); |
403 | | |
404 | | PROJ_DLL GeographicCRSNNPtr |
405 | | demoteTo2D(const std::string &newName, |
406 | | const io::DatabaseContextPtr &dbContext) const; |
407 | | |
408 | | PROJ_DLL static const GeographicCRSNNPtr EPSG_4267; // NAD27 |
409 | | PROJ_DLL static const GeographicCRSNNPtr EPSG_4269; // NAD83 |
410 | | PROJ_DLL static const GeographicCRSNNPtr EPSG_4326; // WGS 84 2D |
411 | | PROJ_DLL static const GeographicCRSNNPtr OGC_CRS84; // CRS84 (Long, Lat) |
412 | | PROJ_DLL static const GeographicCRSNNPtr EPSG_4807; // NTF Paris |
413 | | PROJ_DLL static const GeographicCRSNNPtr EPSG_4979; // WGS 84 3D |
414 | | |
415 | | PROJ_PRIVATE : |
416 | | //! @cond Doxygen_Suppress |
417 | | |
418 | | PROJ_INTERNAL void |
419 | | _exportToPROJString(io::PROJStringFormatter *formatter) |
420 | | const override; // throw(FormattingException) |
421 | | |
422 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
423 | | const override; // throw(FormattingException) |
424 | | |
425 | | PROJ_DLL bool is2DPartOf3D( |
426 | | util::nn<const GeographicCRS *> other, |
427 | | const io::DatabaseContextPtr &dbContext = nullptr) PROJ_PURE_DECL; |
428 | | |
429 | | PROJ_INTERNAL bool _isEquivalentTo( |
430 | | const util::IComparable *other, |
431 | | util::IComparable::Criterion criterion = |
432 | | util::IComparable::Criterion::STRICT, |
433 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
434 | | |
435 | | //! @endcond |
436 | | |
437 | | protected: |
438 | | PROJ_INTERNAL GeographicCRS(const datum::GeodeticReferenceFramePtr &datumIn, |
439 | | const datum::DatumEnsemblePtr &datumEnsembleIn, |
440 | | const cs::EllipsoidalCSNNPtr &csIn); |
441 | | PROJ_INTERNAL GeographicCRS(const GeographicCRS &other); |
442 | | |
443 | | PROJ_INTERNAL static GeographicCRSNNPtr createEPSG_4267(); |
444 | | PROJ_INTERNAL static GeographicCRSNNPtr createEPSG_4269(); |
445 | | PROJ_INTERNAL static GeographicCRSNNPtr createEPSG_4326(); |
446 | | PROJ_INTERNAL static GeographicCRSNNPtr createOGC_CRS84(); |
447 | | PROJ_INTERNAL static GeographicCRSNNPtr createEPSG_4807(); |
448 | | PROJ_INTERNAL static GeographicCRSNNPtr createEPSG_4979(); |
449 | | |
450 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
451 | | |
452 | | INLINED_MAKE_SHARED |
453 | | |
454 | | private: |
455 | | PROJ_OPAQUE_PRIVATE_DATA |
456 | | |
457 | | GeographicCRS &operator=(const GeographicCRS &other) = delete; |
458 | | }; |
459 | | |
460 | | // --------------------------------------------------------------------------- |
461 | | |
462 | | /** \brief A coordinate reference system having a vertical reference frame and |
463 | | * a one-dimensional vertical coordinate system used for recording |
464 | | * gravity-related heights or depths. |
465 | | * |
466 | | * Vertical CRSs make use of the direction of gravity to define the concept of |
467 | | * height or depth, but the relationship with gravity may not be |
468 | | * straightforward. If the vertical reference frame is dynamic or if the |
469 | | * vertical CRS has an association to a velocity model then the CRS is dynamic, |
470 | | * else it is static. |
471 | | * |
472 | | * \note Ellipsoidal heights cannot be captured in a vertical coordinate |
473 | | * reference system. They exist only as an inseparable part of a 3D coordinate |
474 | | * tuple defined in a geographic 3D coordinate reference system. |
475 | | * |
476 | | * \remark Implements VerticalCRS from \ref ISO_19111_2019 |
477 | | */ |
478 | | class PROJ_GCC_DLL VerticalCRS : virtual public SingleCRS, |
479 | | public io::IPROJStringExportable { |
480 | | public: |
481 | | //! @cond Doxygen_Suppress |
482 | | PROJ_DLL ~VerticalCRS() override; |
483 | | //! @endcond |
484 | | |
485 | | PROJ_DLL const datum::VerticalReferenceFramePtr datum() const; |
486 | | PROJ_DLL const cs::VerticalCSNNPtr coordinateSystem() const; |
487 | | PROJ_DLL const std::vector<operation::TransformationNNPtr> & |
488 | | geoidModel() PROJ_PURE_DECL; |
489 | | PROJ_DLL const std::vector<operation::PointMotionOperationNNPtr> & |
490 | | velocityModel() PROJ_PURE_DECL; |
491 | | |
492 | | PROJ_DLL static VerticalCRSNNPtr |
493 | | create(const util::PropertyMap &properties, |
494 | | const datum::VerticalReferenceFrameNNPtr &datumIn, |
495 | | const cs::VerticalCSNNPtr &csIn); |
496 | | |
497 | | PROJ_DLL static VerticalCRSNNPtr |
498 | | create(const util::PropertyMap &properties, |
499 | | const datum::VerticalReferenceFramePtr &datumIn, |
500 | | const datum::DatumEnsemblePtr &datumEnsembleIn, |
501 | | const cs::VerticalCSNNPtr &csIn); |
502 | | |
503 | | PROJ_DLL std::list<std::pair<VerticalCRSNNPtr, int>> |
504 | | identify(const io::AuthorityFactoryPtr &authorityFactory) const; |
505 | | |
506 | | PROJ_PRIVATE : |
507 | | //! @cond Doxygen_Suppress |
508 | | PROJ_INTERNAL void |
509 | | addLinearUnitConvert(io::PROJStringFormatter *formatter) const; |
510 | | |
511 | | PROJ_INTERNAL const datum::VerticalReferenceFrameNNPtr |
512 | | datumNonNull(const io::DatabaseContextPtr &dbContext) const; |
513 | | |
514 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
515 | | const override; // throw(io::FormattingException) |
516 | | |
517 | | PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) |
518 | | const override; // throw(FormattingException) |
519 | | |
520 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
521 | | const override; // throw(FormattingException) |
522 | | |
523 | | PROJ_INTERNAL bool _isEquivalentTo( |
524 | | const util::IComparable *other, |
525 | | util::IComparable::Criterion criterion = |
526 | | util::IComparable::Criterion::STRICT, |
527 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
528 | | |
529 | | //! @endcond |
530 | | |
531 | | protected: |
532 | | PROJ_INTERNAL VerticalCRS(const datum::VerticalReferenceFramePtr &datumIn, |
533 | | const datum::DatumEnsemblePtr &datumEnsembleIn, |
534 | | const cs::VerticalCSNNPtr &csIn); |
535 | | PROJ_INTERNAL VerticalCRS(const VerticalCRS &other); |
536 | | |
537 | | PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>> |
538 | | _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; |
539 | | |
540 | | INLINED_MAKE_SHARED |
541 | | |
542 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
543 | | |
544 | | private: |
545 | | PROJ_OPAQUE_PRIVATE_DATA |
546 | | VerticalCRS &operator=(const VerticalCRS &other) = delete; |
547 | | }; |
548 | | |
549 | | // --------------------------------------------------------------------------- |
550 | | |
551 | | /** \brief Abstract class modelling a single coordinate reference system that |
552 | | * is defined through the application of a specified coordinate conversion to |
553 | | * the definition of a previously established single coordinate reference |
554 | | * system referred to as the base CRS. |
555 | | * |
556 | | * A derived coordinate reference system inherits its datum (or datum ensemble) |
557 | | * from its base CRS. The coordinate conversion between the base and derived |
558 | | * coordinate reference system is implemented using the parameters and |
559 | | * formula(s) specified in the definition of the coordinate conversion. |
560 | | * |
561 | | * \remark Implements DerivedCRS from \ref ISO_19111_2019 |
562 | | */ |
563 | | class PROJ_GCC_DLL DerivedCRS : virtual public SingleCRS { |
564 | | public: |
565 | | //! @cond Doxygen_Suppress |
566 | | PROJ_DLL ~DerivedCRS() override; |
567 | | //! @endcond |
568 | | |
569 | | PROJ_DLL const SingleCRSNNPtr &baseCRS() PROJ_PURE_DECL; |
570 | | PROJ_DLL const operation::ConversionNNPtr derivingConversion() const; |
571 | | |
572 | | PROJ_PRIVATE : |
573 | | //! @cond Doxygen_Suppress |
574 | | |
575 | | // Use this method with extreme care ! It should never be used |
576 | | // to recreate a new Derived/ProjectedCRS ! |
577 | | PROJ_INTERNAL const operation::ConversionNNPtr & |
578 | | derivingConversionRef() PROJ_PURE_DECL; |
579 | | |
580 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
581 | | const override; // throw(FormattingException) |
582 | | |
583 | | //! @endcond |
584 | | |
585 | | protected: |
586 | | PROJ_INTERNAL |
587 | | DerivedCRS(const SingleCRSNNPtr &baseCRSIn, |
588 | | const operation::ConversionNNPtr &derivingConversionIn, |
589 | | const cs::CoordinateSystemNNPtr &cs); |
590 | | PROJ_INTERNAL DerivedCRS(const DerivedCRS &other); |
591 | | |
592 | | PROJ_INTERNAL void setDerivingConversionCRS(); |
593 | | |
594 | | PROJ_INTERNAL void baseExportToWKT( |
595 | | io::WKTFormatter *formatter, const std::string &keyword, |
596 | | const std::string &baseKeyword) const; // throw(FormattingException) |
597 | | |
598 | | PROJ_INTERNAL bool _isEquivalentTo( |
599 | | const util::IComparable *other, |
600 | | util::IComparable::Criterion criterion = |
601 | | util::IComparable::Criterion::STRICT, |
602 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
603 | | |
604 | | PROJ_INTERNAL virtual const char *className() const = 0; |
605 | | |
606 | | private: |
607 | | PROJ_OPAQUE_PRIVATE_DATA |
608 | | DerivedCRS &operator=(const DerivedCRS &other) = delete; |
609 | | }; |
610 | | |
611 | | /** Shared pointer of DerivedCRS */ |
612 | | using DerivedCRSPtr = std::shared_ptr<DerivedCRS>; |
613 | | /** Non-null shared pointer of DerivedCRS */ |
614 | | using DerivedCRSNNPtr = util::nn<DerivedCRSPtr>; |
615 | | |
616 | | // --------------------------------------------------------------------------- |
617 | | |
618 | | class ProjectedCRS; |
619 | | /** Shared pointer of ProjectedCRS */ |
620 | | using ProjectedCRSPtr = std::shared_ptr<ProjectedCRS>; |
621 | | /** Non-null shared pointer of ProjectedCRS */ |
622 | | using ProjectedCRSNNPtr = util::nn<ProjectedCRSPtr>; |
623 | | |
624 | | /** \brief A derived coordinate reference system which has a geodetic |
625 | | * (usually geographic) coordinate reference system as its base CRS, thereby |
626 | | * inheriting a geodetic reference frame, and is converted using a map |
627 | | * projection. |
628 | | * |
629 | | * It has a Cartesian coordinate system, usually two-dimensional but may be |
630 | | * three-dimensional; in the 3D case the base geographic CRSs ellipsoidal |
631 | | * height is passed through unchanged and forms the vertical axis of the |
632 | | * projected CRS's Cartesian coordinate system. |
633 | | * |
634 | | * \remark Implements ProjectedCRS from \ref ISO_19111_2019 |
635 | | */ |
636 | | class PROJ_GCC_DLL ProjectedCRS final : public DerivedCRS, |
637 | | public io::IPROJStringExportable { |
638 | | public: |
639 | | //! @cond Doxygen_Suppress |
640 | | PROJ_DLL ~ProjectedCRS() override; |
641 | | //! @endcond |
642 | | |
643 | | PROJ_DLL const GeodeticCRSNNPtr &baseCRS() PROJ_PURE_DECL; |
644 | | PROJ_DLL const cs::CartesianCSNNPtr &coordinateSystem() PROJ_PURE_DECL; |
645 | | |
646 | | PROJ_DLL static ProjectedCRSNNPtr |
647 | | create(const util::PropertyMap &properties, |
648 | | const GeodeticCRSNNPtr &baseCRSIn, |
649 | | const operation::ConversionNNPtr &derivingConversionIn, |
650 | | const cs::CartesianCSNNPtr &csIn); |
651 | | |
652 | | PROJ_DLL std::list<std::pair<ProjectedCRSNNPtr, int>> |
653 | | identify(const io::AuthorityFactoryPtr &authorityFactory) const; |
654 | | |
655 | | PROJ_DLL ProjectedCRSNNPtr |
656 | | demoteTo2D(const std::string &newName, |
657 | | const io::DatabaseContextPtr &dbContext) const; |
658 | | |
659 | | PROJ_PRIVATE : |
660 | | //! @cond Doxygen_Suppress |
661 | | PROJ_INTERNAL void |
662 | | addUnitConvertAndAxisSwap(io::PROJStringFormatter *formatter, |
663 | | bool axisSpecFound) const; |
664 | | |
665 | | PROJ_INTERNAL static void addUnitConvertAndAxisSwap( |
666 | | const std::vector<cs::CoordinateSystemAxisNNPtr> &axisListIn, |
667 | | io::PROJStringFormatter *formatter, bool axisSpecFound); |
668 | | |
669 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
670 | | const override; // throw(io::FormattingException) |
671 | | |
672 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
673 | | const override; // throw(FormattingException) |
674 | | |
675 | | PROJ_FOR_TEST ProjectedCRSNNPtr alterParametersLinearUnit( |
676 | | const common::UnitOfMeasure &unit, bool convertToNewUnit) const; |
677 | | |
678 | | //! @endcond |
679 | | |
680 | | protected: |
681 | | PROJ_INTERNAL |
682 | | ProjectedCRS(const GeodeticCRSNNPtr &baseCRSIn, |
683 | | const operation::ConversionNNPtr &derivingConversionIn, |
684 | | const cs::CartesianCSNNPtr &csIn); |
685 | | PROJ_INTERNAL ProjectedCRS(const ProjectedCRS &other); |
686 | | |
687 | | PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) |
688 | | const override; // throw(FormattingException) |
689 | | |
690 | | PROJ_INTERNAL bool _isEquivalentTo( |
691 | | const util::IComparable *other, |
692 | | util::IComparable::Criterion criterion = |
693 | | util::IComparable::Criterion::STRICT, |
694 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
695 | | |
696 | | PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>> |
697 | | _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; |
698 | | |
699 | 0 | PROJ_INTERNAL const char *className() const override { |
700 | 0 | return "ProjectedCRS"; |
701 | 0 | } |
702 | | |
703 | | INLINED_MAKE_SHARED |
704 | | |
705 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
706 | | |
707 | | private: |
708 | | PROJ_OPAQUE_PRIVATE_DATA |
709 | | ProjectedCRS &operator=(const ProjectedCRS &other) = delete; |
710 | | }; |
711 | | |
712 | | // --------------------------------------------------------------------------- |
713 | | |
714 | | class TemporalCRS; |
715 | | /** Shared pointer of TemporalCRS */ |
716 | | using TemporalCRSPtr = std::shared_ptr<TemporalCRS>; |
717 | | /** Non-null shared pointer of TemporalCRS */ |
718 | | using TemporalCRSNNPtr = util::nn<TemporalCRSPtr>; |
719 | | |
720 | | /** \brief A coordinate reference system associated with a temporal datum and a |
721 | | * one-dimensional temporal coordinate system. |
722 | | * |
723 | | * \remark Implements TemporalCRS from \ref ISO_19111_2019 |
724 | | */ |
725 | | class PROJ_GCC_DLL TemporalCRS : virtual public SingleCRS { |
726 | | public: |
727 | | //! @cond Doxygen_Suppress |
728 | | PROJ_DLL ~TemporalCRS() override; |
729 | | //! @endcond |
730 | | |
731 | | PROJ_DLL const datum::TemporalDatumNNPtr datum() const; |
732 | | |
733 | | PROJ_DLL const cs::TemporalCSNNPtr coordinateSystem() const; |
734 | | |
735 | | PROJ_DLL static TemporalCRSNNPtr |
736 | | create(const util::PropertyMap &properties, |
737 | | const datum::TemporalDatumNNPtr &datumIn, |
738 | | const cs::TemporalCSNNPtr &csIn); |
739 | | |
740 | | //! @cond Doxygen_Suppress |
741 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
742 | | const override; // throw(io::FormattingException) |
743 | | |
744 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
745 | | const override; // throw(FormattingException) |
746 | | |
747 | | //! @endcond |
748 | | |
749 | | protected: |
750 | | PROJ_INTERNAL TemporalCRS(const datum::TemporalDatumNNPtr &datumIn, |
751 | | const cs::TemporalCSNNPtr &csIn); |
752 | | PROJ_INTERNAL TemporalCRS(const TemporalCRS &other); |
753 | | |
754 | | INLINED_MAKE_SHARED |
755 | | |
756 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
757 | | |
758 | | PROJ_INTERNAL bool _isEquivalentTo( |
759 | | const util::IComparable *other, |
760 | | util::IComparable::Criterion criterion = |
761 | | util::IComparable::Criterion::STRICT, |
762 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
763 | | |
764 | | private: |
765 | | PROJ_OPAQUE_PRIVATE_DATA |
766 | | TemporalCRS &operator=(const TemporalCRS &other) = delete; |
767 | | }; |
768 | | |
769 | | // --------------------------------------------------------------------------- |
770 | | |
771 | | class EngineeringCRS; |
772 | | /** Shared pointer of EngineeringCRS */ |
773 | | using EngineeringCRSPtr = std::shared_ptr<EngineeringCRS>; |
774 | | /** Non-null shared pointer of EngineeringCRS */ |
775 | | using EngineeringCRSNNPtr = util::nn<EngineeringCRSPtr>; |
776 | | |
777 | | /** \brief Contextually local coordinate reference system associated with an |
778 | | * engineering datum. |
779 | | * |
780 | | * It is applied either to activities on or near the surface of the Earth |
781 | | * without geodetic corrections, or on moving platforms such as road vehicles, |
782 | | * vessels, aircraft or spacecraft, or as the internal CRS of an image. |
783 | | * |
784 | | * In \ref WKT2, it maps to a ENGINEERINGCRS / ENGCRS keyword. In \ref WKT1, |
785 | | * it maps to a LOCAL_CS keyword. |
786 | | * |
787 | | * \remark Implements EngineeringCRS from \ref ISO_19111_2019 |
788 | | */ |
789 | | class PROJ_GCC_DLL EngineeringCRS : virtual public SingleCRS { |
790 | | public: |
791 | | //! @cond Doxygen_Suppress |
792 | | PROJ_DLL ~EngineeringCRS() override; |
793 | | //! @endcond |
794 | | |
795 | | PROJ_DLL const datum::EngineeringDatumNNPtr datum() const; |
796 | | |
797 | | PROJ_DLL static EngineeringCRSNNPtr |
798 | | create(const util::PropertyMap &properties, |
799 | | const datum::EngineeringDatumNNPtr &datumIn, |
800 | | const cs::CoordinateSystemNNPtr &csIn); |
801 | | |
802 | | //! @cond Doxygen_Suppress |
803 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
804 | | const override; // throw(io::FormattingException) |
805 | | |
806 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
807 | | const override; // throw(FormattingException) |
808 | | |
809 | | //! @endcond |
810 | | |
811 | | protected: |
812 | | PROJ_INTERNAL EngineeringCRS(const datum::EngineeringDatumNNPtr &datumIn, |
813 | | const cs::CoordinateSystemNNPtr &csIn); |
814 | | PROJ_INTERNAL EngineeringCRS(const EngineeringCRS &other); |
815 | | |
816 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
817 | | |
818 | | PROJ_INTERNAL bool _isEquivalentTo( |
819 | | const util::IComparable *other, |
820 | | util::IComparable::Criterion criterion = |
821 | | util::IComparable::Criterion::STRICT, |
822 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
823 | | |
824 | | INLINED_MAKE_SHARED |
825 | | |
826 | | private: |
827 | | PROJ_OPAQUE_PRIVATE_DATA |
828 | | EngineeringCRS &operator=(const EngineeringCRS &other) = delete; |
829 | | }; |
830 | | |
831 | | // --------------------------------------------------------------------------- |
832 | | |
833 | | class ParametricCRS; |
834 | | /** Shared pointer of ParametricCRS */ |
835 | | using ParametricCRSPtr = std::shared_ptr<ParametricCRS>; |
836 | | /** Non-null shared pointer of ParametricCRS */ |
837 | | using ParametricCRSNNPtr = util::nn<ParametricCRSPtr>; |
838 | | |
839 | | /** \brief Contextually local coordinate reference system associated with an |
840 | | * engineering datum. |
841 | | * |
842 | | * This is applied either to activities on or near the surface of the Earth |
843 | | * without geodetic corrections, or on moving platforms such as road vehicles |
844 | | * vessels, aircraft or spacecraft, or as the internal CRS of an image. |
845 | | * |
846 | | * \remark Implements ParametricCRS from \ref ISO_19111_2019 |
847 | | */ |
848 | | class PROJ_GCC_DLL ParametricCRS : virtual public SingleCRS { |
849 | | public: |
850 | | //! @cond Doxygen_Suppress |
851 | | PROJ_DLL ~ParametricCRS() override; |
852 | | //! @endcond |
853 | | |
854 | | PROJ_DLL const datum::ParametricDatumNNPtr datum() const; |
855 | | |
856 | | PROJ_DLL const cs::ParametricCSNNPtr coordinateSystem() const; |
857 | | |
858 | | PROJ_DLL static ParametricCRSNNPtr |
859 | | create(const util::PropertyMap &properties, |
860 | | const datum::ParametricDatumNNPtr &datumIn, |
861 | | const cs::ParametricCSNNPtr &csIn); |
862 | | |
863 | | //! @cond Doxygen_Suppress |
864 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
865 | | const override; // throw(io::FormattingException) |
866 | | |
867 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
868 | | const override; // throw(FormattingException) |
869 | | |
870 | | //! @endcond |
871 | | |
872 | | protected: |
873 | | PROJ_INTERNAL ParametricCRS(const datum::ParametricDatumNNPtr &datumIn, |
874 | | const cs::ParametricCSNNPtr &csIn); |
875 | | PROJ_INTERNAL ParametricCRS(const ParametricCRS &other); |
876 | | |
877 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
878 | | |
879 | | PROJ_INTERNAL bool _isEquivalentTo( |
880 | | const util::IComparable *other, |
881 | | util::IComparable::Criterion criterion = |
882 | | util::IComparable::Criterion::STRICT, |
883 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
884 | | |
885 | | INLINED_MAKE_SHARED |
886 | | |
887 | | private: |
888 | | PROJ_OPAQUE_PRIVATE_DATA |
889 | | ParametricCRS &operator=(const ParametricCRS &other) = delete; |
890 | | }; |
891 | | |
892 | | // --------------------------------------------------------------------------- |
893 | | |
894 | | /** \brief Exception thrown when attempting to create an invalid compound CRS |
895 | | */ |
896 | | class PROJ_GCC_DLL InvalidCompoundCRSException : public util::Exception { |
897 | | public: |
898 | | //! @cond Doxygen_Suppress |
899 | | PROJ_INTERNAL explicit InvalidCompoundCRSException(const char *message); |
900 | | PROJ_INTERNAL explicit InvalidCompoundCRSException( |
901 | | const std::string &message); |
902 | | PROJ_DLL |
903 | | InvalidCompoundCRSException(const InvalidCompoundCRSException &other); |
904 | | PROJ_DLL ~InvalidCompoundCRSException() override; |
905 | | //! @endcond |
906 | | }; |
907 | | |
908 | | // --------------------------------------------------------------------------- |
909 | | |
910 | | /** \brief A coordinate reference system describing the position of points |
911 | | * through two or more independent single coordinate reference systems. |
912 | | * |
913 | | * \note Two coordinate reference systems are independent of each other |
914 | | * if coordinate values in one cannot be converted or transformed into |
915 | | * coordinate values in the other. |
916 | | * |
917 | | * \note As a departure to \ref ISO_19111_2019, we allow to build a CompoundCRS |
918 | | * from CRS objects, whereas ISO19111:2019 restricts the components to |
919 | | * SingleCRS. |
920 | | * |
921 | | * \remark Implements CompoundCRS from \ref ISO_19111_2019 |
922 | | */ |
923 | | class PROJ_GCC_DLL CompoundCRS final : public CRS, |
924 | | public io::IPROJStringExportable { |
925 | | public: |
926 | | //! @cond Doxygen_Suppress |
927 | | PROJ_DLL ~CompoundCRS() override; |
928 | | //! @endcond |
929 | | |
930 | | PROJ_DLL const std::vector<CRSNNPtr> & |
931 | | componentReferenceSystems() PROJ_PURE_DECL; |
932 | | |
933 | | PROJ_DLL std::list<std::pair<CompoundCRSNNPtr, int>> |
934 | | identify(const io::AuthorityFactoryPtr &authorityFactory) const; |
935 | | |
936 | | //! @cond Doxygen_Suppress |
937 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
938 | | const override; // throw(io::FormattingException) |
939 | | //! @endcond |
940 | | |
941 | | PROJ_DLL static CompoundCRSNNPtr |
942 | | create(const util::PropertyMap &properties, |
943 | | const std::vector<CRSNNPtr> |
944 | | &components); // throw InvalidCompoundCRSException |
945 | | |
946 | | //! @cond Doxygen_Suppress |
947 | | PROJ_INTERNAL static CRSNNPtr |
948 | | createLax(const util::PropertyMap &properties, |
949 | | const std::vector<CRSNNPtr> &components, |
950 | | const io::DatabaseContextPtr |
951 | | &dbContext); // throw InvalidCompoundCRSException |
952 | | //! @endcond |
953 | | |
954 | | protected: |
955 | | // relaxed: standard say SingleCRSNNPtr |
956 | | PROJ_INTERNAL explicit CompoundCRS(const std::vector<CRSNNPtr> &components); |
957 | | PROJ_INTERNAL CompoundCRS(const CompoundCRS &other); |
958 | | |
959 | | PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) |
960 | | const override; // throw(FormattingException) |
961 | | |
962 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
963 | | const override; // throw(FormattingException) |
964 | | |
965 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
966 | | |
967 | | PROJ_INTERNAL bool _isEquivalentTo( |
968 | | const util::IComparable *other, |
969 | | util::IComparable::Criterion criterion = |
970 | | util::IComparable::Criterion::STRICT, |
971 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
972 | | |
973 | | PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>> |
974 | | _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; |
975 | | |
976 | | INLINED_MAKE_SHARED |
977 | | |
978 | | private: |
979 | | PROJ_OPAQUE_PRIVATE_DATA |
980 | | CompoundCRS &operator=(const CompoundCRS &other) = delete; |
981 | | }; |
982 | | |
983 | | // --------------------------------------------------------------------------- |
984 | | |
985 | | /** \brief A coordinate reference system with an associated transformation to |
986 | | * a target/hub CRS. |
987 | | * |
988 | | * The definition of a CRS is not dependent upon any relationship to an |
989 | | * independent CRS. However in an implementation that merges datasets |
990 | | * referenced to differing CRSs, it is sometimes useful to associate the |
991 | | * definition of the transformation that has been used with the CRS definition. |
992 | | * This facilitates the interrelationship of CRS by concatenating |
993 | | * transformations via a common or hub CRS. This is sometimes referred to as |
994 | | * "early-binding". \ref WKT2 permits the association of an abridged coordinate |
995 | | * transformation description with a coordinate reference system description in |
996 | | * a single text string. In a BoundCRS, the abridged coordinate transformation |
997 | | * is applied to the source CRS with the target CRS being the common or hub |
998 | | * system. |
999 | | * |
1000 | | * Coordinates referring to a BoundCRS are expressed into its source/base CRS. |
1001 | | * |
1002 | | * This abstraction can for example model the concept of TOWGS84 datum shift |
1003 | | * present in \ref WKT1. |
1004 | | * |
1005 | | * \note Contrary to other CRS classes of this package, there is no |
1006 | | * \ref ISO_19111_2019 modelling of a BoundCRS. |
1007 | | * |
1008 | | * \remark Implements BoundCRS from \ref WKT2 |
1009 | | */ |
1010 | | class PROJ_GCC_DLL BoundCRS final : public CRS, |
1011 | | public io::IPROJStringExportable { |
1012 | | public: |
1013 | | //! @cond Doxygen_Suppress |
1014 | | PROJ_DLL ~BoundCRS() override; |
1015 | | //! @endcond |
1016 | | |
1017 | | PROJ_DLL const CRSNNPtr &baseCRS() PROJ_PURE_DECL; |
1018 | | PROJ_DLL CRSNNPtr baseCRSWithCanonicalBoundCRS() const; |
1019 | | |
1020 | | PROJ_DLL const CRSNNPtr &hubCRS() PROJ_PURE_DECL; |
1021 | | PROJ_DLL const operation::TransformationNNPtr & |
1022 | | transformation() PROJ_PURE_DECL; |
1023 | | |
1024 | | //! @cond Doxygen_Suppress |
1025 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
1026 | | const override; // throw(io::FormattingException) |
1027 | | //! @endcond |
1028 | | |
1029 | | PROJ_DLL static BoundCRSNNPtr |
1030 | | create(const util::PropertyMap &properties, const CRSNNPtr &baseCRSIn, |
1031 | | const CRSNNPtr &hubCRSIn, |
1032 | | const operation::TransformationNNPtr &transformationIn); |
1033 | | |
1034 | | PROJ_DLL static BoundCRSNNPtr |
1035 | | create(const CRSNNPtr &baseCRSIn, const CRSNNPtr &hubCRSIn, |
1036 | | const operation::TransformationNNPtr &transformationIn); |
1037 | | |
1038 | | PROJ_DLL static BoundCRSNNPtr |
1039 | | createFromTOWGS84(const CRSNNPtr &baseCRSIn, |
1040 | | const std::vector<double> &TOWGS84Parameters); |
1041 | | |
1042 | | PROJ_DLL static BoundCRSNNPtr |
1043 | | createFromNadgrids(const CRSNNPtr &baseCRSIn, const std::string &filename); |
1044 | | |
1045 | | protected: |
1046 | | PROJ_INTERNAL |
1047 | | BoundCRS(const CRSNNPtr &baseCRSIn, const CRSNNPtr &hubCRSIn, |
1048 | | const operation::TransformationNNPtr &transformationIn); |
1049 | | PROJ_INTERNAL BoundCRS(const BoundCRS &other); |
1050 | | |
1051 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
1052 | | |
1053 | | PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) |
1054 | | const override; // throw(FormattingException) |
1055 | | |
1056 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
1057 | | const override; // throw(FormattingException) |
1058 | | |
1059 | | PROJ_INTERNAL bool _isEquivalentTo( |
1060 | | const util::IComparable *other, |
1061 | | util::IComparable::Criterion criterion = |
1062 | | util::IComparable::Criterion::STRICT, |
1063 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
1064 | | |
1065 | | PROJ_INTERNAL BoundCRSNNPtr shallowCloneAsBoundCRS() const; |
1066 | | PROJ_INTERNAL bool isTOWGS84Compatible() const; |
1067 | | PROJ_INTERNAL std::string getHDatumPROJ4GRIDS() const; |
1068 | | PROJ_INTERNAL std::string |
1069 | | getVDatumPROJ4GRIDS(const crs::GeographicCRS *geogCRSOfCompoundCRS, |
1070 | | const char **outGeoidCRSValue) const; |
1071 | | |
1072 | | PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>> |
1073 | | _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; |
1074 | | |
1075 | | INLINED_MAKE_SHARED |
1076 | | |
1077 | | private: |
1078 | | PROJ_OPAQUE_PRIVATE_DATA |
1079 | | BoundCRS &operator=(const BoundCRS &other) = delete; |
1080 | | }; |
1081 | | |
1082 | | // --------------------------------------------------------------------------- |
1083 | | |
1084 | | class DerivedGeodeticCRS; |
1085 | | /** Shared pointer of DerivedGeodeticCRS */ |
1086 | | using DerivedGeodeticCRSPtr = std::shared_ptr<DerivedGeodeticCRS>; |
1087 | | /** Non-null shared pointer of DerivedGeodeticCRS */ |
1088 | | using DerivedGeodeticCRSNNPtr = util::nn<DerivedGeodeticCRSPtr>; |
1089 | | |
1090 | | /** \brief A derived coordinate reference system which has either a geodetic |
1091 | | * or a geographic coordinate reference system as its base CRS, thereby |
1092 | | * inheriting a geodetic reference frame, and associated with a 3D Cartesian |
1093 | | * or spherical coordinate system. |
1094 | | * |
1095 | | * \remark Implements DerivedGeodeticCRS from \ref ISO_19111_2019 |
1096 | | */ |
1097 | | class PROJ_GCC_DLL DerivedGeodeticCRS final : public GeodeticCRS, |
1098 | | public DerivedCRS { |
1099 | | public: |
1100 | | //! @cond Doxygen_Suppress |
1101 | | PROJ_DLL ~DerivedGeodeticCRS() override; |
1102 | | //! @endcond |
1103 | | |
1104 | | PROJ_DLL const GeodeticCRSNNPtr baseCRS() const; |
1105 | | |
1106 | | PROJ_DLL static DerivedGeodeticCRSNNPtr |
1107 | | create(const util::PropertyMap &properties, |
1108 | | const GeodeticCRSNNPtr &baseCRSIn, |
1109 | | const operation::ConversionNNPtr &derivingConversionIn, |
1110 | | const cs::CartesianCSNNPtr &csIn); |
1111 | | |
1112 | | PROJ_DLL static DerivedGeodeticCRSNNPtr |
1113 | | create(const util::PropertyMap &properties, |
1114 | | const GeodeticCRSNNPtr &baseCRSIn, |
1115 | | const operation::ConversionNNPtr &derivingConversionIn, |
1116 | | const cs::SphericalCSNNPtr &csIn); |
1117 | | |
1118 | | //! @cond Doxygen_Suppress |
1119 | | void _exportToWKT(io::WKTFormatter *formatter) |
1120 | | const override; // throw(io::FormattingException) |
1121 | | |
1122 | | PROJ_INTERNAL void |
1123 | 0 | _exportToJSON(io::JSONFormatter *formatter) const override { |
1124 | 0 | return DerivedCRS::_exportToJSON(formatter); |
1125 | 0 | } |
1126 | | |
1127 | | //! @endcond |
1128 | | |
1129 | | protected: |
1130 | | PROJ_INTERNAL |
1131 | | DerivedGeodeticCRS(const GeodeticCRSNNPtr &baseCRSIn, |
1132 | | const operation::ConversionNNPtr &derivingConversionIn, |
1133 | | const cs::CartesianCSNNPtr &csIn); |
1134 | | PROJ_INTERNAL |
1135 | | DerivedGeodeticCRS(const GeodeticCRSNNPtr &baseCRSIn, |
1136 | | const operation::ConversionNNPtr &derivingConversionIn, |
1137 | | const cs::SphericalCSNNPtr &csIn); |
1138 | | PROJ_INTERNAL DerivedGeodeticCRS(const DerivedGeodeticCRS &other); |
1139 | | |
1140 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
1141 | | |
1142 | | PROJ_INTERNAL bool _isEquivalentTo( |
1143 | | const util::IComparable *other, |
1144 | | util::IComparable::Criterion criterion = |
1145 | | util::IComparable::Criterion::STRICT, |
1146 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
1147 | | |
1148 | | PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>> |
1149 | | _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; |
1150 | | |
1151 | | // cppcheck-suppress functionStatic |
1152 | | PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) |
1153 | | const override; // throw(FormattingException) |
1154 | | |
1155 | 0 | PROJ_INTERNAL const char *className() const override { |
1156 | 0 | return "DerivedGeodeticCRS"; |
1157 | 0 | } |
1158 | | |
1159 | | INLINED_MAKE_SHARED |
1160 | | |
1161 | | private: |
1162 | | PROJ_OPAQUE_PRIVATE_DATA |
1163 | | DerivedGeodeticCRS &operator=(const DerivedGeodeticCRS &other) = delete; |
1164 | | }; |
1165 | | |
1166 | | // --------------------------------------------------------------------------- |
1167 | | |
1168 | | class DerivedGeographicCRS; |
1169 | | /** Shared pointer of DerivedGeographicCRS */ |
1170 | | using DerivedGeographicCRSPtr = std::shared_ptr<DerivedGeographicCRS>; |
1171 | | /** Non-null shared pointer of DerivedGeographicCRS */ |
1172 | | using DerivedGeographicCRSNNPtr = util::nn<DerivedGeographicCRSPtr>; |
1173 | | |
1174 | | /** \brief A derived coordinate reference system which has either a geodetic or |
1175 | | * a geographic coordinate reference system as its base CRS, thereby inheriting |
1176 | | * a geodetic reference frame, and an ellipsoidal coordinate system. |
1177 | | * |
1178 | | * A derived geographic CRS can be based on a geodetic CRS only if that |
1179 | | * geodetic CRS definition includes an ellipsoid. |
1180 | | * |
1181 | | * \remark Implements DerivedGeographicCRS from \ref ISO_19111_2019 |
1182 | | */ |
1183 | | class PROJ_GCC_DLL DerivedGeographicCRS final : public GeographicCRS, |
1184 | | public DerivedCRS { |
1185 | | public: |
1186 | | //! @cond Doxygen_Suppress |
1187 | | PROJ_DLL ~DerivedGeographicCRS() override; |
1188 | | //! @endcond |
1189 | | |
1190 | | PROJ_DLL const GeodeticCRSNNPtr baseCRS() const; |
1191 | | |
1192 | | PROJ_DLL static DerivedGeographicCRSNNPtr |
1193 | | create(const util::PropertyMap &properties, |
1194 | | const GeodeticCRSNNPtr &baseCRSIn, |
1195 | | const operation::ConversionNNPtr &derivingConversionIn, |
1196 | | const cs::EllipsoidalCSNNPtr &csIn); |
1197 | | |
1198 | | PROJ_DLL DerivedGeographicCRSNNPtr |
1199 | | demoteTo2D(const std::string &newName, |
1200 | | const io::DatabaseContextPtr &dbContext) const; |
1201 | | |
1202 | | //! @cond Doxygen_Suppress |
1203 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
1204 | | const override; // throw(io::FormattingException) |
1205 | | |
1206 | | PROJ_INTERNAL void |
1207 | 0 | _exportToJSON(io::JSONFormatter *formatter) const override { |
1208 | 0 | return DerivedCRS::_exportToJSON(formatter); |
1209 | 0 | } |
1210 | | |
1211 | | //! @endcond |
1212 | | |
1213 | | protected: |
1214 | | PROJ_INTERNAL |
1215 | | DerivedGeographicCRS(const GeodeticCRSNNPtr &baseCRSIn, |
1216 | | const operation::ConversionNNPtr &derivingConversionIn, |
1217 | | const cs::EllipsoidalCSNNPtr &csIn); |
1218 | | PROJ_INTERNAL DerivedGeographicCRS(const DerivedGeographicCRS &other); |
1219 | | |
1220 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
1221 | | |
1222 | | PROJ_INTERNAL bool _isEquivalentTo( |
1223 | | const util::IComparable *other, |
1224 | | util::IComparable::Criterion criterion = |
1225 | | util::IComparable::Criterion::STRICT, |
1226 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
1227 | | |
1228 | | PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>> |
1229 | | _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; |
1230 | | |
1231 | 0 | PROJ_INTERNAL const char *className() const override { |
1232 | 0 | return "DerivedGeographicCRS"; |
1233 | 0 | } |
1234 | | |
1235 | | // cppcheck-suppress functionStatic |
1236 | | PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) |
1237 | | const override; // throw(FormattingException) |
1238 | | |
1239 | | INLINED_MAKE_SHARED |
1240 | | |
1241 | | private: |
1242 | | PROJ_OPAQUE_PRIVATE_DATA |
1243 | | DerivedGeographicCRS &operator=(const DerivedGeographicCRS &other) = delete; |
1244 | | }; |
1245 | | |
1246 | | // --------------------------------------------------------------------------- |
1247 | | |
1248 | | class DerivedProjectedCRS; |
1249 | | /** Shared pointer of DerivedProjectedCRS */ |
1250 | | using DerivedProjectedCRSPtr = std::shared_ptr<DerivedProjectedCRS>; |
1251 | | /** Non-null shared pointer of DerivedProjectedCRS */ |
1252 | | using DerivedProjectedCRSNNPtr = util::nn<DerivedProjectedCRSPtr>; |
1253 | | |
1254 | | /** \brief A derived coordinate reference system which has a projected |
1255 | | * coordinate reference system as its base CRS, thereby inheriting a geodetic |
1256 | | * reference frame, but also inheriting the distortion characteristics of the |
1257 | | * base projected CRS. |
1258 | | * |
1259 | | * A DerivedProjectedCRS is not a ProjectedCRS. |
1260 | | * |
1261 | | * \remark Implements DerivedProjectedCRS from \ref ISO_19111_2019 |
1262 | | */ |
1263 | | class PROJ_GCC_DLL DerivedProjectedCRS final : public DerivedCRS { |
1264 | | public: |
1265 | | //! @cond Doxygen_Suppress |
1266 | | PROJ_DLL ~DerivedProjectedCRS() override; |
1267 | | //! @endcond |
1268 | | |
1269 | | PROJ_DLL const ProjectedCRSNNPtr baseCRS() const; |
1270 | | |
1271 | | PROJ_DLL static DerivedProjectedCRSNNPtr |
1272 | | create(const util::PropertyMap &properties, |
1273 | | const ProjectedCRSNNPtr &baseCRSIn, |
1274 | | const operation::ConversionNNPtr &derivingConversionIn, |
1275 | | const cs::CoordinateSystemNNPtr &csIn); |
1276 | | |
1277 | | PROJ_DLL DerivedProjectedCRSNNPtr |
1278 | | demoteTo2D(const std::string &newName, |
1279 | | const io::DatabaseContextPtr &dbContext) const; |
1280 | | |
1281 | | //! @cond Doxygen_Suppress |
1282 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
1283 | | const override; // throw(io::FormattingException) |
1284 | | |
1285 | | PROJ_INTERNAL void |
1286 | | addUnitConvertAndAxisSwap(io::PROJStringFormatter *formatter) const; |
1287 | | //! @endcond |
1288 | | |
1289 | | protected: |
1290 | | PROJ_INTERNAL |
1291 | | DerivedProjectedCRS(const ProjectedCRSNNPtr &baseCRSIn, |
1292 | | const operation::ConversionNNPtr &derivingConversionIn, |
1293 | | const cs::CoordinateSystemNNPtr &csIn); |
1294 | | PROJ_INTERNAL DerivedProjectedCRS(const DerivedProjectedCRS &other); |
1295 | | |
1296 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
1297 | | |
1298 | | PROJ_INTERNAL bool _isEquivalentTo( |
1299 | | const util::IComparable *other, |
1300 | | util::IComparable::Criterion criterion = |
1301 | | util::IComparable::Criterion::STRICT, |
1302 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
1303 | | |
1304 | 0 | PROJ_INTERNAL const char *className() const override { |
1305 | 0 | return "DerivedProjectedCRS"; |
1306 | 0 | } |
1307 | | |
1308 | | INLINED_MAKE_SHARED |
1309 | | |
1310 | | private: |
1311 | | PROJ_OPAQUE_PRIVATE_DATA |
1312 | | DerivedProjectedCRS &operator=(const DerivedProjectedCRS &other) = delete; |
1313 | | }; |
1314 | | |
1315 | | // --------------------------------------------------------------------------- |
1316 | | |
1317 | | class DerivedVerticalCRS; |
1318 | | /** Shared pointer of DerivedVerticalCRS */ |
1319 | | using DerivedVerticalCRSPtr = std::shared_ptr<DerivedVerticalCRS>; |
1320 | | /** Non-null shared pointer of DerivedVerticalCRS */ |
1321 | | using DerivedVerticalCRSNNPtr = util::nn<DerivedVerticalCRSPtr>; |
1322 | | |
1323 | | /** \brief A derived coordinate reference system which has a vertical |
1324 | | * coordinate reference system as its base CRS, thereby inheriting a vertical |
1325 | | * reference frame, and a vertical coordinate system. |
1326 | | * |
1327 | | * \remark Implements DerivedVerticalCRS from \ref ISO_19111_2019 |
1328 | | */ |
1329 | | class PROJ_GCC_DLL DerivedVerticalCRS final : public VerticalCRS, |
1330 | | public DerivedCRS { |
1331 | | public: |
1332 | | //! @cond Doxygen_Suppress |
1333 | | PROJ_DLL ~DerivedVerticalCRS() override; |
1334 | | //! @endcond |
1335 | | |
1336 | | PROJ_DLL const VerticalCRSNNPtr baseCRS() const; |
1337 | | |
1338 | | PROJ_DLL static DerivedVerticalCRSNNPtr |
1339 | | create(const util::PropertyMap &properties, |
1340 | | const VerticalCRSNNPtr &baseCRSIn, |
1341 | | const operation::ConversionNNPtr &derivingConversionIn, |
1342 | | const cs::VerticalCSNNPtr &csIn); |
1343 | | |
1344 | | //! @cond Doxygen_Suppress |
1345 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
1346 | | const override; // throw(io::FormattingException) |
1347 | | |
1348 | | PROJ_INTERNAL void |
1349 | 0 | _exportToJSON(io::JSONFormatter *formatter) const override { |
1350 | 0 | return DerivedCRS::_exportToJSON(formatter); |
1351 | 0 | } |
1352 | | |
1353 | | //! @endcond |
1354 | | |
1355 | | protected: |
1356 | | PROJ_INTERNAL |
1357 | | DerivedVerticalCRS(const VerticalCRSNNPtr &baseCRSIn, |
1358 | | const operation::ConversionNNPtr &derivingConversionIn, |
1359 | | const cs::VerticalCSNNPtr &csIn); |
1360 | | PROJ_INTERNAL DerivedVerticalCRS(const DerivedVerticalCRS &other); |
1361 | | |
1362 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
1363 | | |
1364 | | PROJ_INTERNAL bool _isEquivalentTo( |
1365 | | const util::IComparable *other, |
1366 | | util::IComparable::Criterion criterion = |
1367 | | util::IComparable::Criterion::STRICT, |
1368 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
1369 | | |
1370 | | PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>> |
1371 | | _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; |
1372 | | |
1373 | 0 | PROJ_INTERNAL const char *className() const override { |
1374 | 0 | return "DerivedVerticalCRS"; |
1375 | 0 | } |
1376 | | |
1377 | | // cppcheck-suppress functionStatic |
1378 | | PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) |
1379 | | const override; // throw(FormattingException) |
1380 | | |
1381 | | INLINED_MAKE_SHARED |
1382 | | |
1383 | | private: |
1384 | | PROJ_OPAQUE_PRIVATE_DATA |
1385 | | DerivedVerticalCRS &operator=(const DerivedVerticalCRS &other) = delete; |
1386 | | }; |
1387 | | |
1388 | | // --------------------------------------------------------------------------- |
1389 | | |
1390 | | /** \brief Template representing a derived coordinate reference system. |
1391 | | */ |
1392 | | template <class DerivedCRSTraits> |
1393 | | class PROJ_GCC_DLL DerivedCRSTemplate final : public DerivedCRSTraits::BaseType, |
1394 | | public DerivedCRS { |
1395 | | protected: |
1396 | | /** Base type */ |
1397 | | typedef typename DerivedCRSTraits::BaseType BaseType; |
1398 | | /** CSType */ |
1399 | | typedef typename DerivedCRSTraits::CSType CSType; |
1400 | | |
1401 | | public: |
1402 | | //! @cond Doxygen_Suppress |
1403 | 0 | PROJ_DLL ~DerivedCRSTemplate() override; Unexecuted instantiation: osgeo::proj::crs::DerivedCRSTemplate<osgeo::proj::crs::DerivedEngineeringCRSTraits>::~DerivedCRSTemplate() Unexecuted instantiation: osgeo::proj::crs::DerivedCRSTemplate<osgeo::proj::crs::DerivedParametricCRSTraits>::~DerivedCRSTemplate() Unexecuted instantiation: osgeo::proj::crs::DerivedCRSTemplate<osgeo::proj::crs::DerivedTemporalCRSTraits>::~DerivedCRSTemplate() |
1404 | | //! @endcond |
1405 | | |
1406 | | /** Non-null shared pointer of DerivedCRSTemplate */ |
1407 | | typedef typename util::nn<std::shared_ptr<DerivedCRSTemplate>> NNPtr; |
1408 | | /** Non-null shared pointer of BaseType */ |
1409 | | typedef util::nn<std::shared_ptr<BaseType>> BaseNNPtr; |
1410 | | /** Non-null shared pointer of CSType */ |
1411 | | typedef util::nn<std::shared_ptr<CSType>> CSNNPtr; |
1412 | | |
1413 | | /** \brief Return the base CRS of a DerivedCRSTemplate. |
1414 | | * |
1415 | | * @return the base CRS. |
1416 | | */ |
1417 | | PROJ_DLL const BaseNNPtr baseCRS() const; |
1418 | | |
1419 | | /** \brief Instantiate a DerivedCRSTemplate from a base CRS, a deriving |
1420 | | * conversion and a cs::CoordinateSystem. |
1421 | | * |
1422 | | * @param properties See \ref general_properties. |
1423 | | * At minimum the name should be defined. |
1424 | | * @param baseCRSIn base CRS. |
1425 | | * @param derivingConversionIn the deriving conversion from the base CRS to |
1426 | | * this |
1427 | | * CRS. |
1428 | | * @param csIn the coordinate system. |
1429 | | * @return new DerivedCRSTemplate. |
1430 | | */ |
1431 | | PROJ_DLL static NNPtr |
1432 | | create(const util::PropertyMap &properties, const BaseNNPtr &baseCRSIn, |
1433 | | const operation::ConversionNNPtr &derivingConversionIn, |
1434 | | const CSNNPtr &csIn); |
1435 | | |
1436 | | //! @cond Doxygen_Suppress |
1437 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
1438 | | const override; // throw(io::FormattingException) |
1439 | | |
1440 | | PROJ_INTERNAL void |
1441 | 0 | _exportToJSON(io::JSONFormatter *formatter) const override { |
1442 | 0 | return DerivedCRS::_exportToJSON(formatter); |
1443 | 0 | } Unexecuted instantiation: osgeo::proj::crs::DerivedCRSTemplate<osgeo::proj::crs::DerivedEngineeringCRSTraits>::_exportToJSON(osgeo::proj::io::JSONFormatter*) const Unexecuted instantiation: osgeo::proj::crs::DerivedCRSTemplate<osgeo::proj::crs::DerivedParametricCRSTraits>::_exportToJSON(osgeo::proj::io::JSONFormatter*) const Unexecuted instantiation: osgeo::proj::crs::DerivedCRSTemplate<osgeo::proj::crs::DerivedTemporalCRSTraits>::_exportToJSON(osgeo::proj::io::JSONFormatter*) const |
1444 | | //! @endcond |
1445 | | |
1446 | | protected: |
1447 | | PROJ_INTERNAL |
1448 | | DerivedCRSTemplate(const BaseNNPtr &baseCRSIn, |
1449 | | const operation::ConversionNNPtr &derivingConversionIn, |
1450 | | const CSNNPtr &csIn); |
1451 | | // cppcheck-suppress noExplicitConstructor |
1452 | | PROJ_INTERNAL DerivedCRSTemplate(const DerivedCRSTemplate &other); |
1453 | | |
1454 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
1455 | | |
1456 | | PROJ_INTERNAL bool _isEquivalentTo( |
1457 | | const util::IComparable *other, |
1458 | | util::IComparable::Criterion criterion = |
1459 | | util::IComparable::Criterion::STRICT, |
1460 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
1461 | | |
1462 | | PROJ_INTERNAL const char *className() const override; |
1463 | | |
1464 | | INLINED_MAKE_SHARED |
1465 | | |
1466 | | private: |
1467 | | struct PROJ_INTERNAL Private; |
1468 | | std::unique_ptr<Private> d; |
1469 | | |
1470 | | DerivedCRSTemplate &operator=(const DerivedCRSTemplate &other) = delete; |
1471 | | }; |
1472 | | |
1473 | | // --------------------------------------------------------------------------- |
1474 | | |
1475 | | //! @cond Doxygen_Suppress |
1476 | | struct PROJ_GCC_DLL DerivedEngineeringCRSTraits { |
1477 | | typedef EngineeringCRS BaseType; |
1478 | | typedef cs::CoordinateSystem CSType; |
1479 | | // old x86_64-w64-mingw32-g++ has issues with static variables. use method |
1480 | | // instead |
1481 | | inline static const std::string &CRSName(); |
1482 | | inline static const std::string &WKTKeyword(); |
1483 | | inline static const std::string &WKTBaseKeyword(); |
1484 | | static const bool wkt2_2019_only = true; |
1485 | | }; |
1486 | | //! @endcond |
1487 | | |
1488 | | /** \brief A derived coordinate reference system which has an engineering |
1489 | | * coordinate reference system as its base CRS, thereby inheriting an |
1490 | | * engineering datum, and is associated with one of the coordinate system |
1491 | | * types for an EngineeringCRS |
1492 | | * |
1493 | | * \remark Implements DerivedEngineeringCRS from \ref ISO_19111_2019 |
1494 | | */ |
1495 | | #ifdef DOXYGEN_ENABLED |
1496 | | class DerivedEngineeringCRS |
1497 | | : public DerivedCRSTemplate<DerivedEngineeringCRSTraits> {}; |
1498 | | #else |
1499 | | using DerivedEngineeringCRS = DerivedCRSTemplate<DerivedEngineeringCRSTraits>; |
1500 | | #endif |
1501 | | |
1502 | | #ifndef DO_NOT_DEFINE_EXTERN_DERIVED_CRS_TEMPLATE |
1503 | | extern template class DerivedCRSTemplate<DerivedEngineeringCRSTraits>; |
1504 | | #endif |
1505 | | |
1506 | | /** Shared pointer of DerivedEngineeringCRS */ |
1507 | | using DerivedEngineeringCRSPtr = std::shared_ptr<DerivedEngineeringCRS>; |
1508 | | /** Non-null shared pointer of DerivedEngineeringCRS */ |
1509 | | using DerivedEngineeringCRSNNPtr = util::nn<DerivedEngineeringCRSPtr>; |
1510 | | |
1511 | | // --------------------------------------------------------------------------- |
1512 | | |
1513 | | //! @cond Doxygen_Suppress |
1514 | | struct PROJ_GCC_DLL DerivedParametricCRSTraits { |
1515 | | typedef ParametricCRS BaseType; |
1516 | | typedef cs::ParametricCS CSType; |
1517 | | // old x86_64-w64-mingw32-g++ has issues with static variables. use method |
1518 | | // instead |
1519 | | inline static const std::string &CRSName(); |
1520 | | inline static const std::string &WKTKeyword(); |
1521 | | inline static const std::string &WKTBaseKeyword(); |
1522 | | static const bool wkt2_2019_only = false; |
1523 | | }; |
1524 | | //! @endcond |
1525 | | |
1526 | | /** \brief A derived coordinate reference system which has a parametric |
1527 | | * coordinate reference system as its base CRS, thereby inheriting a parametric |
1528 | | * datum, and a parametric coordinate system. |
1529 | | * |
1530 | | * \remark Implements DerivedParametricCRS from \ref ISO_19111_2019 |
1531 | | */ |
1532 | | #ifdef DOXYGEN_ENABLED |
1533 | | class DerivedParametricCRS |
1534 | | : public DerivedCRSTemplate<DerivedParametricCRSTraits> {}; |
1535 | | #else |
1536 | | using DerivedParametricCRS = DerivedCRSTemplate<DerivedParametricCRSTraits>; |
1537 | | #endif |
1538 | | |
1539 | | #ifndef DO_NOT_DEFINE_EXTERN_DERIVED_CRS_TEMPLATE |
1540 | | extern template class DerivedCRSTemplate<DerivedParametricCRSTraits>; |
1541 | | #endif |
1542 | | |
1543 | | /** Shared pointer of DerivedParametricCRS */ |
1544 | | using DerivedParametricCRSPtr = std::shared_ptr<DerivedParametricCRS>; |
1545 | | /** Non-null shared pointer of DerivedParametricCRS */ |
1546 | | using DerivedParametricCRSNNPtr = util::nn<DerivedParametricCRSPtr>; |
1547 | | |
1548 | | // --------------------------------------------------------------------------- |
1549 | | |
1550 | | //! @cond Doxygen_Suppress |
1551 | | struct PROJ_GCC_DLL DerivedTemporalCRSTraits { |
1552 | | typedef TemporalCRS BaseType; |
1553 | | typedef cs::TemporalCS CSType; |
1554 | | // old x86_64-w64-mingw32-g++ has issues with static variables. use method |
1555 | | // instead |
1556 | | inline static const std::string &CRSName(); |
1557 | | inline static const std::string &WKTKeyword(); |
1558 | | inline static const std::string &WKTBaseKeyword(); |
1559 | | static const bool wkt2_2019_only = false; |
1560 | | }; |
1561 | | //! @endcond |
1562 | | |
1563 | | /** \brief A derived coordinate reference system which has a temporal |
1564 | | * coordinate reference system as its base CRS, thereby inheriting a temporal |
1565 | | * datum, and a temporal coordinate system. |
1566 | | * |
1567 | | * \remark Implements DerivedTemporalCRS from \ref ISO_19111_2019 |
1568 | | */ |
1569 | | #ifdef DOXYGEN_ENABLED |
1570 | | class DerivedTemporalCRS : public DerivedCRSTemplate<DerivedTemporalCRSTraits> { |
1571 | | }; |
1572 | | #else |
1573 | | using DerivedTemporalCRS = DerivedCRSTemplate<DerivedTemporalCRSTraits>; |
1574 | | #endif |
1575 | | |
1576 | | #ifndef DO_NOT_DEFINE_EXTERN_DERIVED_CRS_TEMPLATE |
1577 | | extern template class DerivedCRSTemplate<DerivedTemporalCRSTraits>; |
1578 | | #endif |
1579 | | |
1580 | | /** Shared pointer of DerivedTemporalCRS */ |
1581 | | using DerivedTemporalCRSPtr = std::shared_ptr<DerivedTemporalCRS>; |
1582 | | /** Non-null shared pointer of DerivedTemporalCRS */ |
1583 | | using DerivedTemporalCRSNNPtr = util::nn<DerivedTemporalCRSPtr>; |
1584 | | |
1585 | | // --------------------------------------------------------------------------- |
1586 | | |
1587 | | } // namespace crs |
1588 | | |
1589 | | NS_PROJ_END |
1590 | | |
1591 | | #endif // CRS_HH_INCLUDED |