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(
const long id,
CrsType type = PostgisCrsId );
323 bool createFromOgcWmsCrs(
const QString &crs );
330 bool createFromSrid(
const long srid );
345 bool createFromWkt(
const QString &wkt );
357 bool createFromSrsId(
const 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();
640 static void invalidateCache();
652 static QString proj4FromSrsId(
const int srsId );
658 void setInternalId(
long srsId );
664 void setSrid(
long srid );
670 void setDescription(
const QString &description );
683 void setProj4String(
const QString &proj4String );
689 void setGeographicFlag(
bool geoFlag );
695 void setEpsg(
long epsg );
701 void setAuthId(
const QString &theID );
707 void setProjectionAcronym(
const QString &projectionAcronym );
713 void setEllipsoidAcronym(
const QString &ellipsoidAcronym );
721 typedef QMap<QString, QString> RecordMap;
730 RecordMap getRecord(
const QString &sql );
742 long getRecordCount();
745 static QString quotedValue( QString value );
751 bool loadFromDatabase(
const QString &db,
const QString &expression,
const QString &value );
753 static bool loadIds( QHash<int, QString> &wkts );
754 static bool loadWkts( QHash<int, QString> &wkts,
const char *filename );
756 static bool syncDatumTransform(
const QString &dbPath );
758 QExplicitlySharedDataPointer<QgsCoordinateReferenceSystemPrivate> d;
766 static QReadWriteLock sSrIdCacheLock;
767 static QHash< long, QgsCoordinateReferenceSystem > sSrIdCache;
768 static QReadWriteLock sOgcLock;
769 static QHash< QString, QgsCoordinateReferenceSystem > sOgcCache;
770 static QReadWriteLock sProj4CacheLock;
771 static QHash< QString, QgsCoordinateReferenceSystem > sProj4Cache;
772 static QReadWriteLock sCRSWktLock;
773 static QHash< QString, QgsCoordinateReferenceSystem > sWktCache;
774 static QReadWriteLock sCRSSrsIdLock;
775 static QHash< long, QgsCoordinateReferenceSystem > sSrsIdCache;
776 static QReadWriteLock sCrsStringLock;
777 static QHash< QString, QgsCoordinateReferenceSystem > sStringCache;
779 friend class TestQgsCoordinateReferenceSystem;
788 QString mySummary( QStringLiteral(
"\n\tSpatial Reference System:" ) );
789 mySummary += QLatin1String(
"\n\t\tDescription : " );
796 mySummary += QLatin1String(
"Undefined" );
798 mySummary += QLatin1String(
"\n\t\tProjection : " );
805 mySummary += QLatin1String(
"Undefined" );
808 mySummary += QLatin1String(
"\n\t\tEllipsoid : " );
815 mySummary += QLatin1String(
"Undefined" );
818 mySummary += QLatin1String(
"\n\t\tProj4String : " );
825 mySummary += QLatin1String(
"Undefined" );
828 return os << mySummary.toLocal8Bit().data() << std::endl;
832 #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.
Q_DECLARE_METATYPE(QModelIndex)
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".
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