1 /*************************************************************************** 2 qgsdatums.h 3 ------------------------ 4 begin : May 2021 5 copyright : (C) 2021 Nyall Dawson 6 email : nyall dot dawson at gmail dot com 7 ***************************************************************************/ 8 9 /*************************************************************************** 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 ***************************************************************************/ 17 #ifndef QGSDATUMS_H 18 #define QGSDATUMS_H 19 20 #include "qgis_core.h" 21 #include "qgis_sip.h" 22 #include "qgsrectangle.h" 23 #include <QString> 24 #include <QList> 25 26 27 /** 28 * \ingroup core 29 * \brief Contains information about a member of a datum ensemble. 30 * 31 * \note Only used in builds based on on PROJ 7.2 or later 32 * \since QGIS 3.20 33 */ 34 class CORE_EXPORT QgsDatumEnsembleMember 35 { 36 public: 37 38 /** 39 * Returns the name of the member. 40 */ name()41 QString name() const { return mName; } 42 43 /** 44 * Returns the scope of operation, from EPSG registry database. 45 */ scope()46 QString scope() const { return mScope; } 47 48 /** 49 * Remarks for operation, from EPSG registry database. 50 */ remarks()51 QString remarks() const { return mRemarks; } 52 53 /** 54 * Authority name, e.g. EPSG. 55 */ authority()56 QString authority() const { return mAuthority; } 57 58 /** 59 * Authority code, e.g. "8447" (for EPSG:8447). 60 */ code()61 QString code() const { return mCode; } 62 63 #ifdef SIP_RUN 64 SIP_PYOBJECT __repr__(); 65 % MethodCode 66 QString id; 67 if ( !sipCpp->code().isEmpty() ) 68 id = QStringLiteral( "%1 (%2:%3)" ).arg( sipCpp->name(), sipCpp->authority(), sipCpp->code() ); 69 else 70 id = sipCpp->name(); 71 QString str = QStringLiteral( "<QgsDatumEnsembleMember: %1>" ).arg( id ); 72 sipRes = PyUnicode_FromString( str.toUtf8().constData() ); 73 % End 74 #endif 75 76 private: 77 78 QString mName; 79 QString mScope; 80 QString mRemarks; 81 QString mAuthority; 82 QString mCode; 83 84 friend class QgsCoordinateReferenceSystem; 85 }; 86 87 /** 88 * \ingroup core 89 * \brief Contains information about a datum ensemble. 90 * 91 * \note Only used in builds based on on PROJ 7.2 or later 92 * \since QGIS 3.20 93 */ 94 class CORE_EXPORT QgsDatumEnsemble 95 { 96 public: 97 98 /** 99 * Returns TRUE if the datum ensemble is a valid object, or FALSE if it is a null/invalid 100 * object. 101 */ isValid()102 bool isValid() const { return mValid; } 103 104 /** 105 * Display name of datum ensemble. 106 */ name()107 QString name() const { return mName; } 108 109 /** 110 * Positional accuracy (in meters). 111 */ accuracy()112 double accuracy() const { return mAccuracy; } 113 114 /** 115 * Authority name, e.g. EPSG. 116 */ authority()117 QString authority() const { return mAuthority; } 118 119 /** 120 * Identification code, e.g. "8447" (For EPSG:8447). 121 */ code()122 QString code() const { return mCode; } 123 124 /** 125 * Scope of ensemble, from EPSG registry database. 126 */ scope()127 QString scope() const { return mScope; } 128 129 /** 130 * Remarks for ensemble, from EPSG registry database. 131 */ remarks()132 QString remarks() const { return mRemarks; } 133 134 /** 135 * Contains a list of members of the ensemble. 136 */ members()137 QList< QgsDatumEnsembleMember > members() const { return mMembers; } 138 139 #ifdef SIP_RUN 140 SIP_PYOBJECT __repr__(); 141 % MethodCode 142 QString str; 143 if ( !sipCpp->isValid() ) 144 { 145 str = QStringLiteral( "<QgsDatumEnsemble: invalid>" ); 146 } 147 else 148 { 149 QString id; 150 if ( !sipCpp->code().isEmpty() ) 151 id = QStringLiteral( "%1 (%2:%3)" ).arg( sipCpp->name(), sipCpp->authority(), sipCpp->code() ); 152 else 153 id = sipCpp->name(); 154 str = QStringLiteral( "<QgsDatumEnsemble: %1>" ).arg( id ); 155 } 156 sipRes = PyUnicode_FromString( str.toUtf8().constData() ); 157 % End 158 #endif 159 160 private: 161 162 bool mValid = false; 163 QString mName; 164 double mAccuracy = 0; 165 QString mAuthority; 166 QString mCode; 167 QString mScope; 168 QString mRemarks; 169 QList< QgsDatumEnsembleMember > mMembers; 170 171 friend class QgsCoordinateReferenceSystem; 172 }; 173 174 #endif // QGSDATUMS_H 175