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