aboutsummaryrefslogtreecommitdiff
path: root/include/proj/crs.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/proj/crs.hpp')
-rw-r--r--include/proj/crs.hpp104
1 files changed, 93 insertions, 11 deletions
diff --git a/include/proj/crs.hpp b/include/proj/crs.hpp
index 33bf3b61..b83e0a6b 100644
--- a/include/proj/crs.hpp
+++ b/include/proj/crs.hpp
@@ -81,7 +81,8 @@ using CRSNNPtr = util::nn<CRSPtr>;
*
* \remark Implements CRS from \ref ISO_19111_2019
*/
-class PROJ_GCC_DLL CRS : public common::ObjectUsage {
+class PROJ_GCC_DLL CRS : public common::ObjectUsage,
+ public io::IJSONExportable {
public:
//! @cond Doxygen_Suppress
PROJ_DLL ~CRS() override;
@@ -273,6 +274,9 @@ class PROJ_GCC_DLL GeodeticCRS : virtual public SingleCRS,
PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter)
const override; // throw(FormattingException)
+ PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
+ const override; // throw(FormattingException)
+
PROJ_INTERNAL bool
_isEquivalentTo(const util::IComparable *other,
util::IComparable::Criterion criterion =
@@ -353,6 +357,9 @@ class PROJ_GCC_DLL GeographicCRS : public GeodeticCRS {
PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter)
const override; // throw(FormattingException)
+ PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
+ const override; // throw(FormattingException)
+
PROJ_DLL bool
is2DPartOf3D(util::nn<const GeographicCRS *> other) PROJ_PURE_DECL;
@@ -440,6 +447,12 @@ class PROJ_GCC_DLL VerticalCRS : virtual public SingleCRS,
PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
const override; // throw(io::FormattingException)
+ PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter)
+ const override; // throw(FormattingException)
+
+ PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
+ const override; // throw(FormattingException)
+
PROJ_INTERNAL bool
_isEquivalentTo(const util::IComparable *other,
util::IComparable::Criterion criterion =
@@ -453,9 +466,6 @@ class PROJ_GCC_DLL VerticalCRS : virtual public SingleCRS,
const cs::VerticalCSNNPtr &csIn);
PROJ_INTERNAL VerticalCRS(const VerticalCRS &other);
- PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter)
- const override; // throw(FormattingException)
-
PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>>
_identify(const io::AuthorityFactoryPtr &authorityFactory) const override;
@@ -495,6 +505,10 @@ class PROJ_GCC_DLL DerivedCRS : virtual public SingleCRS {
//! @cond Doxygen_Suppress
PROJ_INTERNAL const operation::ConversionNNPtr &
derivingConversionRef() PROJ_PURE_DECL;
+
+ PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
+ const override; // throw(FormattingException)
+
//! @endcond
protected:
@@ -515,6 +529,8 @@ class PROJ_GCC_DLL DerivedCRS : virtual public SingleCRS {
util::IComparable::Criterion criterion =
util::IComparable::Criterion::STRICT) const override;
+ PROJ_INTERNAL virtual const char *className() const = 0;
+
private:
PROJ_OPAQUE_PRIVATE_DATA
DerivedCRS &operator=(const DerivedCRS &other) = delete;
@@ -573,6 +589,9 @@ class PROJ_GCC_DLL ProjectedCRS final : public DerivedCRS,
PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
const override; // throw(io::FormattingException)
+ PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
+ const override; // throw(FormattingException)
+
PROJ_FOR_TEST ProjectedCRSNNPtr alterParametersLinearUnit(
const common::UnitOfMeasure &unit, bool convertToNewUnit) const;
@@ -596,6 +615,10 @@ class PROJ_GCC_DLL ProjectedCRS final : public DerivedCRS,
PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>>
_identify(const io::AuthorityFactoryPtr &authorityFactory) const override;
+ PROJ_INTERNAL const char *className() const override {
+ return "ProjectedCRS";
+ }
+
INLINED_MAKE_SHARED
PROJ_INTERNAL CRSNNPtr _shallowClone() const override;
@@ -636,7 +659,11 @@ class PROJ_GCC_DLL TemporalCRS : virtual public SingleCRS {
//! @cond Doxygen_Suppress
PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
const override; // throw(io::FormattingException)
- //! @endcond
+
+ PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
+ const override; // throw(FormattingException)
+
+ //! @endcond
protected:
PROJ_INTERNAL TemporalCRS(const datum::TemporalDatumNNPtr &datumIn,
@@ -693,7 +720,11 @@ class PROJ_GCC_DLL EngineeringCRS : virtual public SingleCRS {
//! @cond Doxygen_Suppress
PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
const override; // throw(io::FormattingException)
- //! @endcond
+
+ PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
+ const override; // throw(FormattingException)
+
+ //! @endcond
protected:
PROJ_INTERNAL EngineeringCRS(const datum::EngineeringDatumNNPtr &datumIn,
@@ -749,7 +780,11 @@ class PROJ_GCC_DLL ParametricCRS : virtual public SingleCRS {
//! @cond Doxygen_Suppress
PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
const override; // throw(io::FormattingException)
- //! @endcond
+
+ PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
+ const override; // throw(FormattingException)
+
+ //! @endcond
protected:
PROJ_INTERNAL ParametricCRS(const datum::ParametricDatumNNPtr &datumIn,
@@ -821,6 +856,9 @@ class PROJ_GCC_DLL CompoundCRS final : public CRS,
PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter)
const override; // throw(FormattingException)
+ PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
+ const override; // throw(FormattingException)
+
PROJ_INTERNAL CRSNNPtr _shallowClone() const override;
PROJ_INTERNAL bool
@@ -906,6 +944,9 @@ class PROJ_GCC_DLL BoundCRS final : public CRS,
PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter)
const override; // throw(FormattingException)
+ PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
+ const override; // throw(FormattingException)
+
PROJ_INTERNAL bool
_isEquivalentTo(const util::IComparable *other,
util::IComparable::Criterion criterion =
@@ -965,7 +1006,13 @@ class PROJ_GCC_DLL DerivedGeodeticCRS final : public GeodeticCRS,
//! @cond Doxygen_Suppress
void _exportToWKT(io::WKTFormatter *formatter)
const override; // throw(io::FormattingException)
- //! @endcond
+
+ PROJ_INTERNAL void
+ _exportToJSON(io::JSONFormatter *formatter) const override {
+ return DerivedCRS::_exportToJSON(formatter);
+ }
+
+ //! @endcond
protected:
PROJ_INTERNAL
@@ -992,6 +1039,10 @@ class PROJ_GCC_DLL DerivedGeodeticCRS final : public GeodeticCRS,
PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter)
const override; // throw(FormattingException)
+ PROJ_INTERNAL const char *className() const override {
+ return "DerivedGeodeticCRS";
+ }
+
INLINED_MAKE_SHARED
private:
@@ -1034,7 +1085,13 @@ class PROJ_GCC_DLL DerivedGeographicCRS final : public GeographicCRS,
//! @cond Doxygen_Suppress
PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
const override; // throw(io::FormattingException)
- //! @endcond
+
+ PROJ_INTERNAL void
+ _exportToJSON(io::JSONFormatter *formatter) const override {
+ return DerivedCRS::_exportToJSON(formatter);
+ }
+
+ //! @endcond
protected:
PROJ_INTERNAL
@@ -1053,6 +1110,10 @@ class PROJ_GCC_DLL DerivedGeographicCRS final : public GeographicCRS,
PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>>
_identify(const io::AuthorityFactoryPtr &authorityFactory) const override;
+ PROJ_INTERNAL const char *className() const override {
+ return "DerivedGeographicCRS";
+ }
+
// cppcheck-suppress functionStatic
PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter)
const override; // throw(FormattingException)
@@ -1114,6 +1175,10 @@ class PROJ_GCC_DLL DerivedProjectedCRS final : public DerivedCRS {
util::IComparable::Criterion criterion =
util::IComparable::Criterion::STRICT) const override;
+ PROJ_INTERNAL const char *className() const override {
+ return "DerivedProjectedCRS";
+ }
+
INLINED_MAKE_SHARED
private:
@@ -1153,7 +1218,13 @@ class PROJ_GCC_DLL DerivedVerticalCRS final : public VerticalCRS,
//! @cond Doxygen_Suppress
PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
const override; // throw(io::FormattingException)
- //! @endcond
+
+ PROJ_INTERNAL void
+ _exportToJSON(io::JSONFormatter *formatter) const override {
+ return DerivedCRS::_exportToJSON(formatter);
+ }
+
+ //! @endcond
protected:
PROJ_INTERNAL
@@ -1172,6 +1243,10 @@ class PROJ_GCC_DLL DerivedVerticalCRS final : public VerticalCRS,
PROJ_INTERNAL std::list<std::pair<CRSNNPtr, int>>
_identify(const io::AuthorityFactoryPtr &authorityFactory) const override;
+ PROJ_INTERNAL const char *className() const override {
+ return "DerivedVerticalCRS";
+ }
+
// cppcheck-suppress functionStatic
PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter)
const override; // throw(FormattingException)
@@ -1234,7 +1309,12 @@ class PROJ_GCC_DLL DerivedCRSTemplate final : public DerivedCRSTraits::BaseType,
//! @cond Doxygen_Suppress
PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
const override; // throw(io::FormattingException)
- //! @endcond
+
+ PROJ_INTERNAL void
+ _exportToJSON(io::JSONFormatter *formatter) const override {
+ return DerivedCRS::_exportToJSON(formatter);
+ }
+ //! @endcond
protected:
PROJ_INTERNAL
@@ -1250,6 +1330,8 @@ class PROJ_GCC_DLL DerivedCRSTemplate final : public DerivedCRSTraits::BaseType,
util::IComparable::Criterion criterion =
util::IComparable::Criterion::STRICT) const override;
+ PROJ_INTERNAL const char *className() const override;
+
INLINED_MAKE_SHARED
private: