Coverage Report

Created: 2025-06-13 06:29

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