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