QgsCoordinateReferenceSystem Class Reference
[Core]

#include <qgscoordinatereferencesystem.h>

List of all members.


Detailed Description

Class for storing a coordinate reference system (CRS).

Definition at line 43 of file qgscoordinatereferencesystem.h.

Public Types

enum  CrsType { InternalCrsId, PostgisCrsId, EpsgCrsId }

Public Member Functions

 QgsCoordinateReferenceSystem ()
 Default constructor.
 ~QgsCoordinateReferenceSystem ()
 QgsCoordinateReferenceSystem (QString theWkt)
 QgsCoordinateReferenceSystem (const long theId, CrsType theType=PostgisCrsId)
 QgsCoordinateReferenceSystem (const QgsCoordinateReferenceSystem &srs)
 copy constructor
QgsCoordinateReferenceSystemoperator= (const QgsCoordinateReferenceSystem &srs)
 Assignment operator.
void createFromId (const long theId, CrsType theType=PostgisCrsId)
bool createFromOgcWmsCrs (QString theCrs)
 Set up this CRS from the given OGC CRS.
bool createFromSrid (const long theSrid)
bool createFromWkt (const QString theWkt)
bool createFromEpsg (const long theEpsg)
bool createFromSrsId (const long theSrsId)
bool createFromProj4 (const QString theProjString)
bool isValid () const
void validate ()
long findMatchingProj ()
bool operator== (const QgsCoordinateReferenceSystem &theSrs)
bool operator!= (const QgsCoordinateReferenceSystem &theSrs)
bool equals (QString theProj4String)
bool readXML (QDomNode &theNode)
bool writeXML (QDomNode &theNode, QDomDocument &theDoc) const
long srsid () const
long postgisSrid () const
long epsg () const
QString description () const
QString projectionAcronym () const
QString ellipsoidAcronym () const
QString toWkt () const
QString toProj4 () const
 Get the Proj Proj4 string representation of this srs.
bool geographicFlag () const
QGis::UnitType mapUnits () const
void setValidationHint (QString html)
QString validationHint ()

Static Public Member Functions

static void setCustomSrsValidation (CUSTOM_CRS_VALIDATION f)
 Sets custom function to force valid CRS QGIS uses implementation in QgisGui::customSrsValidation.
static CUSTOM_CRS_VALIDATION customSrsValidation ()
 Gets custom function.

Private Types

typedef QMap< QString, QString > RecordMap

Private Member Functions

void setInternalId (long theSrsId)
void setSrid (long theSrid)
void setDescription (QString theDescription)
void setProj4String (QString theProj4String)
void setGeographicFlag (bool theGeoFlag)
void setEpsg (long theEpsg)
void setProjectionAcronym (QString theProjectionAcronym)
void setEllipsoidAcronym (QString theEllipsoidAcronym)
void debugPrint ()
RecordMap getRecord (QString theSql)
void setMapUnits ()
 Work out the projection units and set the appropriate local variable.
bool loadFromDb (QString db, QString field, long id)

Static Private Member Functions

static QString proj4FromSrsId (const int theSrsId)
 A static helper function to find out the proj4 string for a srsid.
static int openDb (QString path, sqlite3 **db)

Private Attributes

long mSrsId
 The internal sqlite3 srs.db primary key for this srs.
QString mDescription
 A textual description of the srs.
QString mProjectionAcronym
 The official proj4 acronym for the projection family.
QString mEllipsoidAcronym
 The official proj4 acronym for the ellipoid.
bool mGeoFlag
 Whether this is a geographic or projected coordinate system.
QGis::UnitType mMapUnits
 The map units.
long mSRID
 If available, the Postgis spatial_ref_sys identifier for this srs (defaults to 0).
long mEpsg
 If available the ESPG identifier for this srs (defaults to 0).
bool mIsValidFlag
 Wehter this srs is properly defined and valid.
void * mCRS
QString mValidationHint

Static Private Attributes

static CUSTOM_CRS_VALIDATION mCustomSrsValidation


Member Typedef Documentation

typedef QMap<QString, QString> QgsCoordinateReferenceSystem::RecordMap [private]

A string based associative array used for passing records around

Definition at line 355 of file qgscoordinatereferencesystem.h.


Member Enumeration Documentation

enum QgsCoordinateReferenceSystem::CrsType

Enumerator:
InternalCrsId 
PostgisCrsId 
EpsgCrsId 

Definition at line 47 of file qgscoordinatereferencesystem.h.


Constructor & Destructor Documentation

QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem (  ) 

Default constructor.

Definition at line 46 of file qgscoordinatereferencesystem.cpp.

References mCRS.

QgsCoordinateReferenceSystem::~QgsCoordinateReferenceSystem (  ) 

Definition at line 73 of file qgscoordinatereferencesystem.cpp.

References mCRS.

QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem ( QString  theWkt  )  [explicit]

Constructs a CRS object from a Wkt string

Parameters:
theWkt A String containing a valid Wkt def

Definition at line 54 of file qgscoordinatereferencesystem.cpp.

References createFromWkt(), and mCRS.

QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem ( const long  theId,
CrsType  theType = PostgisCrsId 
)

Use this constructor when you want to create a CRS object using a postgis SRID, an EpsgCrsId id or a QGIS CRS_ID.

Note:
We encourage you to use EpsgCrsId, Wkt or Proj4 to describe CRS's in your code wherever possible. QGSI CRS_IDs are not guaranteed to be permanent / involatile.
Parameters:
theId The ID no valid for the chosen coordinate system id type
theType One of the types described in QgsCoordinateReferenceSystem::CrsType

Definition at line 64 of file qgscoordinatereferencesystem.cpp.

References createFromId(), and mCRS.

QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem ( const QgsCoordinateReferenceSystem srs  ) 

copy constructor

Definition at line 124 of file qgscoordinatereferencesystem.cpp.

References mCRS.


Member Function Documentation

QgsCoordinateReferenceSystem & QgsCoordinateReferenceSystem::operator= ( const QgsCoordinateReferenceSystem srs  ) 

Assignment operator.

Definition at line 131 of file qgscoordinatereferencesystem.cpp.

References mCRS, mDescription, mEllipsoidAcronym, mEpsg, mGeoFlag, mIsValidFlag, mMapUnits, mProjectionAcronym, mSRID, mSrsId, and mValidationHint.

void QgsCoordinateReferenceSystem::createFromId ( const long  theId,
CrsType  theType = PostgisCrsId 
)

Definition at line 78 of file qgscoordinatereferencesystem.cpp.

References createFromEpsg(), createFromSrid(), createFromSrsId(), QgsLogger::critical(), EpsgCrsId, InternalCrsId, and PostgisCrsId.

Referenced by QgsCoordinateReferenceSystem(), and QgsCoordinateTransform::QgsCoordinateTransform().

bool QgsCoordinateReferenceSystem::createFromOgcWmsCrs ( QString  theCrs  ) 

Set up this CRS from the given OGC CRS.

Sets this CRS to the given OGC WMS-format Coordinate Reference Systems.

Note:
This function only deals with EpsgCrsId labels only at this time.
Return values:
FALSE if not given an EpsgCrsId label

Todo:
  • CRS:84 is hardcoded to EPSG:4326 - see if this is appropriate

See WMS 1.3 standard appendix B3 for details

Definition at line 97 of file qgscoordinatereferencesystem.cpp.

References createFromEpsg().

Referenced by QgsRasterLayer::setDataProvider().

bool QgsCoordinateReferenceSystem::createFromSrid ( const long  theSrid  ) 

Set up this srs by fetching the appropriate information from the sqlite backend. First the system level read only srs.db will be checked and then the users ~/.qgis/qgis.db database will be checked for a match.

Note:
Any members will be overwritten during this process.
Parameters:
theSrid The postgis SRID for the desired spatial reference system.

Definition at line 171 of file qgscoordinatereferencesystem.cpp.

References loadFromDb(), and QgsApplication::srsDbFilePath().

Referenced by createFromId().

bool QgsCoordinateReferenceSystem::createFromWkt ( const QString  theWkt  ) 

Set up this srs using a Wkt spatial ref sys definition. The wkt will be converted to a proj4 string using OGR helper functions. After this the srs databasses will be searched for matches. First the system level read only srs.db will be checked and then the users ~/.qgis/qgis.db database will be checked for a match.

Note:
Any members will be overwritten during this process.

SRID and EpsgCrsId may be blank if no match can be found on srs db.

Parameters:
theWkt The Wkt for the desired spatial reference system.
Returns:
bool TRUE if sucess else false

Definition at line 248 of file qgscoordinatereferencesystem.cpp.

References createFromProj4(), QgsLogger::critical(), mCRS, mIsValidFlag, and QgsDebugMsg.

Referenced by QgsRasterLayer::projectionWkt(), QgsCoordinateReferenceSystem(), QgsCoordinateTransform::QgsCoordinateTransform(), and QgsRasterLayer::readFile().

bool QgsCoordinateReferenceSystem::createFromEpsg ( const long  theEpsg  ) 

Set up this srs by fetching the appropriate information from the sqlite backend. First the system level read only srs.db will be checked and then the users ~/.qgis/qgis.db database will be checked for a match.

Note:
Any members will be overwritten during this process.
Parameters:
theEpsg The EpsgCrsId for the desired spatial reference system.
Returns:
bool TRUE if sucess else false

Definition at line 176 of file qgscoordinatereferencesystem.cpp.

References loadFromDb(), and QgsApplication::srsDbFilePath().

Referenced by createFromId(), createFromOgcWmsCrs(), readXML(), and QgsDistanceArea::setSourceEpsgCrsId().

bool QgsCoordinateReferenceSystem::createFromSrsId ( const long  theSrsId  ) 

Set up this srs by fetching the appropriate information from the sqlite backend. If the srsid is < 100000, only the system srs.db will be checked. If the srsid > 100000 the srs will be retrieved from the ~/.qgis/qgis.db

Note:
Any members will be overwritten during this process.
Parameters:
theSrsId The QGIS SrsId for the desired spatial reference system.
Returns:
bool TRUE if sucess else false

Definition at line 181 of file qgscoordinatereferencesystem.cpp.

References loadFromDb(), QgsApplication::qgisUserDbFilePath(), and QgsApplication::srsDbFilePath().

Referenced by createFromId(), createFromProj4(), QgsCoordinateTransform::setDestCRSID(), and QgsDistanceArea::setSourceCrs().

bool QgsCoordinateReferenceSystem::createFromProj4 ( const QString  theProjString  ) 

Set up this srs by passing it a proj4 style formatted string. The string will be parsed and the projection and ellipsoid members set and the remainder of the proj4 string will be stored in the parameters member. The reason for this is so that we can easily present the user with 'natural language' representation of the projection and ellipsoid by looking them up in the srs.bs sqlite database. Also having the ellpse and proj elements stripped out is hepful to speed up globbing queries (see below).

We try to match the proj string to and srsid using the following logic:

Note:
If the srs was not matched, we will create a new entry on the users tbl_srs for this srs.
Parameters:
theProjString A proj4 format string
Returns:
bool TRUE if sucess else false

Definition at line 296 of file qgscoordinatereferencesystem.cpp.

References createFromSrsId(), ELLPS_PREFIX_LEN, findMatchingProj(), getRecord(), LAT_PREFIX_LEN, mDescription, mEllipsoidAcronym, mIsValidFlag, mProjectionAcronym, PROJ_PREFIX_LEN, QgsDebugMsg, setProj4String(), and QgsLogger::warning().

Referenced by createFromWkt(), QgsCoordinateTransform::initialise(), QgsDistanceArea::setEllipsoid(), and validate().

bool QgsCoordinateReferenceSystem::isValid (  )  const

Find out whether this CRS is correctly initialised and useable

Definition at line 291 of file qgscoordinatereferencesystem.cpp.

References mIsValidFlag.

Referenced by QgsCoordinateTransform::initialise(), QgsRasterLayer::projectionWkt(), QgsRasterLayer::readFile(), QgsVectorLayer::setCoordinateSystem(), QgsCoordinateTransform::transformCoords(), and QgsVectorFileWriter::writeAsShapefile().

void QgsCoordinateReferenceSystem::validate (  ) 

Perform some validation on this CRS. If the sts doesn't validate the default behaviour settings for layers with unknown CRS will be consulted and acted on accordingly. By hell or high water this method will do its best to make sure that this CRS is valid - even if that involves resorting to a hard coded default of geocs:wgs84.

Note:
It is not usually neccessary to use this function, unless you are trying to force this srs to be valid.

Definition at line 157 of file qgscoordinatereferencesystem.cpp.

References createFromProj4(), GEOPROJ4, mCustomSrsValidation, and mIsValidFlag.

Referenced by QgsRasterLayer::readFile(), QgsMapLayer::readXML(), and QgsVectorLayer::setCoordinateSystem().

long QgsCoordinateReferenceSystem::findMatchingProj (  ) 

This is a globbing function to try to find a record in the database that matches a CRS defined only by a proj4string. The goal is to learn what the tbl_srs.srs_id value is for the CRS. Internally the source CRS is converted to and OGR srs object using the proj4string and then every record in the database that matches projection and ellipsoid will be converted to an OGR srs in turn and compared to the source CRS. There are some gotchas with using ogr isSame() srs comparison, but its more effective than using straight string comparison of proj4params.

Note:
The ellipsoid and projection acronyms must be set as well as the proj4string!
Returns:
lomg the SrsId of the matched CRS

Definition at line 732 of file qgscoordinatereferencesystem.cpp.

References equals(), mEllipsoidAcronym, mIsValidFlag, mProjectionAcronym, openDb(), QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, QgsApplication::srsDbFilePath(), and QgsLogger::warning().

Referenced by createFromProj4().

bool QgsCoordinateReferenceSystem::operator== ( const QgsCoordinateReferenceSystem theSrs  ) 

Overloaded == operator used to compare to CRS's. Internally it will delegate to the equals method described below

Definition at line 830 of file qgscoordinatereferencesystem.cpp.

References mCRS, and mIsValidFlag.

bool QgsCoordinateReferenceSystem::operator!= ( const QgsCoordinateReferenceSystem theSrs  ) 

Overloaded != operator used to compare to CRS's. Returns opposite bool value to operator ==

Definition at line 852 of file qgscoordinatereferencesystem.cpp.

bool QgsCoordinateReferenceSystem::equals ( QString  theProj4String  ) 

Overloaded == operator used to compare to CRS's. Internally it will use OGR isSameCRS() or isSameGeoCRS() methods as appropriate. Additionally logic may also be applied if the result from the OGR methods is inconclusive.

Definition at line 857 of file qgscoordinatereferencesystem.cpp.

References setProj4String().

Referenced by findMatchingProj().

bool QgsCoordinateReferenceSystem::readXML ( QDomNode &  theNode  ) 

Restores state from the given Dom node.

Parameters:
theNode The node from which state will be restored
Returns:
bool True on success, False on failure

Definition at line 877 of file qgscoordinatereferencesystem.cpp.

References createFromEpsg(), GEO_EPSG_CRS_ID, mIsValidFlag, QgsDebugMsg, setDescription(), setEllipsoidAcronym(), setEpsg(), setGeographicFlag(), setInternalId(), setMapUnits(), setProj4String(), setProjectionAcronym(), and setSrid().

Referenced by QgsMapLayer::readXML(), and QgsCoordinateTransform::readXML().

bool QgsCoordinateReferenceSystem::writeXML ( QDomNode &  theNode,
QDomDocument &  theDoc 
) const

Stores state to the given Dom node in the given document. Below is an example of the generated tag. <spatialrefsys> <proj4>+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs </proj4> <srsid>2585</srsid> <srid>4326</srid> <epsg>4326</epsg> WGS 84 <projectionacronym>longlat</projectionacronym> <ellipsoidacronym>WGS84</ellipsoidacronym> </spatialrefsys>

Parameters:
theNode The node in which state will be restored
theDom The document in which state will be stored
Returns:
bool True on success, False on failure

Definition at line 937 of file qgscoordinatereferencesystem.cpp.

References description(), ellipsoidAcronym(), epsg(), geographicFlag(), postgisSrid(), projectionAcronym(), srsid(), and toProj4().

Referenced by QgsMapRenderer::writeXML(), QgsMapLayer::writeXML(), and QgsCoordinateTransform::writeXML().

void QgsCoordinateReferenceSystem::setCustomSrsValidation ( CUSTOM_CRS_VALIDATION  f  )  [static]

Sets custom function to force valid CRS QGIS uses implementation in QgisGui::customSrsValidation.

Definition at line 1079 of file qgscoordinatereferencesystem.cpp.

References mCustomSrsValidation.

Referenced by QgsMapLayer::readXML().

CUSTOM_CRS_VALIDATION QgsCoordinateReferenceSystem::customSrsValidation (  )  [static]

Gets custom function.

Definition at line 1084 of file qgscoordinatereferencesystem.cpp.

References mCustomSrsValidation.

Referenced by QgsMapLayer::readXML().

long QgsCoordinateReferenceSystem::srsid (  )  const

Get the SrsId - if possible

Returns:
long theSrsId The internal sqlite3 srs.db primary key for this srs

Definition at line 543 of file qgscoordinatereferencesystem.cpp.

References mSrsId.

Referenced by QgsMapRenderer::destinationSrs(), QgsMapRenderer::setDestinationSrs(), and writeXML().

long QgsCoordinateReferenceSystem::postgisSrid (  )  const

Get the postgis srid for this srs

Returns:
long theSRID the Postgis spatial_ref_sys identifier for this srs (defaults to 0)

Definition at line 548 of file qgscoordinatereferencesystem.cpp.

References mSRID.

Referenced by writeXML().

long QgsCoordinateReferenceSystem::epsg (  )  const

Get the EpsgCrsId identifier for this srs

Returns:
long theEpsg the ESPG identifier for this srs (defaults to 0)

Definition at line 555 of file qgscoordinatereferencesystem.cpp.

References mEpsg.

Referenced by writeXML().

QString QgsCoordinateReferenceSystem::description (  )  const

Get the Description

Returns:
QString the Description A textual description of the srs.
Note:
A zero length string will be returned if the description is uninitialised

Definition at line 560 of file qgscoordinatereferencesystem.cpp.

References mDescription.

Referenced by operator<<(), and writeXML().

QString QgsCoordinateReferenceSystem::projectionAcronym (  )  const

Get the Projection Acronym

Returns:
QString theProjectionAcronym The official proj4 acronym for the projection family
Note:
A zero length string will be returned if the projectionAcronym is uninitialised

Definition at line 572 of file qgscoordinatereferencesystem.cpp.

References mProjectionAcronym.

Referenced by operator<<(), and writeXML().

QString QgsCoordinateReferenceSystem::ellipsoidAcronym (  )  const

Get the Ellipsoid Acronym

Returns:
QString theEllipsoidAcronym The official proj4 acronym for the ellipoid
Note:
A zero length string will be returned if the ellipsoidAcronym is uninitialised

Definition at line 584 of file qgscoordinatereferencesystem.cpp.

References mEllipsoidAcronym.

Referenced by operator<<(), and writeXML().

QString QgsCoordinateReferenceSystem::toWkt (  )  const

A helper to get an wkt representation of this srs

Returns:
string containing Wkt of the srs

Definition at line 864 of file qgscoordinatereferencesystem.cpp.

References mCRS.

Referenced by QgsVectorFileWriter::QgsVectorFileWriter().

QString QgsCoordinateReferenceSystem::toProj4 (  )  const

Get the Proj Proj4 string representation of this srs.

If proj and ellps keys are found in the parameters, they will be stripped out and the Projection and ellipsoid acronyms will be overridden with these.

Returns:
QString theProj4String Proj4 format specifies that define this srs.
Note:
A zero length string will be returned if the toProj4 is uninitialised

Definition at line 596 of file qgscoordinatereferencesystem.cpp.

References mCRS, and mIsValidFlag.

Referenced by debugPrint(), QgsMapRenderer::destinationSrs(), QgsCoordinateTransform::initialise(), loadFromDb(), QgsRasterLayer::metadata(), operator<<(), QgsMapRenderer::setDestinationSrs(), QgsCoordinateTransform::transformCoords(), and writeXML().

bool QgsCoordinateReferenceSystem::geographicFlag (  )  const

Get this Geographic? flag

Returns:
bool theGeoFlag Whether this is a geographic or projected coordinate system

Definition at line 610 of file qgscoordinatereferencesystem.cpp.

References mGeoFlag.

Referenced by writeXML().

QGis::UnitType QgsCoordinateReferenceSystem::mapUnits (  )  const

Get the units that the projection is in

Returns:
QGis::UnitType that gives the units for the coordinate system

Definition at line 615 of file qgscoordinatereferencesystem.cpp.

References mMapUnits.

Referenced by QgsVectorLayer::addTopologicalPoints(), and debugPrint().

void QgsCoordinateReferenceSystem::setValidationHint ( QString  html  ) 

Set user hint for validation

Definition at line 1110 of file qgscoordinatereferencesystem.cpp.

References mValidationHint.

QString QgsCoordinateReferenceSystem::validationHint (  ) 

Get user hint for validation

Definition at line 1115 of file qgscoordinatereferencesystem.cpp.

References mValidationHint.

QString QgsCoordinateReferenceSystem::proj4FromSrsId ( const int  theSrsId  )  [static, private]

A static helper function to find out the proj4 string for a srsid.

Parameters:
int theSrsId The srsid used for the lookup
Returns:
QString The proj4 string

Definition at line 995 of file qgscoordinatereferencesystem.cpp.

References QgsLogger::critical(), openDb(), QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, QgsApplication::srsDbFilePath(), and USER_CRS_START_ID.

void QgsCoordinateReferenceSystem::setInternalId ( long  theSrsId  )  [private]

Set the QGIS SrsId

Parameters:
long theSrsId The internal sqlite3 srs.db primary key for this srs

Definition at line 624 of file qgscoordinatereferencesystem.cpp.

References mSrsId.

Referenced by readXML().

void QgsCoordinateReferenceSystem::setSrid ( long  theSrid  )  [private]

Set the postgis srid

Parameters:
long theSrsId The postgis spatial_ref_sys key for this srs

Definition at line 628 of file qgscoordinatereferencesystem.cpp.

References mSRID.

Referenced by readXML().

void QgsCoordinateReferenceSystem::setDescription ( QString  theDescription  )  [private]

Set the Description

Parameters:
QString the Description A textual description of the srs.

Definition at line 632 of file qgscoordinatereferencesystem.cpp.

References mDescription.

Referenced by readXML().

void QgsCoordinateReferenceSystem::setProj4String ( QString  theProj4String  )  [private]

Definition at line 636 of file qgscoordinatereferencesystem.cpp.

References debugPrint(), mCRS, mIsValidFlag, and setMapUnits().

Referenced by createFromProj4(), equals(), loadFromDb(), and readXML().

void QgsCoordinateReferenceSystem::setGeographicFlag ( bool  theGeoFlag  )  [private]

Set this Geographic? flag

Parameters:
bool theGeoFlag Whether this is a geographic or projected coordinate system

Definition at line 649 of file qgscoordinatereferencesystem.cpp.

References mGeoFlag.

Referenced by readXML().

void QgsCoordinateReferenceSystem::setEpsg ( long  theEpsg  )  [private]

Set the EpsgCrsId identifier for this srs

Parameters:
long theEpsg the ESPG identifier for this srs (defaults to 0)

Definition at line 653 of file qgscoordinatereferencesystem.cpp.

References mEpsg.

Referenced by readXML().

void QgsCoordinateReferenceSystem::setProjectionAcronym ( QString  theProjectionAcronym  )  [private]

Set the projection acronym

Parameters:
QString the acronym (must be a valid proj4 projection acronym)

Definition at line 657 of file qgscoordinatereferencesystem.cpp.

References mProjectionAcronym.

Referenced by readXML().

void QgsCoordinateReferenceSystem::setEllipsoidAcronym ( QString  theEllipsoidAcronym  )  [private]

Set the ellipsoid acronym

Parameters:
QString the acronym (must be a valid proj4 ellipsoid acronym)

Definition at line 661 of file qgscoordinatereferencesystem.cpp.

References mEllipsoidAcronym.

Referenced by readXML().

void QgsCoordinateReferenceSystem::debugPrint (  )  [private]

Print the description if debugging

Definition at line 1089 of file qgscoordinatereferencesystem.cpp.

References QGis::Degrees, QGis::Feet, mapUnits(), mDescription, QGis::Meters, mIsValidFlag, mSrsId, QgsDebugMsg, and toProj4().

Referenced by setProj4String().

QgsCoordinateReferenceSystem::RecordMap QgsCoordinateReferenceSystem::getRecord ( QString  theSql  )  [private]

Get a record from the srs.db or qgis.db backends, given an sql statment.

Note:
only handles queries that return a single record.

it will first try the system srs.db then the users qgis.db!

Parameters:
QString The sql query to execute
Returns:
QMap An associative array of field name <-> value pairs

Definition at line 439 of file qgscoordinatereferencesystem.cpp.

References openDb(), QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, QgsDebugMsgLevel, QgsApplication::srsDbFilePath(), and QgsLogger::warning().

Referenced by createFromProj4().

int QgsCoordinateReferenceSystem::openDb ( QString  path,
sqlite3 **  db 
) [static, private]

Definition at line 1058 of file qgscoordinatereferencesystem.cpp.

References QgsMessageOutput::createMessageOutput(), QgsLogger::critical(), QgsMessageOutput::MessageText, QgsDebugMsg, QgsMessageOutput::setMessage(), QgsMessageOutput::setTitle(), and QgsMessageOutput::showMessage().

Referenced by findMatchingProj(), getRecord(), loadFromDb(), and proj4FromSrsId().

void QgsCoordinateReferenceSystem::setMapUnits (  )  [private]

Work out the projection units and set the appropriate local variable.

Definition at line 666 of file qgscoordinatereferencesystem.cpp.

References QGis::Degrees, QGis::Feet, mCRS, QGis::Meters, mIsValidFlag, mMapUnits, QgsDebugMsg, QGis::UnknownUnit, and QgsLogger::warning().

Referenced by loadFromDb(), readXML(), and setProj4String().

bool QgsCoordinateReferenceSystem::loadFromDb ( QString  db,
QString  field,
long  id 
) [private]

Definition at line 187 of file qgscoordinatereferencesystem.cpp.

References mDescription, mEllipsoidAcronym, mEpsg, mGeoFlag, mIsValidFlag, mProjectionAcronym, mSRID, mSrsId, openDb(), QgsDebugMsg, setMapUnits(), setProj4String(), and toProj4().

Referenced by createFromEpsg(), createFromSrid(), and createFromSrsId().


Member Data Documentation

long QgsCoordinateReferenceSystem::mSrsId [private]

The internal sqlite3 srs.db primary key for this srs.

Definition at line 369 of file qgscoordinatereferencesystem.h.

Referenced by debugPrint(), loadFromDb(), operator=(), setInternalId(), and srsid().

QString QgsCoordinateReferenceSystem::mDescription [private]

A textual description of the srs.

Definition at line 371 of file qgscoordinatereferencesystem.h.

Referenced by createFromProj4(), debugPrint(), description(), loadFromDb(), operator=(), and setDescription().

QString QgsCoordinateReferenceSystem::mProjectionAcronym [private]

The official proj4 acronym for the projection family.

Definition at line 373 of file qgscoordinatereferencesystem.h.

Referenced by createFromProj4(), findMatchingProj(), loadFromDb(), operator=(), projectionAcronym(), and setProjectionAcronym().

QString QgsCoordinateReferenceSystem::mEllipsoidAcronym [private]

The official proj4 acronym for the ellipoid.

Definition at line 375 of file qgscoordinatereferencesystem.h.

Referenced by createFromProj4(), ellipsoidAcronym(), findMatchingProj(), loadFromDb(), operator=(), and setEllipsoidAcronym().

bool QgsCoordinateReferenceSystem::mGeoFlag [private]

Whether this is a geographic or projected coordinate system.

Definition at line 377 of file qgscoordinatereferencesystem.h.

Referenced by geographicFlag(), loadFromDb(), operator=(), and setGeographicFlag().

QGis::UnitType QgsCoordinateReferenceSystem::mMapUnits [private]

The map units.

Definition at line 379 of file qgscoordinatereferencesystem.h.

Referenced by mapUnits(), operator=(), and setMapUnits().

long QgsCoordinateReferenceSystem::mSRID [private]

If available, the Postgis spatial_ref_sys identifier for this srs (defaults to 0).

Definition at line 381 of file qgscoordinatereferencesystem.h.

Referenced by loadFromDb(), operator=(), postgisSrid(), and setSrid().

long QgsCoordinateReferenceSystem::mEpsg [private]

If available the ESPG identifier for this srs (defaults to 0).

Definition at line 383 of file qgscoordinatereferencesystem.h.

Referenced by epsg(), loadFromDb(), operator=(), and setEpsg().

bool QgsCoordinateReferenceSystem::mIsValidFlag [private]

Wehter this srs is properly defined and valid.

Definition at line 385 of file qgscoordinatereferencesystem.h.

Referenced by createFromProj4(), createFromWkt(), debugPrint(), findMatchingProj(), isValid(), loadFromDb(), operator=(), operator==(), readXML(), setMapUnits(), setProj4String(), toProj4(), and validate().

void* QgsCoordinateReferenceSystem::mCRS [private]

Definition at line 390 of file qgscoordinatereferencesystem.h.

Referenced by createFromWkt(), operator=(), operator==(), QgsCoordinateReferenceSystem(), setMapUnits(), setProj4String(), toProj4(), toWkt(), and ~QgsCoordinateReferenceSystem().

QString QgsCoordinateReferenceSystem::mValidationHint [private]

Definition at line 394 of file qgscoordinatereferencesystem.h.

Referenced by operator=(), setValidationHint(), and validationHint().

CUSTOM_CRS_VALIDATION QgsCoordinateReferenceSystem::mCustomSrsValidation [static, private]

Definition at line 396 of file qgscoordinatereferencesystem.h.

Referenced by customSrsValidation(), setCustomSrsValidation(), and validate().


The documentation for this class was generated from the following files:
Generated on Tue Jan 6 16:51:20 2009 for Quantum GIS API Documentation by  doxygen 1.5.1