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