/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 | | //! @cond Doxygen_Suppress |
810 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
811 | | const override; // throw(io::FormattingException) |
812 | | |
813 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
814 | | const override; // throw(FormattingException) |
815 | | |
816 | | //! @endcond |
817 | | |
818 | | protected: |
819 | | PROJ_INTERNAL EngineeringCRS(const datum::EngineeringDatumNNPtr &datumIn, |
820 | | const cs::CoordinateSystemNNPtr &csIn); |
821 | | PROJ_INTERNAL EngineeringCRS(const EngineeringCRS &other); |
822 | | |
823 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
824 | | |
825 | | PROJ_INTERNAL bool _isEquivalentTo( |
826 | | const util::IComparable *other, |
827 | | util::IComparable::Criterion criterion = |
828 | | util::IComparable::Criterion::STRICT, |
829 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
830 | | |
831 | | INLINED_MAKE_SHARED |
832 | | |
833 | | private: |
834 | | PROJ_OPAQUE_PRIVATE_DATA |
835 | | EngineeringCRS &operator=(const EngineeringCRS &other) = delete; |
836 | | }; |
837 | | |
838 | | // --------------------------------------------------------------------------- |
839 | | |
840 | | class ParametricCRS; |
841 | | /** Shared pointer of ParametricCRS */ |
842 | | using ParametricCRSPtr = std::shared_ptr<ParametricCRS>; |
843 | | /** Non-null shared pointer of ParametricCRS */ |
844 | | using ParametricCRSNNPtr = util::nn<ParametricCRSPtr>; |
845 | | |
846 | | /** \brief Contextually local coordinate reference system associated with an |
847 | | * engineering datum. |
848 | | * |
849 | | * This is applied either to activities on or near the surface of the Earth |
850 | | * without geodetic corrections, or on moving platforms such as road vehicles |
851 | | * vessels, aircraft or spacecraft, or as the internal CRS of an image. |
852 | | * |
853 | | * \remark Implements ParametricCRS from \ref ISO_19111_2019 |
854 | | */ |
855 | | class PROJ_GCC_DLL ParametricCRS : virtual public SingleCRS { |
856 | | public: |
857 | | //! @cond Doxygen_Suppress |
858 | | PROJ_DLL ~ParametricCRS() override; |
859 | | //! @endcond |
860 | | |
861 | | PROJ_DLL const datum::ParametricDatumNNPtr datum() const; |
862 | | |
863 | | PROJ_DLL const cs::ParametricCSNNPtr coordinateSystem() const; |
864 | | |
865 | | PROJ_DLL static ParametricCRSNNPtr |
866 | | create(const util::PropertyMap &properties, |
867 | | const datum::ParametricDatumNNPtr &datumIn, |
868 | | const cs::ParametricCSNNPtr &csIn); |
869 | | |
870 | | //! @cond Doxygen_Suppress |
871 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
872 | | const override; // throw(io::FormattingException) |
873 | | |
874 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
875 | | const override; // throw(FormattingException) |
876 | | |
877 | | //! @endcond |
878 | | |
879 | | protected: |
880 | | PROJ_INTERNAL ParametricCRS(const datum::ParametricDatumNNPtr &datumIn, |
881 | | const cs::ParametricCSNNPtr &csIn); |
882 | | PROJ_INTERNAL ParametricCRS(const ParametricCRS &other); |
883 | | |
884 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
885 | | |
886 | | PROJ_INTERNAL bool _isEquivalentTo( |
887 | | const util::IComparable *other, |
888 | | util::IComparable::Criterion criterion = |
889 | | util::IComparable::Criterion::STRICT, |
890 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
891 | | |
892 | | INLINED_MAKE_SHARED |
893 | | |
894 | | private: |
895 | | PROJ_OPAQUE_PRIVATE_DATA |
896 | | ParametricCRS &operator=(const ParametricCRS &other) = delete; |
897 | | }; |
898 | | |
899 | | // --------------------------------------------------------------------------- |
900 | | |
901 | | /** \brief Exception thrown when attempting to create an invalid compound CRS |
902 | | */ |
903 | | class PROJ_GCC_DLL InvalidCompoundCRSException : public util::Exception { |
904 | | public: |
905 | | //! @cond Doxygen_Suppress |
906 | | PROJ_INTERNAL explicit InvalidCompoundCRSException(const char *message); |
907 | | PROJ_INTERNAL explicit InvalidCompoundCRSException( |
908 | | const std::string &message); |
909 | | PROJ_DLL |
910 | | InvalidCompoundCRSException(const InvalidCompoundCRSException &other); |
911 | | PROJ_DLL ~InvalidCompoundCRSException() override; |
912 | | //! @endcond |
913 | | }; |
914 | | |
915 | | // --------------------------------------------------------------------------- |
916 | | |
917 | | /** \brief A coordinate reference system describing the position of points |
918 | | * through two or more independent single coordinate reference systems. |
919 | | * |
920 | | * \note Two coordinate reference systems are independent of each other |
921 | | * if coordinate values in one cannot be converted or transformed into |
922 | | * coordinate values in the other. |
923 | | * |
924 | | * \note As a departure to \ref ISO_19111_2019, we allow to build a CompoundCRS |
925 | | * from CRS objects, whereas ISO19111:2019 restricts the components to |
926 | | * SingleCRS. |
927 | | * |
928 | | * \remark Implements CompoundCRS from \ref ISO_19111_2019 |
929 | | */ |
930 | | class PROJ_GCC_DLL CompoundCRS final : public CRS, |
931 | | public io::IPROJStringExportable { |
932 | | public: |
933 | | //! @cond Doxygen_Suppress |
934 | | PROJ_DLL ~CompoundCRS() override; |
935 | | //! @endcond |
936 | | |
937 | | PROJ_DLL const std::vector<CRSNNPtr> & |
938 | | componentReferenceSystems() PROJ_PURE_DECL; |
939 | | |
940 | | PROJ_DLL std::list<std::pair<CompoundCRSNNPtr, int>> |
941 | | identify(const io::AuthorityFactoryPtr &authorityFactory) const; |
942 | | |
943 | | //! @cond Doxygen_Suppress |
944 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
945 | | const override; // throw(io::FormattingException) |
946 | | //! @endcond |
947 | | |
948 | | PROJ_DLL static CompoundCRSNNPtr |
949 | | create(const util::PropertyMap &properties, |
950 | | const std::vector<CRSNNPtr> |
951 | | &components); // throw InvalidCompoundCRSException |
952 | | |
953 | | //! @cond Doxygen_Suppress |
954 | | PROJ_INTERNAL static CRSNNPtr |
955 | | createLax(const util::PropertyMap &properties, |
956 | | const std::vector<CRSNNPtr> &components, |
957 | | const io::DatabaseContextPtr |
958 | | &dbContext); // throw InvalidCompoundCRSException |
959 | | //! @endcond |
960 | | |
961 | | protected: |
962 | | // relaxed: standard say SingleCRSNNPtr |
963 | | PROJ_INTERNAL explicit CompoundCRS(const std::vector<CRSNNPtr> &components); |
964 | | PROJ_INTERNAL CompoundCRS(const CompoundCRS &other); |
965 | | |
966 | | PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) |
967 | | const override; // throw(FormattingException) |
968 | | |
969 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
970 | | const override; // throw(FormattingException) |
971 | | |
972 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
973 | | |
974 | | PROJ_INTERNAL bool _isEquivalentTo( |
975 | | const util::IComparable *other, |
976 | | util::IComparable::Criterion criterion = |
977 | | util::IComparable::Criterion::STRICT, |
978 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
979 | | |
980 | | PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>> |
981 | | _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; |
982 | | |
983 | | INLINED_MAKE_SHARED |
984 | | |
985 | | private: |
986 | | PROJ_OPAQUE_PRIVATE_DATA |
987 | | CompoundCRS &operator=(const CompoundCRS &other) = delete; |
988 | | }; |
989 | | |
990 | | // --------------------------------------------------------------------------- |
991 | | |
992 | | /** \brief A coordinate reference system with an associated transformation to |
993 | | * a target/hub CRS. |
994 | | * |
995 | | * The definition of a CRS is not dependent upon any relationship to an |
996 | | * independent CRS. However in an implementation that merges datasets |
997 | | * referenced to differing CRSs, it is sometimes useful to associate the |
998 | | * definition of the transformation that has been used with the CRS definition. |
999 | | * This facilitates the interrelationship of CRS by concatenating |
1000 | | * transformations via a common or hub CRS. This is sometimes referred to as |
1001 | | * "early-binding". \ref WKT2 permits the association of an abridged coordinate |
1002 | | * transformation description with a coordinate reference system description in |
1003 | | * a single text string. In a BoundCRS, the abridged coordinate transformation |
1004 | | * is applied to the source CRS with the target CRS being the common or hub |
1005 | | * system. |
1006 | | * |
1007 | | * Coordinates referring to a BoundCRS are expressed into its source/base CRS. |
1008 | | * |
1009 | | * This abstraction can for example model the concept of TOWGS84 datum shift |
1010 | | * present in \ref WKT1. |
1011 | | * |
1012 | | * \note Contrary to other CRS classes of this package, there is no |
1013 | | * \ref ISO_19111_2019 modelling of a BoundCRS. |
1014 | | * |
1015 | | * \remark Implements BoundCRS from \ref WKT2 |
1016 | | */ |
1017 | | class PROJ_GCC_DLL BoundCRS final : public CRS, |
1018 | | public io::IPROJStringExportable { |
1019 | | public: |
1020 | | //! @cond Doxygen_Suppress |
1021 | | PROJ_DLL ~BoundCRS() override; |
1022 | | //! @endcond |
1023 | | |
1024 | | PROJ_DLL const CRSNNPtr &baseCRS() PROJ_PURE_DECL; |
1025 | | PROJ_DLL CRSNNPtr baseCRSWithCanonicalBoundCRS() const; |
1026 | | |
1027 | | PROJ_DLL const CRSNNPtr &hubCRS() PROJ_PURE_DECL; |
1028 | | PROJ_DLL const operation::TransformationNNPtr & |
1029 | | transformation() PROJ_PURE_DECL; |
1030 | | |
1031 | | //! @cond Doxygen_Suppress |
1032 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
1033 | | const override; // throw(io::FormattingException) |
1034 | | //! @endcond |
1035 | | |
1036 | | PROJ_DLL static BoundCRSNNPtr |
1037 | | create(const util::PropertyMap &properties, const CRSNNPtr &baseCRSIn, |
1038 | | const CRSNNPtr &hubCRSIn, |
1039 | | const operation::TransformationNNPtr &transformationIn); |
1040 | | |
1041 | | PROJ_DLL static BoundCRSNNPtr |
1042 | | create(const CRSNNPtr &baseCRSIn, const CRSNNPtr &hubCRSIn, |
1043 | | const operation::TransformationNNPtr &transformationIn); |
1044 | | |
1045 | | PROJ_DLL static BoundCRSNNPtr |
1046 | | createFromTOWGS84(const CRSNNPtr &baseCRSIn, |
1047 | | const std::vector<double> &TOWGS84Parameters); |
1048 | | |
1049 | | PROJ_DLL static BoundCRSNNPtr |
1050 | | createFromNadgrids(const CRSNNPtr &baseCRSIn, const std::string &filename); |
1051 | | |
1052 | | protected: |
1053 | | PROJ_INTERNAL |
1054 | | BoundCRS(const CRSNNPtr &baseCRSIn, const CRSNNPtr &hubCRSIn, |
1055 | | const operation::TransformationNNPtr &transformationIn); |
1056 | | PROJ_INTERNAL BoundCRS(const BoundCRS &other); |
1057 | | |
1058 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
1059 | | |
1060 | | PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) |
1061 | | const override; // throw(FormattingException) |
1062 | | |
1063 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
1064 | | const override; // throw(FormattingException) |
1065 | | |
1066 | | PROJ_INTERNAL bool _isEquivalentTo( |
1067 | | const util::IComparable *other, |
1068 | | util::IComparable::Criterion criterion = |
1069 | | util::IComparable::Criterion::STRICT, |
1070 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
1071 | | |
1072 | | PROJ_INTERNAL BoundCRSNNPtr shallowCloneAsBoundCRS() const; |
1073 | | PROJ_INTERNAL bool isTOWGS84Compatible() const; |
1074 | | PROJ_INTERNAL std::string |
1075 | | getHDatumPROJ4GRIDS(const io::DatabaseContextPtr &databaseContext) const; |
1076 | | PROJ_INTERNAL std::string |
1077 | | getVDatumPROJ4GRIDS(const crs::GeographicCRS *geogCRSOfCompoundCRS, |
1078 | | const char **outGeoidCRSValue) const; |
1079 | | |
1080 | | PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>> |
1081 | | _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; |
1082 | | |
1083 | | INLINED_MAKE_SHARED |
1084 | | |
1085 | | private: |
1086 | | PROJ_OPAQUE_PRIVATE_DATA |
1087 | | BoundCRS &operator=(const BoundCRS &other) = delete; |
1088 | | }; |
1089 | | |
1090 | | // --------------------------------------------------------------------------- |
1091 | | |
1092 | | class DerivedGeodeticCRS; |
1093 | | /** Shared pointer of DerivedGeodeticCRS */ |
1094 | | using DerivedGeodeticCRSPtr = std::shared_ptr<DerivedGeodeticCRS>; |
1095 | | /** Non-null shared pointer of DerivedGeodeticCRS */ |
1096 | | using DerivedGeodeticCRSNNPtr = util::nn<DerivedGeodeticCRSPtr>; |
1097 | | |
1098 | | /** \brief A derived coordinate reference system which has either a geodetic |
1099 | | * or a geographic coordinate reference system as its base CRS, thereby |
1100 | | * inheriting a geodetic reference frame, and associated with a 3D Cartesian |
1101 | | * or spherical coordinate system. |
1102 | | * |
1103 | | * \remark Implements DerivedGeodeticCRS from \ref ISO_19111_2019 |
1104 | | */ |
1105 | | class PROJ_GCC_DLL DerivedGeodeticCRS final : public GeodeticCRS, |
1106 | | public DerivedCRS { |
1107 | | public: |
1108 | | //! @cond Doxygen_Suppress |
1109 | | PROJ_DLL ~DerivedGeodeticCRS() override; |
1110 | | //! @endcond |
1111 | | |
1112 | | PROJ_DLL const GeodeticCRSNNPtr baseCRS() const; |
1113 | | |
1114 | | PROJ_DLL static DerivedGeodeticCRSNNPtr |
1115 | | create(const util::PropertyMap &properties, |
1116 | | const GeodeticCRSNNPtr &baseCRSIn, |
1117 | | const operation::ConversionNNPtr &derivingConversionIn, |
1118 | | const cs::CartesianCSNNPtr &csIn); |
1119 | | |
1120 | | PROJ_DLL static DerivedGeodeticCRSNNPtr |
1121 | | create(const util::PropertyMap &properties, |
1122 | | const GeodeticCRSNNPtr &baseCRSIn, |
1123 | | const operation::ConversionNNPtr &derivingConversionIn, |
1124 | | const cs::SphericalCSNNPtr &csIn); |
1125 | | |
1126 | | //! @cond Doxygen_Suppress |
1127 | | void _exportToWKT(io::WKTFormatter *formatter) |
1128 | | const override; // throw(io::FormattingException) |
1129 | | |
1130 | | PROJ_INTERNAL void |
1131 | 0 | _exportToJSON(io::JSONFormatter *formatter) const override { |
1132 | 0 | return DerivedCRS::_exportToJSON(formatter); |
1133 | 0 | } |
1134 | | |
1135 | | //! @endcond |
1136 | | |
1137 | | protected: |
1138 | | PROJ_INTERNAL |
1139 | | DerivedGeodeticCRS(const GeodeticCRSNNPtr &baseCRSIn, |
1140 | | const operation::ConversionNNPtr &derivingConversionIn, |
1141 | | const cs::CartesianCSNNPtr &csIn); |
1142 | | PROJ_INTERNAL |
1143 | | DerivedGeodeticCRS(const GeodeticCRSNNPtr &baseCRSIn, |
1144 | | const operation::ConversionNNPtr &derivingConversionIn, |
1145 | | const cs::SphericalCSNNPtr &csIn); |
1146 | | PROJ_INTERNAL DerivedGeodeticCRS(const DerivedGeodeticCRS &other); |
1147 | | |
1148 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
1149 | | |
1150 | | PROJ_INTERNAL bool _isEquivalentTo( |
1151 | | const util::IComparable *other, |
1152 | | util::IComparable::Criterion criterion = |
1153 | | util::IComparable::Criterion::STRICT, |
1154 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
1155 | | |
1156 | | PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>> |
1157 | | _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; |
1158 | | |
1159 | | // cppcheck-suppress functionStatic |
1160 | | PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) |
1161 | | const override; // throw(FormattingException) |
1162 | | |
1163 | 0 | PROJ_INTERNAL const char *className() const override { |
1164 | 0 | return "DerivedGeodeticCRS"; |
1165 | 0 | } |
1166 | | |
1167 | | INLINED_MAKE_SHARED |
1168 | | |
1169 | | private: |
1170 | | PROJ_OPAQUE_PRIVATE_DATA |
1171 | | DerivedGeodeticCRS &operator=(const DerivedGeodeticCRS &other) = delete; |
1172 | | }; |
1173 | | |
1174 | | // --------------------------------------------------------------------------- |
1175 | | |
1176 | | class DerivedGeographicCRS; |
1177 | | /** Shared pointer of DerivedGeographicCRS */ |
1178 | | using DerivedGeographicCRSPtr = std::shared_ptr<DerivedGeographicCRS>; |
1179 | | /** Non-null shared pointer of DerivedGeographicCRS */ |
1180 | | using DerivedGeographicCRSNNPtr = util::nn<DerivedGeographicCRSPtr>; |
1181 | | |
1182 | | /** \brief A derived coordinate reference system which has either a geodetic or |
1183 | | * a geographic coordinate reference system as its base CRS, thereby inheriting |
1184 | | * a geodetic reference frame, and an ellipsoidal coordinate system. |
1185 | | * |
1186 | | * A derived geographic CRS can be based on a geodetic CRS only if that |
1187 | | * geodetic CRS definition includes an ellipsoid. |
1188 | | * |
1189 | | * \remark Implements DerivedGeographicCRS from \ref ISO_19111_2019 |
1190 | | */ |
1191 | | class PROJ_GCC_DLL DerivedGeographicCRS final : public GeographicCRS, |
1192 | | public DerivedCRS { |
1193 | | public: |
1194 | | //! @cond Doxygen_Suppress |
1195 | | PROJ_DLL ~DerivedGeographicCRS() override; |
1196 | | //! @endcond |
1197 | | |
1198 | | PROJ_DLL const GeodeticCRSNNPtr baseCRS() const; |
1199 | | |
1200 | | PROJ_DLL static DerivedGeographicCRSNNPtr |
1201 | | create(const util::PropertyMap &properties, |
1202 | | const GeodeticCRSNNPtr &baseCRSIn, |
1203 | | const operation::ConversionNNPtr &derivingConversionIn, |
1204 | | const cs::EllipsoidalCSNNPtr &csIn); |
1205 | | |
1206 | | PROJ_DLL DerivedGeographicCRSNNPtr |
1207 | | demoteTo2D(const std::string &newName, |
1208 | | const io::DatabaseContextPtr &dbContext) const; |
1209 | | |
1210 | | //! @cond Doxygen_Suppress |
1211 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
1212 | | const override; // throw(io::FormattingException) |
1213 | | |
1214 | | PROJ_INTERNAL void |
1215 | 0 | _exportToJSON(io::JSONFormatter *formatter) const override { |
1216 | 0 | return DerivedCRS::_exportToJSON(formatter); |
1217 | 0 | } |
1218 | | |
1219 | | //! @endcond |
1220 | | |
1221 | | protected: |
1222 | | PROJ_INTERNAL |
1223 | | DerivedGeographicCRS(const GeodeticCRSNNPtr &baseCRSIn, |
1224 | | const operation::ConversionNNPtr &derivingConversionIn, |
1225 | | const cs::EllipsoidalCSNNPtr &csIn); |
1226 | | PROJ_INTERNAL DerivedGeographicCRS(const DerivedGeographicCRS &other); |
1227 | | |
1228 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
1229 | | |
1230 | | PROJ_INTERNAL bool _isEquivalentTo( |
1231 | | const util::IComparable *other, |
1232 | | util::IComparable::Criterion criterion = |
1233 | | util::IComparable::Criterion::STRICT, |
1234 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
1235 | | |
1236 | | PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>> |
1237 | | _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; |
1238 | | |
1239 | 0 | PROJ_INTERNAL const char *className() const override { |
1240 | 0 | return "DerivedGeographicCRS"; |
1241 | 0 | } |
1242 | | |
1243 | | // cppcheck-suppress functionStatic |
1244 | | PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) |
1245 | | const override; // throw(FormattingException) |
1246 | | |
1247 | | INLINED_MAKE_SHARED |
1248 | | |
1249 | | private: |
1250 | | PROJ_OPAQUE_PRIVATE_DATA |
1251 | | DerivedGeographicCRS &operator=(const DerivedGeographicCRS &other) = delete; |
1252 | | }; |
1253 | | |
1254 | | // --------------------------------------------------------------------------- |
1255 | | |
1256 | | class DerivedProjectedCRS; |
1257 | | /** Shared pointer of DerivedProjectedCRS */ |
1258 | | using DerivedProjectedCRSPtr = std::shared_ptr<DerivedProjectedCRS>; |
1259 | | /** Non-null shared pointer of DerivedProjectedCRS */ |
1260 | | using DerivedProjectedCRSNNPtr = util::nn<DerivedProjectedCRSPtr>; |
1261 | | |
1262 | | /** \brief A derived coordinate reference system which has a projected |
1263 | | * coordinate reference system as its base CRS, thereby inheriting a geodetic |
1264 | | * reference frame, but also inheriting the distortion characteristics of the |
1265 | | * base projected CRS. |
1266 | | * |
1267 | | * A DerivedProjectedCRS is not a ProjectedCRS. |
1268 | | * |
1269 | | * \remark Implements DerivedProjectedCRS from \ref ISO_19111_2019 |
1270 | | */ |
1271 | | class PROJ_GCC_DLL DerivedProjectedCRS final : public DerivedCRS { |
1272 | | public: |
1273 | | //! @cond Doxygen_Suppress |
1274 | | PROJ_DLL ~DerivedProjectedCRS() override; |
1275 | | //! @endcond |
1276 | | |
1277 | | PROJ_DLL const ProjectedCRSNNPtr baseCRS() const; |
1278 | | |
1279 | | PROJ_DLL static DerivedProjectedCRSNNPtr |
1280 | | create(const util::PropertyMap &properties, |
1281 | | const ProjectedCRSNNPtr &baseCRSIn, |
1282 | | const operation::ConversionNNPtr &derivingConversionIn, |
1283 | | const cs::CoordinateSystemNNPtr &csIn); |
1284 | | |
1285 | | PROJ_DLL DerivedProjectedCRSNNPtr |
1286 | | demoteTo2D(const std::string &newName, |
1287 | | const io::DatabaseContextPtr &dbContext) const; |
1288 | | |
1289 | | //! @cond Doxygen_Suppress |
1290 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
1291 | | const override; // throw(io::FormattingException) |
1292 | | |
1293 | | PROJ_INTERNAL void |
1294 | | addUnitConvertAndAxisSwap(io::PROJStringFormatter *formatter) const; |
1295 | | //! @endcond |
1296 | | |
1297 | | protected: |
1298 | | PROJ_INTERNAL |
1299 | | DerivedProjectedCRS(const ProjectedCRSNNPtr &baseCRSIn, |
1300 | | const operation::ConversionNNPtr &derivingConversionIn, |
1301 | | const cs::CoordinateSystemNNPtr &csIn); |
1302 | | PROJ_INTERNAL DerivedProjectedCRS(const DerivedProjectedCRS &other); |
1303 | | |
1304 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
1305 | | |
1306 | | PROJ_INTERNAL bool _isEquivalentTo( |
1307 | | const util::IComparable *other, |
1308 | | util::IComparable::Criterion criterion = |
1309 | | util::IComparable::Criterion::STRICT, |
1310 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
1311 | | |
1312 | 0 | PROJ_INTERNAL const char *className() const override { |
1313 | 0 | return "DerivedProjectedCRS"; |
1314 | 0 | } |
1315 | | |
1316 | | INLINED_MAKE_SHARED |
1317 | | |
1318 | | private: |
1319 | | PROJ_OPAQUE_PRIVATE_DATA |
1320 | | DerivedProjectedCRS &operator=(const DerivedProjectedCRS &other) = delete; |
1321 | | }; |
1322 | | |
1323 | | // --------------------------------------------------------------------------- |
1324 | | |
1325 | | class DerivedVerticalCRS; |
1326 | | /** Shared pointer of DerivedVerticalCRS */ |
1327 | | using DerivedVerticalCRSPtr = std::shared_ptr<DerivedVerticalCRS>; |
1328 | | /** Non-null shared pointer of DerivedVerticalCRS */ |
1329 | | using DerivedVerticalCRSNNPtr = util::nn<DerivedVerticalCRSPtr>; |
1330 | | |
1331 | | /** \brief A derived coordinate reference system which has a vertical |
1332 | | * coordinate reference system as its base CRS, thereby inheriting a vertical |
1333 | | * reference frame, and a vertical coordinate system. |
1334 | | * |
1335 | | * \remark Implements DerivedVerticalCRS from \ref ISO_19111_2019 |
1336 | | */ |
1337 | | class PROJ_GCC_DLL DerivedVerticalCRS final : public VerticalCRS, |
1338 | | public DerivedCRS { |
1339 | | public: |
1340 | | //! @cond Doxygen_Suppress |
1341 | | PROJ_DLL ~DerivedVerticalCRS() override; |
1342 | | //! @endcond |
1343 | | |
1344 | | PROJ_DLL const VerticalCRSNNPtr baseCRS() const; |
1345 | | |
1346 | | PROJ_DLL static DerivedVerticalCRSNNPtr |
1347 | | create(const util::PropertyMap &properties, |
1348 | | const VerticalCRSNNPtr &baseCRSIn, |
1349 | | const operation::ConversionNNPtr &derivingConversionIn, |
1350 | | const cs::VerticalCSNNPtr &csIn); |
1351 | | |
1352 | | //! @cond Doxygen_Suppress |
1353 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
1354 | | const override; // throw(io::FormattingException) |
1355 | | |
1356 | | PROJ_INTERNAL void |
1357 | 0 | _exportToJSON(io::JSONFormatter *formatter) const override { |
1358 | 0 | return DerivedCRS::_exportToJSON(formatter); |
1359 | 0 | } |
1360 | | |
1361 | | //! @endcond |
1362 | | |
1363 | | protected: |
1364 | | PROJ_INTERNAL |
1365 | | DerivedVerticalCRS(const VerticalCRSNNPtr &baseCRSIn, |
1366 | | const operation::ConversionNNPtr &derivingConversionIn, |
1367 | | const cs::VerticalCSNNPtr &csIn); |
1368 | | PROJ_INTERNAL DerivedVerticalCRS(const DerivedVerticalCRS &other); |
1369 | | |
1370 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
1371 | | |
1372 | | PROJ_INTERNAL bool _isEquivalentTo( |
1373 | | const util::IComparable *other, |
1374 | | util::IComparable::Criterion criterion = |
1375 | | util::IComparable::Criterion::STRICT, |
1376 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
1377 | | |
1378 | | PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>> |
1379 | | _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; |
1380 | | |
1381 | 0 | PROJ_INTERNAL const char *className() const override { |
1382 | 0 | return "DerivedVerticalCRS"; |
1383 | 0 | } |
1384 | | |
1385 | | // cppcheck-suppress functionStatic |
1386 | | PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) |
1387 | | const override; // throw(FormattingException) |
1388 | | |
1389 | | INLINED_MAKE_SHARED |
1390 | | |
1391 | | private: |
1392 | | PROJ_OPAQUE_PRIVATE_DATA |
1393 | | DerivedVerticalCRS &operator=(const DerivedVerticalCRS &other) = delete; |
1394 | | }; |
1395 | | |
1396 | | // --------------------------------------------------------------------------- |
1397 | | |
1398 | | /** \brief Template representing a derived coordinate reference system. |
1399 | | */ |
1400 | | template <class DerivedCRSTraits> |
1401 | | class PROJ_GCC_DLL DerivedCRSTemplate final : public DerivedCRSTraits::BaseType, |
1402 | | public DerivedCRS { |
1403 | | protected: |
1404 | | /** Base type */ |
1405 | | typedef typename DerivedCRSTraits::BaseType BaseType; |
1406 | | /** CSType */ |
1407 | | typedef typename DerivedCRSTraits::CSType CSType; |
1408 | | |
1409 | | public: |
1410 | | //! @cond Doxygen_Suppress |
1411 | | PROJ_DLL ~DerivedCRSTemplate() override; |
1412 | | //! @endcond |
1413 | | |
1414 | | /** Non-null shared pointer of DerivedCRSTemplate */ |
1415 | | typedef typename util::nn<std::shared_ptr<DerivedCRSTemplate>> NNPtr; |
1416 | | /** Non-null shared pointer of BaseType */ |
1417 | | typedef util::nn<std::shared_ptr<BaseType>> BaseNNPtr; |
1418 | | /** Non-null shared pointer of CSType */ |
1419 | | typedef util::nn<std::shared_ptr<CSType>> CSNNPtr; |
1420 | | |
1421 | | /** \brief Return the base CRS of a DerivedCRSTemplate. |
1422 | | * |
1423 | | * @return the base CRS. |
1424 | | */ |
1425 | | PROJ_DLL const BaseNNPtr baseCRS() const; |
1426 | | |
1427 | | /** \brief Instantiate a DerivedCRSTemplate from a base CRS, a deriving |
1428 | | * conversion and a cs::CoordinateSystem. |
1429 | | * |
1430 | | * @param properties See \ref general_properties. |
1431 | | * At minimum the name should be defined. |
1432 | | * @param baseCRSIn base CRS. |
1433 | | * @param derivingConversionIn the deriving conversion from the base CRS to |
1434 | | * this |
1435 | | * CRS. |
1436 | | * @param csIn the coordinate system. |
1437 | | * @return new DerivedCRSTemplate. |
1438 | | */ |
1439 | | PROJ_DLL static NNPtr |
1440 | | create(const util::PropertyMap &properties, const BaseNNPtr &baseCRSIn, |
1441 | | const operation::ConversionNNPtr &derivingConversionIn, |
1442 | | const CSNNPtr &csIn); |
1443 | | |
1444 | | //! @cond Doxygen_Suppress |
1445 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
1446 | | const override; // throw(io::FormattingException) |
1447 | | |
1448 | | PROJ_INTERNAL void |
1449 | 0 | _exportToJSON(io::JSONFormatter *formatter) const override { |
1450 | 0 | return DerivedCRS::_exportToJSON(formatter); |
1451 | 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 |
1452 | | //! @endcond |
1453 | | |
1454 | | protected: |
1455 | | PROJ_INTERNAL |
1456 | | DerivedCRSTemplate(const BaseNNPtr &baseCRSIn, |
1457 | | const operation::ConversionNNPtr &derivingConversionIn, |
1458 | | const CSNNPtr &csIn); |
1459 | | // cppcheck-suppress noExplicitConstructor |
1460 | | PROJ_INTERNAL DerivedCRSTemplate(const DerivedCRSTemplate &other); |
1461 | | |
1462 | | PROJ_INTERNAL CRSNNPtr _shallowClone() const override; |
1463 | | |
1464 | | PROJ_INTERNAL bool _isEquivalentTo( |
1465 | | const util::IComparable *other, |
1466 | | util::IComparable::Criterion criterion = |
1467 | | util::IComparable::Criterion::STRICT, |
1468 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
1469 | | |
1470 | | PROJ_INTERNAL const char *className() const override; |
1471 | | |
1472 | | INLINED_MAKE_SHARED |
1473 | | |
1474 | | private: |
1475 | | struct PROJ_INTERNAL Private; |
1476 | | std::unique_ptr<Private> d; |
1477 | | |
1478 | | DerivedCRSTemplate &operator=(const DerivedCRSTemplate &other) = delete; |
1479 | | }; |
1480 | | |
1481 | | // --------------------------------------------------------------------------- |
1482 | | |
1483 | | //! @cond Doxygen_Suppress |
1484 | | struct PROJ_GCC_DLL DerivedEngineeringCRSTraits { |
1485 | | typedef EngineeringCRS BaseType; |
1486 | | typedef cs::CoordinateSystem CSType; |
1487 | | // old x86_64-w64-mingw32-g++ has issues with static variables. use method |
1488 | | // instead |
1489 | | inline static const std::string &CRSName(); |
1490 | | inline static const std::string &WKTKeyword(); |
1491 | | inline static const std::string &WKTBaseKeyword(); |
1492 | | static const bool wkt2_2019_only = true; |
1493 | | }; |
1494 | | //! @endcond |
1495 | | |
1496 | | /** \brief A derived coordinate reference system which has an engineering |
1497 | | * coordinate reference system as its base CRS, thereby inheriting an |
1498 | | * engineering datum, and is associated with one of the coordinate system |
1499 | | * types for an EngineeringCRS |
1500 | | * |
1501 | | * \remark Implements DerivedEngineeringCRS from \ref ISO_19111_2019 |
1502 | | */ |
1503 | | #ifdef DOXYGEN_ENABLED |
1504 | | class DerivedEngineeringCRS |
1505 | | : public DerivedCRSTemplate<DerivedEngineeringCRSTraits> {}; |
1506 | | #else |
1507 | | using DerivedEngineeringCRS = DerivedCRSTemplate<DerivedEngineeringCRSTraits>; |
1508 | | #endif |
1509 | | |
1510 | | #ifndef DO_NOT_DEFINE_EXTERN_DERIVED_CRS_TEMPLATE |
1511 | | extern template class DerivedCRSTemplate<DerivedEngineeringCRSTraits>; |
1512 | | #endif |
1513 | | |
1514 | | /** Shared pointer of DerivedEngineeringCRS */ |
1515 | | using DerivedEngineeringCRSPtr = std::shared_ptr<DerivedEngineeringCRS>; |
1516 | | /** Non-null shared pointer of DerivedEngineeringCRS */ |
1517 | | using DerivedEngineeringCRSNNPtr = util::nn<DerivedEngineeringCRSPtr>; |
1518 | | |
1519 | | // --------------------------------------------------------------------------- |
1520 | | |
1521 | | //! @cond Doxygen_Suppress |
1522 | | struct PROJ_GCC_DLL DerivedParametricCRSTraits { |
1523 | | typedef ParametricCRS BaseType; |
1524 | | typedef cs::ParametricCS CSType; |
1525 | | // old x86_64-w64-mingw32-g++ has issues with static variables. use method |
1526 | | // instead |
1527 | | inline static const std::string &CRSName(); |
1528 | | inline static const std::string &WKTKeyword(); |
1529 | | inline static const std::string &WKTBaseKeyword(); |
1530 | | static const bool wkt2_2019_only = false; |
1531 | | }; |
1532 | | //! @endcond |
1533 | | |
1534 | | /** \brief A derived coordinate reference system which has a parametric |
1535 | | * coordinate reference system as its base CRS, thereby inheriting a parametric |
1536 | | * datum, and a parametric coordinate system. |
1537 | | * |
1538 | | * \remark Implements DerivedParametricCRS from \ref ISO_19111_2019 |
1539 | | */ |
1540 | | #ifdef DOXYGEN_ENABLED |
1541 | | class DerivedParametricCRS |
1542 | | : public DerivedCRSTemplate<DerivedParametricCRSTraits> {}; |
1543 | | #else |
1544 | | using DerivedParametricCRS = DerivedCRSTemplate<DerivedParametricCRSTraits>; |
1545 | | #endif |
1546 | | |
1547 | | #ifndef DO_NOT_DEFINE_EXTERN_DERIVED_CRS_TEMPLATE |
1548 | | extern template class DerivedCRSTemplate<DerivedParametricCRSTraits>; |
1549 | | #endif |
1550 | | |
1551 | | /** Shared pointer of DerivedParametricCRS */ |
1552 | | using DerivedParametricCRSPtr = std::shared_ptr<DerivedParametricCRS>; |
1553 | | /** Non-null shared pointer of DerivedParametricCRS */ |
1554 | | using DerivedParametricCRSNNPtr = util::nn<DerivedParametricCRSPtr>; |
1555 | | |
1556 | | // --------------------------------------------------------------------------- |
1557 | | |
1558 | | //! @cond Doxygen_Suppress |
1559 | | struct PROJ_GCC_DLL DerivedTemporalCRSTraits { |
1560 | | typedef TemporalCRS BaseType; |
1561 | | typedef cs::TemporalCS CSType; |
1562 | | // old x86_64-w64-mingw32-g++ has issues with static variables. use method |
1563 | | // instead |
1564 | | inline static const std::string &CRSName(); |
1565 | | inline static const std::string &WKTKeyword(); |
1566 | | inline static const std::string &WKTBaseKeyword(); |
1567 | | static const bool wkt2_2019_only = false; |
1568 | | }; |
1569 | | //! @endcond |
1570 | | |
1571 | | /** \brief A derived coordinate reference system which has a temporal |
1572 | | * coordinate reference system as its base CRS, thereby inheriting a temporal |
1573 | | * datum, and a temporal coordinate system. |
1574 | | * |
1575 | | * \remark Implements DerivedTemporalCRS from \ref ISO_19111_2019 |
1576 | | */ |
1577 | | #ifdef DOXYGEN_ENABLED |
1578 | | class DerivedTemporalCRS : public DerivedCRSTemplate<DerivedTemporalCRSTraits> { |
1579 | | }; |
1580 | | #else |
1581 | | using DerivedTemporalCRS = DerivedCRSTemplate<DerivedTemporalCRSTraits>; |
1582 | | #endif |
1583 | | |
1584 | | #ifndef DO_NOT_DEFINE_EXTERN_DERIVED_CRS_TEMPLATE |
1585 | | extern template class DerivedCRSTemplate<DerivedTemporalCRSTraits>; |
1586 | | #endif |
1587 | | |
1588 | | /** Shared pointer of DerivedTemporalCRS */ |
1589 | | using DerivedTemporalCRSPtr = std::shared_ptr<DerivedTemporalCRS>; |
1590 | | /** Non-null shared pointer of DerivedTemporalCRS */ |
1591 | | using DerivedTemporalCRSNNPtr = util::nn<DerivedTemporalCRSPtr>; |
1592 | | |
1593 | | // --------------------------------------------------------------------------- |
1594 | | |
1595 | | } // namespace crs |
1596 | | |
1597 | | NS_PROJ_END |
1598 | | |
1599 | | #endif // CRS_HH_INCLUDED |