18 #ifndef QGSCOORDINATEREFERENCESYSTEM_H 19 #define QGSCOORDINATEREFERENCESYSTEM_H 22 #include "qgis_core.h" 29 #include <QReadWriteLock> 30 #include <QExplicitlySharedDataPointer> 41 class QgsCoordinateReferenceSystemPrivate;
43 #if PROJ_VERSION_MAJOR>=6 46 typedef struct PJconsts PJ;
203 Q_PROPERTY(
bool isGeographic READ isGeographic )
256 operator QVariant()
const 258 return QVariant::fromValue( *
this );
268 static QList< long > validSrsIds();
327 bool createFromId(
long id,
CrsType type = PostgisCrsId );
341 bool createFromOgcWmsCrs(
const QString &
crs );
350 bool createFromSrid(
long srid );
365 bool createFromWkt(
const QString &wkt );
377 bool createFromSrsId(
long srsId );
402 bool createFromProj4(
const QString &projString );
418 bool createFromString(
const QString &definition );
435 bool createFromUserInput(
const QString &definition );
446 static void setupESRIWktFix();
449 bool isValid()
const;
473 long findMatchingProj();
495 bool readXml(
const QDomNode &node );
503 bool writeXml( QDomNode &node, QDomDocument &doc )
const;
532 long postgisSrid()
const;
546 QString authid()
const;
556 QString description()
const;
564 QString projectionAcronym()
const;
572 QString ellipsoidAcronym()
const;
579 QString toWkt()
const;
591 QString toProj4()
const;
597 bool isGeographic()
const;
603 bool hasAxisInverted()
const;
625 void setValidationHint(
const QString &html );
630 QString validationHint();
638 static int syncDatabase();
646 long saveAsUserCrs(
const QString &name );
649 QString geographicCrsAuthId()
const;
652 #if PROJ_VERSION_MAJOR>=6 663 PJ *projObject()
const;
672 static QStringList recentProjections();
680 static void invalidateCache();
692 static QString proj4FromSrsId(
int srsId );
698 void setInternalId(
long srsId );
704 void setSrid(
long srid );
710 void setDescription(
const QString &description );
723 void setProj4String(
const QString &proj4String );
729 void setGeographicFlag(
bool geoFlag );
735 void setEpsg(
long epsg );
741 void setAuthId(
const QString &theID );
747 void setProjectionAcronym(
const QString &projectionAcronym );
753 void setEllipsoidAcronym(
const QString &ellipsoidAcronym );
761 typedef QMap<QString, QString> RecordMap;
770 RecordMap getRecord(
const QString &sql );
782 long getRecordCount();
784 #if PROJ_VERSION_MAJOR>=6 785 bool loadFromAuthCode(
const QString &auth,
const QString &code );
792 bool loadFromDatabase(
const QString &db,
const QString &expression,
const QString &value );
794 #if PROJ_VERSION_MAJOR<6 // not used for proj >= 6.0 795 static bool loadIds( QHash<int, QString> &wkts );
796 static bool loadWkts( QHash<int, QString> &wkts,
const char *filename );
799 static bool syncDatumTransform(
const QString &dbPath );
802 QExplicitlySharedDataPointer<QgsCoordinateReferenceSystemPrivate> d;
810 static QReadWriteLock sSrIdCacheLock;
811 static QHash< long, QgsCoordinateReferenceSystem > sSrIdCache;
812 static QReadWriteLock sOgcLock;
813 static QHash< QString, QgsCoordinateReferenceSystem > sOgcCache;
814 static QReadWriteLock sProj4CacheLock;
815 static QHash< QString, QgsCoordinateReferenceSystem > sProj4Cache;
816 static QReadWriteLock sCRSWktLock;
817 static QHash< QString, QgsCoordinateReferenceSystem > sWktCache;
818 static QReadWriteLock sCRSSrsIdLock;
819 static QHash< long, QgsCoordinateReferenceSystem > sSrsIdCache;
820 static QReadWriteLock sCrsStringLock;
821 static QHash< QString, QgsCoordinateReferenceSystem > sStringCache;
823 friend class TestQgsCoordinateReferenceSystem;
832 QString mySummary( QStringLiteral(
"\n\tSpatial Reference System:" ) );
833 mySummary += QLatin1String(
"\n\t\tDescription : " );
840 mySummary += QLatin1String(
"Undefined" );
842 mySummary += QLatin1String(
"\n\t\tProjection : " );
849 mySummary += QLatin1String(
"Undefined" );
852 mySummary += QLatin1String(
"\n\t\tEllipsoid : " );
859 mySummary += QLatin1String(
"Undefined" );
862 mySummary += QLatin1String(
"\n\t\tProj4String : " );
869 mySummary += QLatin1String(
"Undefined" );
872 return os << mySummary.toLocal8Bit().data() << std::endl;
876 #endif // QGSCOORDINATEREFERENCESYSTEM_H A rectangle specified with double values.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
QString toProj4() const
Returns a Proj4 string representation of this CRS.
const QgsCoordinateReferenceSystem & crs
Internal ID used by QGIS in the local SQLite database.
QString ellipsoidAcronym() const
Returns the ellipsoid acronym for the ellipsoid used by the CRS.
QString description() const
Returns the descriptive name of the CRS, e.g., "WGS 84" or "GDA 94 / Vicgrid94".
Q_DECLARE_METATYPE(QgsMeshTimeSettings)
std::ostream & operator<<(std::ostream &os, const QgsCoordinateReferenceSystem &r)
Output stream operator.
CrsType
Enumeration of types of IDs accepted in createFromId() method.
QString projectionAcronym() const
Returns the projection acronym for the projection used by the CRS.
DistanceUnit
Units of distance.
Unique pointer for sqlite3 databases, which automatically closes the database when the pointer goes o...
This class represents a coordinate reference system (CRS).
void(* CUSTOM_CRS_VALIDATION)(QgsCoordinateReferenceSystem &)
void * OGRSpatialReferenceH