Quantum GIS API Documentation
1.7.4
|
A widget for selecting a Coordinate reference system from a tree. More...
#include <qgsprojectionselector.h>
Public Slots | |
void | setSelectedCrsName (QString theCRSName) |
QString | selectedName () |
void | setSelectedCrsId (long theCRSID) |
void | setSelectedAuthId (QString authId) |
Q_DECL_DEPRECATED void | setSelectedEpsg (long epsg) |
Get the selected coordinate system. | |
QString | selectedProj4String () |
long | selectedPostgresSrId () |
Gets the current PostGIS-style projection identifier. | |
long | selectedCrsId () |
Gets the current QGIS projection identfier. | |
void | setOgcWmsCrsFilter (QSet< QString > crsFilter) |
filters this widget by the given CRSs | |
void | on_pbnFind_clicked () |
void | on_lstRecent_currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *) |
void | on_cbxHideDeprecated_stateChanged () |
Signals | |
void | sridSelected (QString theSRID) |
void | refresh () |
Refresh any listening canvases. | |
void | searchBoxHasFocus (bool) |
Let listeners know if find has focus so they can adjust the default button. | |
Public Member Functions | |
QgsProjectionSelector (QWidget *parent, const char *name="", Qt::WFlags fl=0) | |
~QgsProjectionSelector () | |
void | loadUserCrsList (QSet< QString > *crsFilter=0) |
Populate the proj tree view with user defined projection names... | |
void | loadCrsList (QSet< QString > *crsFilter=0) |
Populate the proj tree view with system projection names... | |
const QString | sqlSafeString (const QString theSQL) |
Make the string safe for use in SQL statements. This involves escaping single quotes, double quotes, backslashes, and optionally, percentage symbols. Percentage symbols are used as wildcards sometimes and so when using the string as part of the LIKE phrase of a select statement, should be escaped. | |
Q_DECL_DEPRECATED long | selectedEpsg () |
Gets the current EpsgCrsId-style projection identifier. | |
long | selectedSrsid () |
Gets the current InternalCrsId-style projection identifier. | |
QString | selectedAuthId () |
Gets the current authority-style projection identifier. | |
Protected Member Functions | |
void | showEvent (QShowEvent *theEvent) |
Used to ensure the projection list view is actually populated. | |
void | resizeEvent (QResizeEvent *theEvent) |
Used to manage column sizes. | |
Private Slots | |
void | coordinateSystemSelected (QTreeWidgetItem *) |
private handler for when user selects a cs it will cause wktSelected and sridSelected events to be spawned | |
QStringList | authorities () |
get list of authorities | |
Private Member Functions | |
QString | ogcWmsCrsFilterAsSqlExpression (QSet< QString > *crsFilter) |
converts the CRS group to a SQL expression fragment | |
void | applySelection () |
does the legwork of applying CRS Selection | |
QString | getSelectedExpression (QString e) |
gets an arbitrary sqlite3 expression from the selection | |
void | showDBMissingWarning (const QString theFileName) |
Show the user a warning if the srs database could not be found. | |
long | getLargestCRSIDMatch (QString theSql) |
Utility method used in conjunction with name based searching tool. | |
void | insertRecent (long theCrsId) |
add recently used CRS | |
void | hideDeprecated (QTreeWidgetItem *item) |
hide deprecated CRSes | |
Private Attributes | |
QTreeWidgetItem * | mUserProjList |
User defined projections node. | |
QTreeWidgetItem * | mGeoList |
GEOGCS node. | |
QTreeWidgetItem * | mProjList |
PROJCS node. | |
QString | mCustomCsFile |
Users custom coordinate system file. | |
QString | mSrsDatabaseFileName |
File name of the sqlite3 database. | |
bool | mProjListDone |
Has the Projection List been populated? | |
bool | mUserProjListDone |
Has the User Projection List been populated? | |
bool | mRecentProjListDone |
Has the Recent Projection List been populated? | |
bool | mCRSNameSelectionPending |
Is there a pending selection to be made by CRS Name? | |
bool | mCRSIDSelectionPending |
Is there a pending selection to be made by CRS ID? | |
bool | mAuthIDSelectionPending |
Is there a pending selection to be made by Authority ID? | |
QString | mCRSNameSelection |
The CRS Name that wants to be selected on this widget. | |
long | mCRSIDSelection |
The CRS ID that wants to be selected on this widget. | |
QString | mAuthIDSelection |
The Authority ID that wants to be selected on this widget. | |
QSet< QString > | mCrsFilter |
The set of OGC WMS CRSs that want to be applied to this widget. | |
QStringList | mRecentProjections |
Most recently used projections (trimmed at 25 entries) |
A widget for selecting a Coordinate reference system from a tree.
Definition at line 28 of file qgsprojectionselector.h.
QgsProjectionSelector::QgsProjectionSelector | ( | QWidget * | parent, |
const char * | name = "" , |
||
Qt::WFlags | fl = 0 |
||
) |
Definition at line 37 of file qgsprojectionselector.cpp.
References AUTHID_COLUMN, authorities(), coordinateSystemSelected(), QgsCoordinateReferenceSystem::createFromOgcWmsCrs(), QgsCoordinateReferenceSystem::createFromProj4(), QgsCoordinateReferenceSystem::isValid(), mRecentProjections, mSrsDatabaseFileName, QGIS_CRS_ID_COLUMN, QgsDebugMsg, QgsApplication::srsDbFilePath(), and QgsCoordinateReferenceSystem::srsid().
Definition at line 98 of file qgsprojectionselector.cpp.
References QgsCoordinateReferenceSystem::InternalCrsId, mRecentProjections, selectedCrsId(), and QgsCoordinateReferenceSystem::toProj4().
void QgsProjectionSelector::applySelection | ( | ) | [private] |
does the legwork of applying CRS Selection
Definition at line 291 of file qgsprojectionselector.cpp.
References AUTHID_COLUMN, mAuthIDSelection, mAuthIDSelectionPending, mCRSIDSelection, mCRSIDSelectionPending, mCRSNameSelection, mCRSNameSelectionPending, mProjListDone, mUserProjListDone, QGIS_CRS_ID_COLUMN, and QgsDebugMsg.
Referenced by setSelectedCrsId(), setSelectedCrsName(), and showEvent().
QStringList QgsProjectionSelector::authorities | ( | ) | [private, slot] |
get list of authorities
Definition at line 1063 of file qgsprojectionselector.cpp.
References mSrsDatabaseFileName, and QgsDebugMsg.
Referenced by QgsProjectionSelector().
void QgsProjectionSelector::coordinateSystemSelected | ( | QTreeWidgetItem * | theItem | ) | [private, slot] |
private handler for when user selects a cs it will cause wktSelected and sridSelected events to be spawned
Definition at line 817 of file qgsprojectionselector.cpp.
References selectedCrsId(), selectedProj4String(), and sridSelected().
Referenced by QgsProjectionSelector().
long QgsProjectionSelector::getLargestCRSIDMatch | ( | QString | theSql | ) | [private] |
Utility method used in conjunction with name based searching tool.
Definition at line 986 of file qgsprojectionselector.cpp.
References mSrsDatabaseFileName, QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, and showDBMissingWarning().
Referenced by on_pbnFind_clicked().
QString QgsProjectionSelector::getSelectedExpression | ( | QString | e | ) | [private] |
gets an arbitrary sqlite3 expression from the selection
e | The sqlite3 expression (typically "srid" or "sridid") |
Definition at line 458 of file qgsprojectionselector.cpp.
References mSrsDatabaseFileName, QGIS_CRS_ID_COLUMN, QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, showDBMissingWarning(), and USER_CRS_START_ID.
Referenced by selectedAuthId(), selectedEpsg(), and selectedPostgresSrId().
void QgsProjectionSelector::hideDeprecated | ( | QTreeWidgetItem * | item | ) | [private] |
hide deprecated CRSes
Definition at line 841 of file qgsprojectionselector.cpp.
Referenced by on_cbxHideDeprecated_stateChanged().
void QgsProjectionSelector::insertRecent | ( | long | theCrsId | ) | [private] |
add recently used CRS
Definition at line 336 of file qgsprojectionselector.cpp.
References AUTHID_COLUMN, mProjListDone, mUserProjListDone, NAME_COLUMN, and QGIS_CRS_ID_COLUMN.
Referenced by showEvent().
void QgsProjectionSelector::loadCrsList | ( | QSet< QString > * | crsFilter = 0 | ) |
Populate the proj tree view with system projection names...
crsFilter | a list of OGC Coordinate Reference Systems to filter the list of projections by. This is useful in (e.g.) WMS situations where you just want to offer what the WMS server can support. |
Definition at line 666 of file qgsprojectionselector.cpp.
References QgsApplication::activeThemePath(), AUTHID_COLUMN, mGeoList, mProjList, mProjListDone, mSrsDatabaseFileName, ogcWmsCrsFilterAsSqlExpression(), QGIS_CRS_ID_COLUMN, and showDBMissingWarning().
Referenced by showEvent().
void QgsProjectionSelector::loadUserCrsList | ( | QSet< QString > * | crsFilter = 0 | ) |
Populate the proj tree view with user defined projection names...
crsFilter | a list of OGC Coordinate Reference Systems to filter the list of projections by. This is useful in (e.g.) WMS situations where you just want to offer what the WMS server can support. |
Definition at line 591 of file qgsprojectionselector.cpp.
References QgsApplication::activeThemePath(), mUserProjList, mUserProjListDone, ogcWmsCrsFilterAsSqlExpression(), QGIS_CRS_ID_COLUMN, QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, and showDBMissingWarning().
Referenced by showEvent().
QString QgsProjectionSelector::ogcWmsCrsFilterAsSqlExpression | ( | QSet< QString > * | crsFilter | ) | [private] |
converts the CRS group to a SQL expression fragment
Converts the given Coordinate Reference Systems to a format suitable for use in SQL for querying against the QGIS CRS database.
crsFilter | a list of OGC Coordinate Reference Systems to filter the list of projections by. This is useful in (e.g.) WMS situations where you just want to offer what the WMS server can support. |
Definition at line 184 of file qgsprojectionselector.cpp.
References QgsDebugMsg.
Referenced by loadCrsList(), and loadUserCrsList().
void QgsProjectionSelector::on_cbxHideDeprecated_stateChanged | ( | ) | [slot] |
Definition at line 857 of file qgsprojectionselector.cpp.
References hideDeprecated().
void QgsProjectionSelector::on_lstRecent_currentItemChanged | ( | QTreeWidgetItem * | current, |
QTreeWidgetItem * | previous | ||
) | [slot] |
Definition at line 863 of file qgsprojectionselector.cpp.
References QGIS_CRS_ID_COLUMN, and setSelectedCrsId().
void QgsProjectionSelector::on_pbnFind_clicked | ( | ) | [slot] |
Definition at line 870 of file qgsprojectionselector.cpp.
References getLargestCRSIDMatch(), mSrsDatabaseFileName, QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, selectedCrsId(), setSelectedCrsId(), showDBMissingWarning(), and sqlSafeString().
void QgsProjectionSelector::refresh | ( | ) | [signal] |
Refresh any listening canvases.
void QgsProjectionSelector::resizeEvent | ( | QResizeEvent * | theEvent | ) | [protected] |
Used to manage column sizes.
Definition at line 140 of file qgsprojectionselector.cpp.
References AUTHID_COLUMN, NAME_COLUMN, and QGIS_CRS_ID_COLUMN.
void QgsProjectionSelector::searchBoxHasFocus | ( | bool | ) | [signal] |
Let listeners know if find has focus so they can adjust the default button.
QString QgsProjectionSelector::selectedAuthId | ( | ) |
Gets the current authority-style projection identifier.
Definition at line 557 of file qgsprojectionselector.cpp.
References getSelectedExpression(), and USER_CRS_START_ID.
long QgsProjectionSelector::selectedCrsId | ( | ) | [slot] |
Gets the current QGIS projection identfier.
Definition at line 567 of file qgsprojectionselector.cpp.
References QGIS_CRS_ID_COLUMN.
Referenced by coordinateSystemSelected(), on_pbnFind_clicked(), and ~QgsProjectionSelector().
long QgsProjectionSelector::selectedEpsg | ( | ) |
Gets the current EpsgCrsId-style projection identifier.
Definition at line 538 of file qgsprojectionselector.cpp.
References getSelectedExpression(), and QgsDebugMsg.
QString QgsProjectionSelector::selectedName | ( | ) | [slot] |
Definition at line 353 of file qgsprojectionselector.cpp.
long QgsProjectionSelector::selectedPostgresSrId | ( | ) | [slot] |
Gets the current PostGIS-style projection identifier.
Definition at line 551 of file qgsprojectionselector.cpp.
References getSelectedExpression().
QString QgsProjectionSelector::selectedProj4String | ( | ) | [slot] |
Definition at line 367 of file qgsprojectionselector.cpp.
References mSrsDatabaseFileName, QGIS_CRS_ID_COLUMN, QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, showDBMissingWarning(), and USER_CRS_START_ID.
Referenced by coordinateSystemSelected().
long QgsProjectionSelector::selectedSrsid | ( | ) |
Gets the current InternalCrsId-style projection identifier.
void QgsProjectionSelector::setOgcWmsCrsFilter | ( | QSet< QString > | crsFilter | ) | [slot] |
filters this widget by the given CRSs
Sets this widget to filter the available projections to those listed by the given Coordinate Reference Systems.
crsFilter | a list of OGC Coordinate Reference Systems to filter the list of projections by. This is useful in (e.g.) WMS situations where you just want to offer what the WMS server can support. |
Definition at line 582 of file qgsprojectionselector.cpp.
References mCrsFilter, mProjListDone, and mUserProjListDone.
void QgsProjectionSelector::setSelectedAuthId | ( | QString | authId | ) | [slot] |
Definition at line 283 of file qgsprojectionselector.cpp.
References mAuthIDSelection, mAuthIDSelectionPending, mCRSIDSelectionPending, and mCRSNameSelectionPending.
Referenced by setSelectedEpsg().
void QgsProjectionSelector::setSelectedCrsId | ( | long | theCRSID | ) | [slot] |
Definition at line 262 of file qgsprojectionselector.cpp.
References applySelection(), mAuthIDSelectionPending, mCRSIDSelection, mCRSIDSelectionPending, and mCRSNameSelectionPending.
Referenced by on_lstRecent_currentItemChanged(), and on_pbnFind_clicked().
void QgsProjectionSelector::setSelectedCrsName | ( | QString | theCRSName | ) | [slot] |
Definition at line 245 of file qgsprojectionselector.cpp.
References applySelection(), mAuthIDSelectionPending, mCRSIDSelectionPending, mCRSNameSelection, and mCRSNameSelectionPending.
void QgsProjectionSelector::setSelectedEpsg | ( | long | epsg | ) | [slot] |
Get the selected coordinate system.
Definition at line 278 of file qgsprojectionselector.cpp.
References setSelectedAuthId().
void QgsProjectionSelector::showDBMissingWarning | ( | const QString | theFileName | ) | [private] |
Show the user a warning if the srs database could not be found.
Definition at line 1117 of file qgsprojectionselector.cpp.
Referenced by getLargestCRSIDMatch(), getSelectedExpression(), loadCrsList(), loadUserCrsList(), on_pbnFind_clicked(), and selectedProj4String().
void QgsProjectionSelector::showEvent | ( | QShowEvent * | theEvent | ) | [protected] |
Used to ensure the projection list view is actually populated.
Definition at line 151 of file qgsprojectionselector.cpp.
References applySelection(), insertRecent(), loadCrsList(), loadUserCrsList(), mAuthIDSelectionPending, mCrsFilter, mCRSIDSelectionPending, mCRSNameSelectionPending, mProjListDone, mRecentProjections, mRecentProjListDone, and mUserProjListDone.
const QString QgsProjectionSelector::sqlSafeString | ( | const QString | theSQL | ) |
Make the string safe for use in SQL statements. This involves escaping single quotes, double quotes, backslashes, and optionally, percentage symbols. Percentage symbols are used as wildcards sometimes and so when using the string as part of the LIKE phrase of a select statement, should be escaped.
Definition at line 1107 of file qgsprojectionselector.cpp.
Referenced by on_pbnFind_clicked().
void QgsProjectionSelector::sridSelected | ( | QString | theSRID | ) | [signal] |
Referenced by coordinateSystemSelected().
QString QgsProjectionSelector::mAuthIDSelection [private] |
The Authority ID that wants to be selected on this widget.
Definition at line 209 of file qgsprojectionselector.h.
Referenced by applySelection(), and setSelectedAuthId().
bool QgsProjectionSelector::mAuthIDSelectionPending [private] |
Is there a pending selection to be made by Authority ID?
Definition at line 200 of file qgsprojectionselector.h.
Referenced by applySelection(), setSelectedAuthId(), setSelectedCrsId(), setSelectedCrsName(), and showEvent().
QSet<QString> QgsProjectionSelector::mCrsFilter [private] |
The set of OGC WMS CRSs that want to be applied to this widget.
Definition at line 212 of file qgsprojectionselector.h.
Referenced by setOgcWmsCrsFilter(), and showEvent().
long QgsProjectionSelector::mCRSIDSelection [private] |
The CRS ID that wants to be selected on this widget.
Definition at line 206 of file qgsprojectionselector.h.
Referenced by applySelection(), and setSelectedCrsId().
bool QgsProjectionSelector::mCRSIDSelectionPending [private] |
Is there a pending selection to be made by CRS ID?
Definition at line 197 of file qgsprojectionselector.h.
Referenced by applySelection(), setSelectedAuthId(), setSelectedCrsId(), setSelectedCrsName(), and showEvent().
QString QgsProjectionSelector::mCRSNameSelection [private] |
The CRS Name that wants to be selected on this widget.
Definition at line 203 of file qgsprojectionselector.h.
Referenced by applySelection(), and setSelectedCrsName().
bool QgsProjectionSelector::mCRSNameSelectionPending [private] |
Is there a pending selection to be made by CRS Name?
Definition at line 194 of file qgsprojectionselector.h.
Referenced by applySelection(), setSelectedAuthId(), setSelectedCrsId(), setSelectedCrsName(), and showEvent().
QString QgsProjectionSelector::mCustomCsFile [private] |
Users custom coordinate system file.
Definition at line 172 of file qgsprojectionselector.h.
QTreeWidgetItem* QgsProjectionSelector::mGeoList [private] |
QTreeWidgetItem* QgsProjectionSelector::mProjList [private] |
bool QgsProjectionSelector::mProjListDone [private] |
Has the Projection List been populated?
Definition at line 185 of file qgsprojectionselector.h.
Referenced by applySelection(), insertRecent(), loadCrsList(), setOgcWmsCrsFilter(), and showEvent().
QStringList QgsProjectionSelector::mRecentProjections [private] |
Most recently used projections (trimmed at 25 entries)
Definition at line 215 of file qgsprojectionselector.h.
Referenced by QgsProjectionSelector(), showEvent(), and ~QgsProjectionSelector().
bool QgsProjectionSelector::mRecentProjListDone [private] |
Has the Recent Projection List been populated?
Definition at line 191 of file qgsprojectionselector.h.
Referenced by showEvent().
QString QgsProjectionSelector::mSrsDatabaseFileName [private] |
File name of the sqlite3 database.
Definition at line 174 of file qgsprojectionselector.h.
Referenced by authorities(), getLargestCRSIDMatch(), getSelectedExpression(), loadCrsList(), on_pbnFind_clicked(), QgsProjectionSelector(), and selectedProj4String().
QTreeWidgetItem* QgsProjectionSelector::mUserProjList [private] |
User defined projections node.
Definition at line 165 of file qgsprojectionselector.h.
Referenced by loadUserCrsList().
bool QgsProjectionSelector::mUserProjListDone [private] |
Has the User Projection List been populated?
Definition at line 188 of file qgsprojectionselector.h.
Referenced by applySelection(), insertRecent(), loadUserCrsList(), setOgcWmsCrsFilter(), and showEvent().