18 #ifndef QGSCOORDINATEREFERENCESYSTEM_H 19 #define QGSCOORDINATEREFERENCESYSTEM_H 22 #include "qgis_core.h" 29 #include <QReadWriteLock> 39 class QgsCoordinateReferenceSystemPrivate;
242 operator QVariant()
const 244 return QVariant::fromValue( *
this );
254 static QList< long > validSrsIds();
311 bool createFromId(
long id,
CrsType type = PostgisCrsId );
323 bool createFromOgcWmsCrs(
const QString &
crs );
330 bool createFromSrid(
long srid );
345 bool createFromWkt(
const QString &wkt );
357 bool createFromSrsId(
long srsId );
382 bool createFromProj4(
const QString &projString );
398 bool createFromString(
const QString &definition );
415 bool createFromUserInput(
const QString &definition );
426 static void setupESRIWktFix();
429 bool isValid()
const;
451 long findMatchingProj();
473 bool readXml(
const QDomNode &node );
481 bool writeXml( QDomNode &node, QDomDocument &doc )
const;
508 long postgisSrid()
const;
522 QString authid()
const;
532 QString description()
const;
540 QString projectionAcronym()
const;
548 QString ellipsoidAcronym()
const;
555 QString toWkt()
const;
567 QString toProj4()
const;
573 bool isGeographic()
const;
579 bool hasAxisInverted()
const;
601 void setValidationHint(
const QString &html );
606 QString validationHint();
614 static int syncDatabase();
622 long saveAsUserCrs(
const QString &name );
625 QString geographicCrsAuthId()
const;
632 static QStringList recentProjections();
646 static void invalidateCache(
bool disableCache =
false );
656 static void invalidateCache(
bool disableCache
SIP_PYARGREMOVE =
false );
669 static QString proj4FromSrsId(
int srsId );
675 void setInternalId(
long srsId );
681 void setSrid(
long srid );
687 void setDescription(
const QString &description );
700 void setProj4String(
const QString &proj4String );
706 void setGeographicFlag(
bool geoFlag );
712 void setEpsg(
long epsg );
718 void setAuthId(
const QString &theID );
724 void setProjectionAcronym(
const QString &projectionAcronym );
730 void setEllipsoidAcronym(
const QString &ellipsoidAcronym );
738 typedef QMap<QString, QString> RecordMap;
747 RecordMap getRecord(
const QString &sql );
759 long getRecordCount();
765 bool loadFromDatabase(
const QString &db,
const QString &expression,
const QString &value );
767 static bool loadIds( QHash<int, QString> &wkts );
768 static bool loadWkts( QHash<int, QString> &wkts,
const char *filename );
770 static bool syncDatumTransform(
const QString &dbPath );
772 QExplicitlySharedDataPointer<QgsCoordinateReferenceSystemPrivate> d;
780 static QReadWriteLock sSrIdCacheLock;
781 static QHash< long, QgsCoordinateReferenceSystem > sSrIdCache;
782 static bool sDisableSrIdCache;
784 static QReadWriteLock sOgcLock;
785 static QHash< QString, QgsCoordinateReferenceSystem > sOgcCache;
786 static bool sDisableOgcCache;
788 static QReadWriteLock sProj4CacheLock;
789 static QHash< QString, QgsCoordinateReferenceSystem > sProj4Cache;
790 static bool sDisableProj4Cache;
792 static QReadWriteLock sCRSWktLock;
793 static QHash< QString, QgsCoordinateReferenceSystem > sWktCache;
794 static bool sDisableWktCache;
796 static QReadWriteLock sCRSSrsIdLock;
797 static QHash< long, QgsCoordinateReferenceSystem > sSrsIdCache;
798 static bool sDisableSrsIdCache;
800 static QReadWriteLock sCrsStringLock;
801 static QHash< QString, QgsCoordinateReferenceSystem > sStringCache;
802 static bool sDisableStringCache;
804 friend class TestQgsCoordinateReferenceSystem;
813 QString mySummary( QStringLiteral(
"\n\tSpatial Reference System:" ) );
814 mySummary += QLatin1String(
"\n\t\tDescription : " );
821 mySummary += QLatin1String(
"Undefined" );
823 mySummary += QLatin1String(
"\n\t\tProjection : " );
830 mySummary += QLatin1String(
"Undefined" );
833 mySummary += QLatin1String(
"\n\t\tEllipsoid : " );
840 mySummary += QLatin1String(
"Undefined" );
843 mySummary += QLatin1String(
"\n\t\tProj4String : " );
850 mySummary += QLatin1String(
"Undefined" );
853 return os << mySummary.toLocal8Bit().data() << std::endl;
857 #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)
const QgsCoordinateReferenceSystem & crs
Q_DECLARE_METATYPE(QModelIndex)
Internal ID used by QGIS in the local SQLite database.
std::ostream & operator<<(std::ostream &os, const QgsCoordinateReferenceSystem &r)
Output stream operator.
QString ellipsoidAcronym() const
Returns the ellipsoid acronym for the ellipsoid used by the CRS.
CrsType
Enumeration of types of IDs accepted in createFromId() method.
DistanceUnit
Units of distance.
Unique pointer for sqlite3 databases, which automatically closes the database when the pointer goes o...
QString projectionAcronym() const
Returns the projection acronym for the projection used by the CRS.
This class represents a coordinate reference system (CRS).
QString description() const
Returns the descriptive name of the CRS, e.g., "WGS 84" or "GDA 94 / Vicgrid94".
void(* CUSTOM_CRS_VALIDATION)(QgsCoordinateReferenceSystem &)
void * OGRSpatialReferenceH
QString toProj4() const
Returns a Proj4 string representation of this CRS.