18 #ifndef QGSCOORDINATEREFERENCESYSTEM_H 19 #define QGSCOORDINATEREFERENCESYSTEM_H 22 #include "qgis_core.h" 29 #include <QReadWriteLock> 30 #include <QExplicitlySharedDataPointer> 41 class QgsCoordinateReferenceSystemPrivate;
196 Q_PROPERTY(
bool isGeographic READ isGeographic )
249 operator QVariant()
const 251 return QVariant::fromValue( *
this );
261 static QList< long > validSrsIds();
320 bool createFromId(
long id,
CrsType type = PostgisCrsId );
334 bool createFromOgcWmsCrs(
const QString &
crs );
343 bool createFromSrid(
long srid );
358 bool createFromWkt(
const QString &wkt );
370 bool createFromSrsId(
long srsId );
395 bool createFromProj4(
const QString &projString );
411 bool createFromString(
const QString &definition );
428 bool createFromUserInput(
const QString &definition );
439 static void setupESRIWktFix();
442 bool isValid()
const;
466 long findMatchingProj();
488 bool readXml(
const QDomNode &node );
496 bool writeXml( QDomNode &node, QDomDocument &doc )
const;
525 long postgisSrid()
const;
539 QString authid()
const;
549 QString description()
const;
557 QString projectionAcronym()
const;
565 QString ellipsoidAcronym()
const;
572 QString toWkt()
const;
584 QString toProj4()
const;
590 bool isGeographic()
const;
596 bool hasAxisInverted()
const;
618 void setValidationHint(
const QString &html );
623 QString validationHint();
631 static int syncDatabase();
639 long saveAsUserCrs(
const QString &name );
642 QString geographicCrsAuthId()
const;
649 static QStringList recentProjections();
657 static void invalidateCache();
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 QReadWriteLock sOgcLock;
783 static QHash< QString, QgsCoordinateReferenceSystem > sOgcCache;
784 static QReadWriteLock sProj4CacheLock;
785 static QHash< QString, QgsCoordinateReferenceSystem > sProj4Cache;
786 static QReadWriteLock sCRSWktLock;
787 static QHash< QString, QgsCoordinateReferenceSystem > sWktCache;
788 static QReadWriteLock sCRSSrsIdLock;
789 static QHash< long, QgsCoordinateReferenceSystem > sSrsIdCache;
790 static QReadWriteLock sCrsStringLock;
791 static QHash< QString, QgsCoordinateReferenceSystem > sStringCache;
793 friend class TestQgsCoordinateReferenceSystem;
802 QString mySummary( QStringLiteral(
"\n\tSpatial Reference System:" ) );
803 mySummary += QLatin1String(
"\n\t\tDescription : " );
810 mySummary += QLatin1String(
"Undefined" );
812 mySummary += QLatin1String(
"\n\t\tProjection : " );
819 mySummary += QLatin1String(
"Undefined" );
822 mySummary += QLatin1String(
"\n\t\tEllipsoid : " );
829 mySummary += QLatin1String(
"Undefined" );
832 mySummary += QLatin1String(
"\n\t\tProj4String : " );
839 mySummary += QLatin1String(
"Undefined" );
842 return os << mySummary.toLocal8Bit().data() << std::endl;
846 #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
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