/src/PROJ/include/proj/coordinatesystem.hpp
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Project: PROJ |
4 | | * Purpose: ISO19111:2019 implementation |
5 | | * Author: Even Rouault <even dot rouault at spatialys dot com> |
6 | | * |
7 | | ****************************************************************************** |
8 | | * Copyright (c) 2018, Even Rouault <even dot rouault at spatialys dot com> |
9 | | * |
10 | | * Permission is hereby granted, free of charge, to any person obtaining a |
11 | | * copy of this software and associated documentation files (the "Software"), |
12 | | * to deal in the Software without restriction, including without limitation |
13 | | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
14 | | * and/or sell copies of the Software, and to permit persons to whom the |
15 | | * Software is furnished to do so, subject to the following conditions: |
16 | | * |
17 | | * The above copyright notice and this permission notice shall be included |
18 | | * in all copies or substantial portions of the Software. |
19 | | * |
20 | | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
21 | | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
22 | | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
23 | | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
24 | | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
25 | | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
26 | | * DEALINGS IN THE SOFTWARE. |
27 | | ****************************************************************************/ |
28 | | |
29 | | #ifndef CS_HH_INCLUDED |
30 | | #define CS_HH_INCLUDED |
31 | | |
32 | | #include <memory> |
33 | | #include <set> |
34 | | #include <string> |
35 | | #include <vector> |
36 | | |
37 | | #include "common.hpp" |
38 | | #include "io.hpp" |
39 | | #include "util.hpp" |
40 | | |
41 | | NS_PROJ_START |
42 | | |
43 | | /** osgeo.proj.cs namespace |
44 | | |
45 | | \brief Coordinate systems and their axis. |
46 | | */ |
47 | | namespace cs { |
48 | | |
49 | | // --------------------------------------------------------------------------- |
50 | | |
51 | | /** \brief Exception that can be thrown when an invalid coordinate system is |
52 | | * attempted to be constructed. |
53 | | * |
54 | | * @since 9.9 |
55 | | */ |
56 | | class PROJ_GCC_DLL InvalidCoordinateSystem : public util::Exception { |
57 | | public: |
58 | | //! @cond Doxygen_Suppress |
59 | | PROJ_INTERNAL explicit InvalidCoordinateSystem(const char *message); |
60 | | PROJ_INTERNAL explicit InvalidCoordinateSystem(const std::string &message); |
61 | | PROJ_DLL InvalidCoordinateSystem(const InvalidCoordinateSystem &other); |
62 | | PROJ_DLL ~InvalidCoordinateSystem() override; |
63 | | //! @endcond |
64 | | }; |
65 | | |
66 | | // --------------------------------------------------------------------------- |
67 | | |
68 | | /** \brief The direction of positive increase in the coordinate value for a |
69 | | * coordinate system axis. |
70 | | * |
71 | | * \remark Implements AxisDirection from \ref ISO_19111_2019 |
72 | | */ |
73 | | class AxisDirection : public util::CodeList { |
74 | | public: |
75 | | //! @cond Doxygen_Suppress |
76 | | PROJ_DLL static const AxisDirection * |
77 | | valueOf(const std::string &nameIn) noexcept; |
78 | | //! @endcond |
79 | | |
80 | | AxisDirection(const AxisDirection &) = delete; |
81 | | AxisDirection &operator=(const AxisDirection &) = delete; |
82 | | AxisDirection(AxisDirection &&) = delete; |
83 | | AxisDirection &operator=(AxisDirection &&) = delete; |
84 | | |
85 | | PROJ_DLL static const AxisDirection NORTH; |
86 | | PROJ_DLL static const AxisDirection NORTH_NORTH_EAST; |
87 | | PROJ_DLL static const AxisDirection NORTH_EAST; |
88 | | PROJ_DLL static const AxisDirection EAST_NORTH_EAST; |
89 | | PROJ_DLL static const AxisDirection EAST; |
90 | | PROJ_DLL static const AxisDirection EAST_SOUTH_EAST; |
91 | | PROJ_DLL static const AxisDirection SOUTH_EAST; |
92 | | PROJ_DLL static const AxisDirection SOUTH_SOUTH_EAST; |
93 | | PROJ_DLL static const AxisDirection SOUTH; |
94 | | PROJ_DLL static const AxisDirection SOUTH_SOUTH_WEST; |
95 | | PROJ_DLL static const AxisDirection SOUTH_WEST; |
96 | | PROJ_DLL static const AxisDirection |
97 | | WEST_SOUTH_WEST; // note: was forgotten in WKT2-2015 |
98 | | PROJ_DLL static const AxisDirection WEST; |
99 | | PROJ_DLL static const AxisDirection WEST_NORTH_WEST; |
100 | | PROJ_DLL static const AxisDirection NORTH_WEST; |
101 | | PROJ_DLL static const AxisDirection NORTH_NORTH_WEST; |
102 | | PROJ_DLL static const AxisDirection UP; |
103 | | PROJ_DLL static const AxisDirection DOWN; |
104 | | PROJ_DLL static const AxisDirection GEOCENTRIC_X; |
105 | | PROJ_DLL static const AxisDirection GEOCENTRIC_Y; |
106 | | PROJ_DLL static const AxisDirection GEOCENTRIC_Z; |
107 | | PROJ_DLL static const AxisDirection COLUMN_POSITIVE; |
108 | | PROJ_DLL static const AxisDirection COLUMN_NEGATIVE; |
109 | | PROJ_DLL static const AxisDirection ROW_POSITIVE; |
110 | | PROJ_DLL static const AxisDirection ROW_NEGATIVE; |
111 | | PROJ_DLL static const AxisDirection DISPLAY_RIGHT; |
112 | | PROJ_DLL static const AxisDirection DISPLAY_LEFT; |
113 | | PROJ_DLL static const AxisDirection DISPLAY_UP; |
114 | | PROJ_DLL static const AxisDirection DISPLAY_DOWN; |
115 | | PROJ_DLL static const AxisDirection FORWARD; |
116 | | PROJ_DLL static const AxisDirection AFT; |
117 | | PROJ_DLL static const AxisDirection PORT; |
118 | | PROJ_DLL static const AxisDirection STARBOARD; |
119 | | PROJ_DLL static const AxisDirection CLOCKWISE; |
120 | | PROJ_DLL static const AxisDirection COUNTER_CLOCKWISE; |
121 | | PROJ_DLL static const AxisDirection TOWARDS; |
122 | | PROJ_DLL static const AxisDirection AWAY_FROM; |
123 | | PROJ_DLL static const AxisDirection FUTURE; |
124 | | PROJ_DLL static const AxisDirection PAST; |
125 | | PROJ_DLL static const AxisDirection UNSPECIFIED; |
126 | | |
127 | | private: |
128 | | explicit AxisDirection(const std::string &nameIn); |
129 | | |
130 | | static std::map<std::string, const AxisDirection *> registry; |
131 | | }; |
132 | | |
133 | | // --------------------------------------------------------------------------- |
134 | | |
135 | | /** \brief Meaning of the axis value range specified through minimumValue and |
136 | | * maximumValue |
137 | | * |
138 | | * \remark Implements RangeMeaning from \ref ISO_19111_2019 |
139 | | * \since 9.2 |
140 | | */ |
141 | | class RangeMeaning : public util::CodeList { |
142 | | public: |
143 | | //! @cond Doxygen_Suppress |
144 | | PROJ_DLL static const RangeMeaning * |
145 | | valueOf(const std::string &nameIn) noexcept; |
146 | | //! @endcond |
147 | | |
148 | | PROJ_DLL static const RangeMeaning EXACT; |
149 | | PROJ_DLL static const RangeMeaning WRAPAROUND; |
150 | | |
151 | | protected: |
152 | | friend class util::optional<RangeMeaning>; |
153 | | RangeMeaning(); |
154 | | |
155 | | private: |
156 | | explicit RangeMeaning(const std::string &nameIn); |
157 | | |
158 | | static std::map<std::string, const RangeMeaning *> registry; |
159 | | }; |
160 | | |
161 | | // --------------------------------------------------------------------------- |
162 | | |
163 | | class Meridian; |
164 | | /** Shared pointer of Meridian. */ |
165 | | using MeridianPtr = std::shared_ptr<Meridian>; |
166 | | /** Non-null shared pointer of Meridian. */ |
167 | | using MeridianNNPtr = util::nn<MeridianPtr>; |
168 | | |
169 | | /** \brief The meridian that the axis follows from the pole, for a coordinate |
170 | | * reference system centered on a pole. |
171 | | * |
172 | | * \note There is no modelling for this concept in \ref ISO_19111_2019 |
173 | | * |
174 | | * \remark Implements MERIDIAN from \ref WKT2 |
175 | | */ |
176 | | class PROJ_GCC_DLL Meridian : public common::IdentifiedObject, |
177 | | public io::IJSONExportable { |
178 | | public: |
179 | | //! @cond Doxygen_Suppress |
180 | | PROJ_DLL ~Meridian() override; |
181 | | //! @endcond |
182 | | |
183 | | PROJ_DLL const common::Angle &longitude() PROJ_PURE_DECL; |
184 | | |
185 | | // non-standard |
186 | | PROJ_DLL static MeridianNNPtr create(const common::Angle &longitudeIn); |
187 | | |
188 | | //! @cond Doxygen_Suppress |
189 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
190 | | const override; // throw(io::FormattingException) |
191 | | |
192 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
193 | | const override; // throw(FormattingException) |
194 | | //! @endcond |
195 | | |
196 | | protected: |
197 | | #ifdef DOXYGEN_ENABLED |
198 | | Angle angle_; |
199 | | #endif |
200 | | |
201 | | PROJ_INTERNAL explicit Meridian(const common::Angle &longitudeIn); |
202 | | INLINED_MAKE_SHARED |
203 | | |
204 | | private: |
205 | | PROJ_OPAQUE_PRIVATE_DATA |
206 | | Meridian(const Meridian &other) = delete; |
207 | | Meridian &operator=(const Meridian &other) = delete; |
208 | | }; |
209 | | |
210 | | // --------------------------------------------------------------------------- |
211 | | |
212 | | class CoordinateSystemAxis; |
213 | | /** Shared pointer of CoordinateSystemAxis. */ |
214 | | using CoordinateSystemAxisPtr = std::shared_ptr<CoordinateSystemAxis>; |
215 | | /** Non-null shared pointer of CoordinateSystemAxis. */ |
216 | | using CoordinateSystemAxisNNPtr = util::nn<CoordinateSystemAxisPtr>; |
217 | | |
218 | | /** \brief The definition of a coordinate system axis. |
219 | | * |
220 | | * \remark Implements CoordinateSystemAxis from \ref ISO_19111_2019 |
221 | | */ |
222 | | class PROJ_GCC_DLL CoordinateSystemAxis final : public common::IdentifiedObject, |
223 | | public io::IJSONExportable { |
224 | | public: |
225 | | //! @cond Doxygen_Suppress |
226 | | PROJ_DLL ~CoordinateSystemAxis() override; |
227 | | //! @endcond |
228 | | |
229 | | PROJ_DLL const std::string &abbreviation() PROJ_PURE_DECL; |
230 | | PROJ_DLL const AxisDirection &direction() PROJ_PURE_DECL; |
231 | | PROJ_DLL const common::UnitOfMeasure &unit() PROJ_PURE_DECL; |
232 | | PROJ_DLL const util::optional<double> &minimumValue() PROJ_PURE_DECL; |
233 | | PROJ_DLL const util::optional<double> &maximumValue() PROJ_PURE_DECL; |
234 | | PROJ_DLL const util::optional<RangeMeaning> &rangeMeaning() PROJ_PURE_DECL; |
235 | | PROJ_DLL const MeridianPtr &meridian() PROJ_PURE_DECL; |
236 | | |
237 | | // Non-standard |
238 | | PROJ_DLL static CoordinateSystemAxisNNPtr |
239 | | create(const util::PropertyMap &properties, |
240 | | const std::string &abbreviationIn, const AxisDirection &directionIn, |
241 | | const common::UnitOfMeasure &unitIn, |
242 | | const MeridianPtr &meridianIn = nullptr); |
243 | | |
244 | | PROJ_DLL static CoordinateSystemAxisNNPtr |
245 | | create(const util::PropertyMap &properties, |
246 | | const std::string &abbreviationIn, const AxisDirection &directionIn, |
247 | | const common::UnitOfMeasure &unitIn, |
248 | | const util::optional<double> &minimumValueIn, |
249 | | const util::optional<double> &maximumValueIn, |
250 | | const util::optional<RangeMeaning> &rangeMeaningIn, |
251 | | const MeridianPtr &meridianIn = nullptr); |
252 | | |
253 | | PROJ_PRIVATE : |
254 | | |
255 | | //! @cond Doxygen_Suppress |
256 | | PROJ_INTERNAL bool |
257 | | _isEquivalentTo( |
258 | | const util::IComparable *other, |
259 | | util::IComparable::Criterion criterion = |
260 | | util::IComparable::Criterion::STRICT, |
261 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
262 | | |
263 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter, int order, |
264 | | bool disableAbbrev) const; |
265 | | |
266 | | PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) |
267 | | const override; // throw(io::FormattingException) |
268 | | |
269 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
270 | | const override; // throw(FormattingException) |
271 | | |
272 | | PROJ_INTERNAL static std::string normalizeAxisName(const std::string &str); |
273 | | |
274 | | PROJ_INTERNAL static CoordinateSystemAxisNNPtr |
275 | | createLAT_NORTH(const common::UnitOfMeasure &unit); |
276 | | PROJ_INTERNAL static CoordinateSystemAxisNNPtr |
277 | | createLONG_EAST(const common::UnitOfMeasure &unit); |
278 | | |
279 | | PROJ_INTERNAL CoordinateSystemAxisNNPtr |
280 | | alterUnit(const common::UnitOfMeasure &newUnit) const; |
281 | | |
282 | | //! @endcond |
283 | | |
284 | | private: |
285 | | PROJ_OPAQUE_PRIVATE_DATA |
286 | | CoordinateSystemAxis(const CoordinateSystemAxis &other) = delete; |
287 | | CoordinateSystemAxis &operator=(const CoordinateSystemAxis &other) = delete; |
288 | | |
289 | | PROJ_INTERNAL CoordinateSystemAxis(); |
290 | | /* cppcheck-suppress unusedPrivateFunction */ |
291 | | INLINED_MAKE_SHARED |
292 | | }; |
293 | | |
294 | | // --------------------------------------------------------------------------- |
295 | | |
296 | | /** \brief Abstract class modelling a coordinate system (CS) |
297 | | * |
298 | | * A CS is the non-repeating sequence of coordinate system axes that spans a |
299 | | * given coordinate space. A CS is derived from a set of mathematical rules for |
300 | | * specifying how coordinates in a given space are to be assigned to points. |
301 | | * The coordinate values in a coordinate tuple shall be recorded in the order |
302 | | * in which the coordinate system axes associations are recorded. |
303 | | * |
304 | | * \remark Implements CoordinateSystem from \ref ISO_19111_2019 |
305 | | */ |
306 | | class PROJ_GCC_DLL CoordinateSystem : public common::IdentifiedObject, |
307 | | public io::IJSONExportable { |
308 | | public: |
309 | | //! @cond Doxygen_Suppress |
310 | | PROJ_DLL ~CoordinateSystem() override; |
311 | | //! @endcond |
312 | | |
313 | | PROJ_DLL const std::vector<CoordinateSystemAxisNNPtr> & |
314 | | axisList() PROJ_PURE_DECL; |
315 | | |
316 | | PROJ_PRIVATE : |
317 | | |
318 | | //! @cond Doxygen_Suppress |
319 | | PROJ_INTERNAL void |
320 | | _exportToWKT(io::WKTFormatter *formatter) |
321 | | const override; // throw(io::FormattingException) |
322 | | |
323 | | PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) |
324 | | const override; // throw(FormattingException) |
325 | | |
326 | | PROJ_INTERNAL virtual std::string getWKT2Type(bool) const = 0; |
327 | | |
328 | | PROJ_INTERNAL bool _isEquivalentTo( |
329 | | const util::IComparable *other, |
330 | | util::IComparable::Criterion criterion = |
331 | | util::IComparable::Criterion::STRICT, |
332 | | const io::DatabaseContextPtr &dbContext = nullptr) const override; |
333 | | //! @endcond |
334 | | |
335 | | protected: |
336 | | PROJ_INTERNAL explicit CoordinateSystem( |
337 | | const std::vector<CoordinateSystemAxisNNPtr> &axisIn); |
338 | | |
339 | | private: |
340 | | PROJ_OPAQUE_PRIVATE_DATA |
341 | | CoordinateSystem(const CoordinateSystem &other) = delete; |
342 | | CoordinateSystem &operator=(const CoordinateSystem &other) = delete; |
343 | | }; |
344 | | |
345 | | /** Shared pointer of CoordinateSystem. */ |
346 | | using CoordinateSystemPtr = std::shared_ptr<CoordinateSystem>; |
347 | | /** Non-null shared pointer of CoordinateSystem. */ |
348 | | using CoordinateSystemNNPtr = util::nn<CoordinateSystemPtr>; |
349 | | |
350 | | // --------------------------------------------------------------------------- |
351 | | |
352 | | class SphericalCS; |
353 | | /** Shared pointer of SphericalCS. */ |
354 | | using SphericalCSPtr = std::shared_ptr<SphericalCS>; |
355 | | /** Non-null shared pointer of SphericalCS. */ |
356 | | using SphericalCSNNPtr = util::nn<SphericalCSPtr>; |
357 | | |
358 | | /** \brief A three-dimensional coordinate system in Euclidean space with one |
359 | | * distance measured from the origin and two angular coordinates. |
360 | | * |
361 | | * Not to be confused with an ellipsoidal coordinate system based on an |
362 | | * ellipsoid "degenerated" into a sphere. A SphericalCS shall have three |
363 | | * axis associations. |
364 | | * |
365 | | * \remark Implements SphericalCS from \ref ISO_19111_2019 |
366 | | */ |
367 | | class PROJ_GCC_DLL SphericalCS final : public CoordinateSystem { |
368 | | public: |
369 | | //! @cond Doxygen_Suppress |
370 | | PROJ_DLL ~SphericalCS() override; |
371 | | //! @endcond |
372 | | |
373 | | // non-standard |
374 | | |
375 | | PROJ_DLL static SphericalCSNNPtr |
376 | | create(const util::PropertyMap &properties, |
377 | | const CoordinateSystemAxisNNPtr &axis1, |
378 | | const CoordinateSystemAxisNNPtr &axis2, |
379 | | const CoordinateSystemAxisNNPtr &axis3); |
380 | | |
381 | | PROJ_DLL static SphericalCSNNPtr |
382 | | create(const util::PropertyMap &properties, |
383 | | const CoordinateSystemAxisNNPtr &axis1, |
384 | | const CoordinateSystemAxisNNPtr &axis2); |
385 | | |
386 | | /** Value of getWKT2Type() */ |
387 | | static constexpr const char *WKT2_TYPE = "spherical"; |
388 | | |
389 | | protected: |
390 | | PROJ_INTERNAL explicit SphericalCS( |
391 | | const std::vector<CoordinateSystemAxisNNPtr> &axisIn); |
392 | | INLINED_MAKE_SHARED |
393 | | |
394 | 1.46k | PROJ_INTERNAL std::string getWKT2Type(bool) const override { |
395 | 1.46k | return WKT2_TYPE; |
396 | 1.46k | } |
397 | | |
398 | | private: |
399 | | SphericalCS(const SphericalCS &other) = delete; |
400 | | }; |
401 | | |
402 | | // --------------------------------------------------------------------------- |
403 | | |
404 | | class EllipsoidalCS; |
405 | | /** Shared pointer of EllipsoidalCS. */ |
406 | | using EllipsoidalCSPtr = std::shared_ptr<EllipsoidalCS>; |
407 | | /** Non-null shared pointer of EllipsoidalCS. */ |
408 | | using EllipsoidalCSNNPtr = util::nn<EllipsoidalCSPtr>; |
409 | | |
410 | | /** \brief A two- or three-dimensional coordinate system in which position is |
411 | | * specified by geodetic latitude, geodetic longitude, and (in the |
412 | | * three-dimensional case) ellipsoidal height. |
413 | | * |
414 | | * An EllipsoidalCS shall have two or three associations. |
415 | | * |
416 | | * \remark Implements EllipsoidalCS from \ref ISO_19111_2019 |
417 | | */ |
418 | | class PROJ_GCC_DLL EllipsoidalCS final : public CoordinateSystem { |
419 | | public: |
420 | | //! @cond Doxygen_Suppress |
421 | | PROJ_DLL ~EllipsoidalCS() override; |
422 | | //! @endcond |
423 | | |
424 | | // non-standard |
425 | | PROJ_DLL static EllipsoidalCSNNPtr |
426 | | create(const util::PropertyMap &properties, |
427 | | const CoordinateSystemAxisNNPtr &axis1, |
428 | | const CoordinateSystemAxisNNPtr &axis2); |
429 | | |
430 | | PROJ_DLL static EllipsoidalCSNNPtr |
431 | | create(const util::PropertyMap &properties, |
432 | | const CoordinateSystemAxisNNPtr &axis1, |
433 | | const CoordinateSystemAxisNNPtr &axis2, |
434 | | const CoordinateSystemAxisNNPtr &axis3); |
435 | | |
436 | | PROJ_DLL static EllipsoidalCSNNPtr |
437 | | createLatitudeLongitude(const common::UnitOfMeasure &unit); |
438 | | |
439 | | PROJ_DLL static EllipsoidalCSNNPtr createLatitudeLongitudeEllipsoidalHeight( |
440 | | const common::UnitOfMeasure &angularUnit, |
441 | | const common::UnitOfMeasure &linearUnit); |
442 | | |
443 | | PROJ_DLL static EllipsoidalCSNNPtr |
444 | | createLongitudeLatitude(const common::UnitOfMeasure &unit); |
445 | | |
446 | | PROJ_DLL static EllipsoidalCSNNPtr createLongitudeLatitudeEllipsoidalHeight( |
447 | | const common::UnitOfMeasure &angularUnit, |
448 | | const common::UnitOfMeasure &linearUnit); |
449 | | |
450 | | /** Value of getWKT2Type() */ |
451 | | static constexpr const char *WKT2_TYPE = "ellipsoidal"; |
452 | | |
453 | | //! @cond Doxygen_Suppress |
454 | | |
455 | | /** \brief Typical axis order. */ |
456 | | enum class AxisOrder { |
457 | | /** Latitude(North), Longitude(East) */ |
458 | | LAT_NORTH_LONG_EAST, |
459 | | /** Latitude(North), Longitude(East), Height(up) */ |
460 | | LAT_NORTH_LONG_EAST_HEIGHT_UP, |
461 | | /** Longitude(East), Latitude(North) */ |
462 | | LONG_EAST_LAT_NORTH, |
463 | | /** Longitude(East), Latitude(North), Height(up) */ |
464 | | LONG_EAST_LAT_NORTH_HEIGHT_UP, |
465 | | /** Other axis order. */ |
466 | | OTHER |
467 | | }; |
468 | | |
469 | | PROJ_INTERNAL AxisOrder axisOrder() const; |
470 | | |
471 | | PROJ_INTERNAL EllipsoidalCSNNPtr |
472 | | alterAngularUnit(const common::UnitOfMeasure &angularUnit) const; |
473 | | |
474 | | PROJ_INTERNAL EllipsoidalCSNNPtr |
475 | | alterLinearUnit(const common::UnitOfMeasure &linearUnit) const; |
476 | | |
477 | | //! @endcond |
478 | | |
479 | | protected: |
480 | | PROJ_INTERNAL explicit EllipsoidalCS( |
481 | | const std::vector<CoordinateSystemAxisNNPtr> &axisIn); |
482 | | INLINED_MAKE_SHARED |
483 | | |
484 | 990k | PROJ_INTERNAL std::string getWKT2Type(bool) const override { |
485 | 990k | return WKT2_TYPE; |
486 | 990k | } |
487 | | |
488 | | protected: |
489 | | EllipsoidalCS(const EllipsoidalCS &other) = delete; |
490 | | }; |
491 | | |
492 | | // --------------------------------------------------------------------------- |
493 | | |
494 | | class VerticalCS; |
495 | | /** Shared pointer of VerticalCS. */ |
496 | | using VerticalCSPtr = std::shared_ptr<VerticalCS>; |
497 | | /** Non-null shared pointer of VerticalCS. */ |
498 | | using VerticalCSNNPtr = util::nn<VerticalCSPtr>; |
499 | | |
500 | | /** \brief A one-dimensional coordinate system used to record the heights or |
501 | | * depths of points. |
502 | | * |
503 | | * Such a coordinate system is usually dependent on the Earth's gravity field. |
504 | | * A VerticalCS shall have one axis association. |
505 | | * |
506 | | * \remark Implements VerticalCS from \ref ISO_19111_2019 |
507 | | */ |
508 | | class PROJ_GCC_DLL VerticalCS final : public CoordinateSystem { |
509 | | public: |
510 | | //! @cond Doxygen_Suppress |
511 | | PROJ_DLL ~VerticalCS() override; |
512 | | //! @endcond |
513 | | |
514 | | PROJ_DLL static VerticalCSNNPtr |
515 | | create(const util::PropertyMap &properties, |
516 | | const CoordinateSystemAxisNNPtr &axis); |
517 | | |
518 | | PROJ_DLL static VerticalCSNNPtr |
519 | | createGravityRelatedHeight(const common::UnitOfMeasure &unit); |
520 | | |
521 | | /** Value of getWKT2Type() */ |
522 | | static constexpr const char *WKT2_TYPE = "vertical"; |
523 | | |
524 | | PROJ_PRIVATE : |
525 | | //! @cond Doxygen_Suppress |
526 | | PROJ_INTERNAL VerticalCSNNPtr |
527 | | alterUnit(const common::UnitOfMeasure &unit) const; |
528 | | |
529 | | //! @endcond |
530 | | |
531 | | protected: |
532 | | PROJ_INTERNAL explicit VerticalCS(const CoordinateSystemAxisNNPtr &axisIn); |
533 | | INLINED_MAKE_SHARED |
534 | | |
535 | 64.5k | PROJ_INTERNAL std::string getWKT2Type(bool) const override { |
536 | 64.5k | return WKT2_TYPE; |
537 | 64.5k | } |
538 | | |
539 | | private: |
540 | | VerticalCS(const VerticalCS &other) = delete; |
541 | | }; |
542 | | |
543 | | // --------------------------------------------------------------------------- |
544 | | |
545 | | class CartesianCS; |
546 | | /** Shared pointer of CartesianCS. */ |
547 | | using CartesianCSPtr = std::shared_ptr<CartesianCS>; |
548 | | /** Non-null shared pointer of CartesianCS. */ |
549 | | using CartesianCSNNPtr = util::nn<CartesianCSPtr>; |
550 | | |
551 | | /** \brief A two- or three-dimensional coordinate system in Euclidean space |
552 | | * with orthogonal straight axes. |
553 | | * |
554 | | * All axes shall have the same length unit. A CartesianCS shall have two or |
555 | | * three axis associations; the number of associations shall equal the |
556 | | * dimension of the CS. |
557 | | * |
558 | | * \remark Implements CartesianCS from \ref ISO_19111_2019 |
559 | | */ |
560 | | class PROJ_GCC_DLL CartesianCS final : public CoordinateSystem { |
561 | | public: |
562 | | //! @cond Doxygen_Suppress |
563 | | PROJ_DLL ~CartesianCS() override; |
564 | | //! @endcond |
565 | | |
566 | | PROJ_DLL static CartesianCSNNPtr |
567 | | create(const util::PropertyMap &properties, |
568 | | const CoordinateSystemAxisNNPtr &axis1, |
569 | | const CoordinateSystemAxisNNPtr &axis2, bool enforceSameUnit = true); |
570 | | PROJ_DLL static CartesianCSNNPtr |
571 | | create(const util::PropertyMap &properties, |
572 | | const CoordinateSystemAxisNNPtr &axis1, |
573 | | const CoordinateSystemAxisNNPtr &axis2, |
574 | | const CoordinateSystemAxisNNPtr &axis3, bool enforceSameUnit = true); |
575 | | |
576 | | PROJ_DLL static CartesianCSNNPtr |
577 | | createEastingNorthing(const common::UnitOfMeasure &unit); |
578 | | |
579 | | PROJ_DLL static CartesianCSNNPtr |
580 | | createNorthingEasting(const common::UnitOfMeasure &unit); |
581 | | |
582 | | PROJ_DLL static CartesianCSNNPtr |
583 | | createNorthPoleEastingSouthNorthingSouth(const common::UnitOfMeasure &unit); |
584 | | |
585 | | PROJ_DLL static CartesianCSNNPtr |
586 | | createSouthPoleEastingNorthNorthingNorth(const common::UnitOfMeasure &unit); |
587 | | |
588 | | PROJ_DLL static CartesianCSNNPtr |
589 | | createWestingSouthing(const common::UnitOfMeasure &unit); |
590 | | |
591 | | PROJ_DLL static CartesianCSNNPtr |
592 | | createGeocentric(const common::UnitOfMeasure &unit); |
593 | | |
594 | | /** Value of getWKT2Type() */ |
595 | | static constexpr const char *WKT2_TYPE = |
596 | | "Cartesian"; // uppercase is intended |
597 | | |
598 | | PROJ_PRIVATE : |
599 | | //! @cond Doxygen_Suppress |
600 | | PROJ_INTERNAL CartesianCSNNPtr |
601 | | alterUnit(const common::UnitOfMeasure &unit) const; |
602 | | |
603 | | //! @endcond |
604 | | |
605 | | protected: |
606 | | PROJ_INTERNAL explicit CartesianCS( |
607 | | const std::vector<CoordinateSystemAxisNNPtr> &axisIn); |
608 | | INLINED_MAKE_SHARED |
609 | | |
610 | 141k | PROJ_INTERNAL std::string getWKT2Type(bool) const override { |
611 | 141k | return WKT2_TYPE; |
612 | 141k | } |
613 | | |
614 | | private: |
615 | | CartesianCS(const CartesianCS &other) = delete; |
616 | | }; |
617 | | |
618 | | // --------------------------------------------------------------------------- |
619 | | |
620 | | class AffineCS; |
621 | | /** Shared pointer of AffineCS. */ |
622 | | using AffineCSPtr = std::shared_ptr<AffineCS>; |
623 | | /** Non-null shared pointer of AffineCS. */ |
624 | | using AffineCSNNPtr = util::nn<AffineCSPtr>; |
625 | | |
626 | | /** \brief A two- or three-dimensional coordinate system in Euclidean space |
627 | | * with straight axes that are not necessarily orthogonal. |
628 | | * |
629 | | * \remark Implements AffineCS from \ref ISO_19111_2019 |
630 | | * \since 9.2 |
631 | | */ |
632 | | class PROJ_GCC_DLL AffineCS final : public CoordinateSystem { |
633 | | public: |
634 | | //! @cond Doxygen_Suppress |
635 | | PROJ_DLL ~AffineCS() override; |
636 | | //! @endcond |
637 | | |
638 | | /** Value of getWKT2Type() */ |
639 | | static constexpr const char *WKT2_TYPE = "affine"; |
640 | | |
641 | | PROJ_DLL static AffineCSNNPtr |
642 | | create(const util::PropertyMap &properties, |
643 | | const CoordinateSystemAxisNNPtr &axis1, |
644 | | const CoordinateSystemAxisNNPtr &axis2); |
645 | | PROJ_DLL static AffineCSNNPtr |
646 | | create(const util::PropertyMap &properties, |
647 | | const CoordinateSystemAxisNNPtr &axis1, |
648 | | const CoordinateSystemAxisNNPtr &axis2, |
649 | | const CoordinateSystemAxisNNPtr &axis3); |
650 | | |
651 | | PROJ_PRIVATE : |
652 | | //! @cond Doxygen_Suppress |
653 | | PROJ_INTERNAL AffineCSNNPtr |
654 | | alterUnit(const common::UnitOfMeasure &unit) const; |
655 | | |
656 | | //! @endcond |
657 | | |
658 | | protected: |
659 | | PROJ_INTERNAL explicit AffineCS( |
660 | | const std::vector<CoordinateSystemAxisNNPtr> &axisIn); |
661 | | INLINED_MAKE_SHARED |
662 | | |
663 | 0 | PROJ_INTERNAL std::string getWKT2Type(bool) const override { |
664 | 0 | return WKT2_TYPE; |
665 | 0 | } |
666 | | |
667 | | private: |
668 | | AffineCS(const AffineCS &other) = delete; |
669 | | }; |
670 | | |
671 | | // --------------------------------------------------------------------------- |
672 | | |
673 | | class OrdinalCS; |
674 | | /** Shared pointer of OrdinalCS. */ |
675 | | using OrdinalCSPtr = std::shared_ptr<OrdinalCS>; |
676 | | /** Non-null shared pointer of OrdinalCS. */ |
677 | | using OrdinalCSNNPtr = util::nn<OrdinalCSPtr>; |
678 | | |
679 | | /** \brief n-dimensional coordinate system in which every axis uses integers. |
680 | | * |
681 | | * The number of associations shall equal the |
682 | | * dimension of the CS. |
683 | | * |
684 | | * \remark Implements OrdinalCS from \ref ISO_19111_2019 |
685 | | */ |
686 | | class PROJ_GCC_DLL OrdinalCS final : public CoordinateSystem { |
687 | | public: |
688 | | //! @cond Doxygen_Suppress |
689 | | PROJ_DLL ~OrdinalCS() override; |
690 | | //! @endcond |
691 | | |
692 | | PROJ_DLL static OrdinalCSNNPtr |
693 | | create(const util::PropertyMap &properties, |
694 | | const std::vector<CoordinateSystemAxisNNPtr> &axisIn); |
695 | | |
696 | | /** Value of getWKT2Type() */ |
697 | | static constexpr const char *WKT2_TYPE = "ordinal"; |
698 | | |
699 | | protected: |
700 | | PROJ_INTERNAL explicit OrdinalCS( |
701 | | const std::vector<CoordinateSystemAxisNNPtr> &axisIn); |
702 | | INLINED_MAKE_SHARED |
703 | | |
704 | 0 | PROJ_INTERNAL std::string getWKT2Type(bool) const override { |
705 | 0 | return WKT2_TYPE; |
706 | 0 | } |
707 | | |
708 | | private: |
709 | | OrdinalCS(const OrdinalCS &other) = delete; |
710 | | }; |
711 | | |
712 | | // --------------------------------------------------------------------------- |
713 | | |
714 | | class ParametricCS; |
715 | | /** Shared pointer of ParametricCS. */ |
716 | | using ParametricCSPtr = std::shared_ptr<ParametricCS>; |
717 | | /** Non-null shared pointer of ParametricCS. */ |
718 | | using ParametricCSNNPtr = util::nn<ParametricCSPtr>; |
719 | | |
720 | | /** \brief one-dimensional coordinate reference system which uses parameter |
721 | | * values or functions that may vary monotonically with height. |
722 | | * |
723 | | * \remark Implements ParametricCS from \ref ISO_19111_2019 |
724 | | */ |
725 | | class PROJ_GCC_DLL ParametricCS final : public CoordinateSystem { |
726 | | public: |
727 | | //! @cond Doxygen_Suppress |
728 | | PROJ_DLL ~ParametricCS() override; |
729 | | //! @endcond |
730 | | |
731 | | PROJ_DLL static ParametricCSNNPtr |
732 | | create(const util::PropertyMap &properties, |
733 | | const CoordinateSystemAxisNNPtr &axisIn); |
734 | | |
735 | | /** Value of getWKT2Type() */ |
736 | | static constexpr const char *WKT2_TYPE = "parametric"; |
737 | | |
738 | | protected: |
739 | | PROJ_INTERNAL explicit ParametricCS( |
740 | | const std::vector<CoordinateSystemAxisNNPtr> &axisIn); |
741 | | INLINED_MAKE_SHARED |
742 | | |
743 | 0 | PROJ_INTERNAL std::string getWKT2Type(bool) const override { |
744 | 0 | return WKT2_TYPE; |
745 | 0 | } |
746 | | |
747 | | private: |
748 | | ParametricCS(const ParametricCS &other) = delete; |
749 | | }; |
750 | | |
751 | | // --------------------------------------------------------------------------- |
752 | | |
753 | | class TemporalCS; |
754 | | /** Shared pointer of TemporalCS. */ |
755 | | using TemporalCSPtr = std::shared_ptr<TemporalCS>; |
756 | | /** Non-null shared pointer of TemporalCS. */ |
757 | | using TemporalCSNNPtr = util::nn<TemporalCSPtr>; |
758 | | |
759 | | /** \brief (Abstract class) A one-dimensional coordinate system used to record |
760 | | * time. |
761 | | * |
762 | | * A TemporalCS shall have one axis association. |
763 | | * |
764 | | * \remark Implements TemporalCS from \ref ISO_19111_2019 |
765 | | */ |
766 | | class PROJ_GCC_DLL TemporalCS : public CoordinateSystem { |
767 | | public: |
768 | | //! @cond Doxygen_Suppress |
769 | | PROJ_DLL ~TemporalCS() override; |
770 | | //! @endcond |
771 | | |
772 | | /** WKT2:2015 type */ |
773 | | static constexpr const char *WKT2_2015_TYPE = "temporal"; |
774 | | |
775 | | protected: |
776 | | PROJ_INTERNAL explicit TemporalCS(const CoordinateSystemAxisNNPtr &axis); |
777 | | INLINED_MAKE_SHARED |
778 | | |
779 | | PROJ_INTERNAL std::string |
780 | | getWKT2Type(bool use2019Keywords) const override = 0; |
781 | | |
782 | | private: |
783 | | TemporalCS(const TemporalCS &other) = delete; |
784 | | }; |
785 | | |
786 | | // --------------------------------------------------------------------------- |
787 | | |
788 | | class DateTimeTemporalCS; |
789 | | /** Shared pointer of DateTimeTemporalCS. */ |
790 | | using DateTimeTemporalCSPtr = std::shared_ptr<DateTimeTemporalCS>; |
791 | | /** Non-null shared pointer of DateTimeTemporalCS. */ |
792 | | using DateTimeTemporalCSNNPtr = util::nn<DateTimeTemporalCSPtr>; |
793 | | |
794 | | /** \brief A one-dimensional coordinate system used to record time in dateTime |
795 | | * representation as defined in ISO 8601. |
796 | | * |
797 | | * A DateTimeTemporalCS shall have one axis association. It does not use |
798 | | * axisUnitID; the temporal quantities are defined through the ISO 8601 |
799 | | * representation. |
800 | | * |
801 | | * \remark Implements DateTimeTemporalCS from \ref ISO_19111_2019 |
802 | | */ |
803 | | class PROJ_GCC_DLL DateTimeTemporalCS final : public TemporalCS { |
804 | | public: |
805 | | //! @cond Doxygen_Suppress |
806 | | PROJ_DLL ~DateTimeTemporalCS() override; |
807 | | //! @endcond |
808 | | |
809 | | PROJ_DLL static DateTimeTemporalCSNNPtr |
810 | | create(const util::PropertyMap &properties, |
811 | | const CoordinateSystemAxisNNPtr &axis); |
812 | | |
813 | | /** WKT2:2019 type */ |
814 | | static constexpr const char *WKT2_2019_TYPE = "TemporalDateTime"; |
815 | | |
816 | | protected: |
817 | | PROJ_INTERNAL explicit DateTimeTemporalCS( |
818 | | const CoordinateSystemAxisNNPtr &axis); |
819 | | INLINED_MAKE_SHARED |
820 | | |
821 | | PROJ_INTERNAL std::string getWKT2Type(bool use2019Keywords) const override; |
822 | | |
823 | | private: |
824 | | DateTimeTemporalCS(const DateTimeTemporalCS &other) = delete; |
825 | | }; |
826 | | |
827 | | // --------------------------------------------------------------------------- |
828 | | |
829 | | class TemporalCountCS; |
830 | | /** Shared pointer of TemporalCountCS. */ |
831 | | using TemporalCountCSPtr = std::shared_ptr<TemporalCountCS>; |
832 | | /** Non-null shared pointer of TemporalCountCS. */ |
833 | | using TemporalCountCSNNPtr = util::nn<TemporalCountCSPtr>; |
834 | | |
835 | | /** \brief A one-dimensional coordinate system used to record time as an |
836 | | * integer count. |
837 | | * |
838 | | * A TemporalCountCS shall have one axis association. |
839 | | * |
840 | | * \remark Implements TemporalCountCS from \ref ISO_19111_2019 |
841 | | */ |
842 | | class PROJ_GCC_DLL TemporalCountCS final : public TemporalCS { |
843 | | public: |
844 | | //! @cond Doxygen_Suppress |
845 | | PROJ_DLL ~TemporalCountCS() override; |
846 | | //! @endcond |
847 | | |
848 | | PROJ_DLL static TemporalCountCSNNPtr |
849 | | create(const util::PropertyMap &properties, |
850 | | const CoordinateSystemAxisNNPtr &axis); |
851 | | |
852 | | /** WKT2:2019 type */ |
853 | | static constexpr const char *WKT2_2019_TYPE = "TemporalCount"; |
854 | | |
855 | | protected: |
856 | | PROJ_INTERNAL explicit TemporalCountCS( |
857 | | const CoordinateSystemAxisNNPtr &axis); |
858 | | INLINED_MAKE_SHARED |
859 | | |
860 | | PROJ_INTERNAL std::string getWKT2Type(bool use2019Keywords) const override; |
861 | | |
862 | | private: |
863 | | TemporalCountCS(const TemporalCountCS &other) = delete; |
864 | | }; |
865 | | |
866 | | // --------------------------------------------------------------------------- |
867 | | |
868 | | class TemporalMeasureCS; |
869 | | /** Shared pointer of TemporalMeasureCS. */ |
870 | | using TemporalMeasureCSPtr = std::shared_ptr<TemporalMeasureCS>; |
871 | | /** Non-null shared pointer of TemporalMeasureCS. */ |
872 | | using TemporalMeasureCSNNPtr = util::nn<TemporalMeasureCSPtr>; |
873 | | |
874 | | /** \brief A one-dimensional coordinate system used to record a time as a |
875 | | * real number. |
876 | | * |
877 | | * A TemporalMeasureCS shall have one axis association. |
878 | | * |
879 | | * \remark Implements TemporalMeasureCS from \ref ISO_19111_2019 |
880 | | */ |
881 | | class PROJ_GCC_DLL TemporalMeasureCS final : public TemporalCS { |
882 | | public: |
883 | | //! @cond Doxygen_Suppress |
884 | | PROJ_DLL ~TemporalMeasureCS() override; |
885 | | //! @endcond |
886 | | |
887 | | PROJ_DLL static TemporalMeasureCSNNPtr |
888 | | create(const util::PropertyMap &properties, |
889 | | const CoordinateSystemAxisNNPtr &axis); |
890 | | |
891 | | /** WKT2:2019 type */ |
892 | | static constexpr const char *WKT2_2019_TYPE = "TemporalMeasure"; |
893 | | |
894 | | protected: |
895 | | PROJ_INTERNAL explicit TemporalMeasureCS( |
896 | | const CoordinateSystemAxisNNPtr &axis); |
897 | | INLINED_MAKE_SHARED |
898 | | |
899 | | PROJ_INTERNAL std::string getWKT2Type(bool use2019Keywords) const override; |
900 | | |
901 | | private: |
902 | | TemporalMeasureCS(const TemporalMeasureCS &other) = delete; |
903 | | }; |
904 | | |
905 | | } // namespace cs |
906 | | |
907 | | NS_PROJ_END |
908 | | |
909 | | #endif // CS_HH_INCLUDED |