#include <qgsprojectionselector.h>
Public Slots | |
void | setSelectedCrsName (QString theCRSName) |
QString | selectedName () |
void | setSelectedCrsId (long theCRSID) |
void | setSelectedAuthId (QString authId) |
void | setSelectedEpsg (long epsg) |
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. | |
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 | applyCRSNameSelection () |
does the legwork of applying the CRS Name Selection | |
void | applyCRSIDSelection () |
does the legwork of applying the CRS ID Selection | |
void | applyAuthIDSelection () |
does the legwork of applying the Authority ID 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 | 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). |
Definition at line 26 of file qgsprojectionselector.h.
QgsProjectionSelector::QgsProjectionSelector | ( | QWidget * | parent, | |
const char * | name = "" , |
|||
Qt::WFlags | fl = 0 | |||
) |
Definition at line 38 of file qgsprojectionselector.cpp.
References AUTHID_COLUMN, authorities(), coordinateSystemSelected(), QgsCoordinateReferenceSystem::EpsgCrsId, mRecentProjections, mSrsDatabaseFileName, QGIS_CRS_ID_COLUMN, QgsDebugMsg, and QgsApplication::srsDbFilePath().
QgsProjectionSelector::~QgsProjectionSelector | ( | ) |
Definition at line 96 of file qgsprojectionselector.cpp.
References QgsCoordinateReferenceSystem::InternalCrsId, mRecentProjections, and selectedCrsId().
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 618 of file qgsprojectionselector.cpp.
References QgsApplication::activeThemePath(), mUserProjList, mUserProjListDone, ogcWmsCrsFilterAsSqlExpression(), QGIS_CRS_ID_COLUMN, QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, and showDBMissingWarning().
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 693 of file qgsprojectionselector.cpp.
References QgsApplication::activeThemePath(), AUTHID_COLUMN, mGeoList, mProjList, mProjListDone, mSrsDatabaseFileName, ogcWmsCrsFilterAsSqlExpression(), QGIS_CRS_ID_COLUMN, and showDBMissingWarning().
Referenced by showEvent().
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 1131 of file qgsprojectionselector.cpp.
Referenced by on_pbnFind_clicked().
long QgsProjectionSelector::selectedEpsg | ( | ) |
Gets the current EpsgCrsId-style projection identifier.
Definition at line 569 of file qgsprojectionselector.cpp.
References getSelectedExpression(), and QgsDebugMsg.
long QgsProjectionSelector::selectedSrsid | ( | ) |
Gets the current InternalCrsId-style projection identifier.
QString QgsProjectionSelector::selectedAuthId | ( | ) |
Gets the current authority-style projection identifier.
Definition at line 588 of file qgsprojectionselector.cpp.
References getSelectedExpression().
void QgsProjectionSelector::setSelectedCrsName | ( | QString | theCRSName | ) | [slot] |
Definition at line 247 of file qgsprojectionselector.cpp.
References applyCRSNameSelection(), mAuthIDSelectionPending, mCRSIDSelectionPending, mCRSNameSelection, and mCRSNameSelectionPending.
QString QgsProjectionSelector::selectedName | ( | ) | [slot] |
Definition at line 384 of file qgsprojectionselector.cpp.
void QgsProjectionSelector::setSelectedCrsId | ( | long | theCRSID | ) | [slot] |
Definition at line 264 of file qgsprojectionselector.cpp.
References applyCRSIDSelection(), mAuthIDSelectionPending, mCRSIDSelection, mCRSIDSelectionPending, and mCRSNameSelectionPending.
Referenced by on_lstRecent_currentItemChanged(), and on_pbnFind_clicked().
void QgsProjectionSelector::setSelectedAuthId | ( | QString | authId | ) | [slot] |
Definition at line 285 of file qgsprojectionselector.cpp.
References mAuthIDSelection, mAuthIDSelectionPending, mCRSIDSelectionPending, and mCRSNameSelectionPending.
Referenced by setSelectedEpsg().
void QgsProjectionSelector::setSelectedEpsg | ( | long | epsg | ) | [slot] |
QString QgsProjectionSelector::selectedProj4String | ( | ) | [slot] |
Definition at line 398 of file qgsprojectionselector.cpp.
References mSrsDatabaseFileName, QGIS_CRS_ID_COLUMN, QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, showDBMissingWarning(), and USER_CRS_START_ID.
Referenced by coordinateSystemSelected().
long QgsProjectionSelector::selectedPostgresSrId | ( | ) | [slot] |
Gets the current PostGIS-style projection identifier.
Definition at line 582 of file qgsprojectionselector.cpp.
References getSelectedExpression().
long QgsProjectionSelector::selectedCrsId | ( | ) | [slot] |
Gets the current QGIS projection identfier.
Definition at line 594 of file qgsprojectionselector.cpp.
References QGIS_CRS_ID_COLUMN.
Referenced by coordinateSystemSelected(), on_pbnFind_clicked(), and ~QgsProjectionSelector().
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 609 of file qgsprojectionselector.cpp.
References mCrsFilter, mProjListDone, and mUserProjListDone.
void QgsProjectionSelector::on_pbnFind_clicked | ( | ) | [slot] |
Definition at line 894 of file qgsprojectionselector.cpp.
References getLargestCRSIDMatch(), mSrsDatabaseFileName, QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, selectedCrsId(), setSelectedCrsId(), showDBMissingWarning(), and sqlSafeString().
void QgsProjectionSelector::on_lstRecent_currentItemChanged | ( | QTreeWidgetItem * | current, | |
QTreeWidgetItem * | previous | |||
) | [slot] |
Definition at line 889 of file qgsprojectionselector.cpp.
References QGIS_CRS_ID_COLUMN, and setSelectedCrsId().
void QgsProjectionSelector::on_cbxHideDeprecated_stateChanged | ( | ) | [slot] |
void QgsProjectionSelector::showEvent | ( | QShowEvent * | theEvent | ) | [protected] |
Used to ensure the projection list view is actually populated.
Definition at line 149 of file qgsprojectionselector.cpp.
References applyAuthIDSelection(), applyCRSIDSelection(), applyCRSNameSelection(), insertRecent(), loadCrsList(), loadUserCrsList(), mAuthIDSelectionPending, mCrsFilter, mCRSIDSelectionPending, mCRSNameSelectionPending, mProjListDone, mRecentProjections, and mUserProjListDone.
void QgsProjectionSelector::resizeEvent | ( | QResizeEvent * | theEvent | ) | [protected] |
Used to manage column sizes.
Definition at line 138 of file qgsprojectionselector.cpp.
References AUTHID_COLUMN, NAME_COLUMN, and QGIS_CRS_ID_COLUMN.
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 186 of file qgsprojectionselector.cpp.
References QgsDebugMsg.
Referenced by loadCrsList(), and loadUserCrsList().
void QgsProjectionSelector::applyCRSNameSelection | ( | ) | [private] |
does the legwork of applying the CRS Name Selection
This function only expands the parents of the selection and does not scroll the list to the selection if the widget is not visible. Therefore you will typically want to use this in a showEvent().
Definition at line 293 of file qgsprojectionselector.cpp.
References mCRSNameSelection, mCRSNameSelectionPending, mProjListDone, mUserProjListDone, and QgsDebugMsg.
Referenced by setSelectedCrsName(), and showEvent().
void QgsProjectionSelector::applyCRSIDSelection | ( | ) | [private] |
does the legwork of applying the CRS ID Selection
This function only expands the parents of the selection and does not scroll the list to the selection if the widget is not visible. Therefore you will typically want to use this in a showEvent().
Definition at line 359 of file qgsprojectionselector.cpp.
References mCRSIDSelection, mCRSIDSelectionPending, mProjListDone, mUserProjListDone, and QGIS_CRS_ID_COLUMN.
Referenced by setSelectedCrsId(), and showEvent().
void QgsProjectionSelector::applyAuthIDSelection | ( | ) | [private] |
does the legwork of applying the Authority ID Selection
This function only expands the parents of the selection and does not scroll the list to the selection if the widget is not visible. Therefore you will typically want to use this in a showEvent().
Definition at line 336 of file qgsprojectionselector.cpp.
References AUTHID_COLUMN, mAuthIDSelection, mAuthIDSelectionPending, mProjListDone, mUserProjListDone, and QgsDebugMsg.
Referenced by showEvent().
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 489 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::showDBMissingWarning | ( | const QString | theFileName | ) | [private] |
Show the user a warning if the srs database could not be found.
Definition at line 1141 of file qgsprojectionselector.cpp.
Referenced by getLargestCRSIDMatch(), getSelectedExpression(), loadCrsList(), loadUserCrsList(), on_pbnFind_clicked(), and selectedProj4String().
long QgsProjectionSelector::getLargestCRSIDMatch | ( | QString | theSql | ) | [private] |
Utility method used in conjunction with name based searching tool.
Definition at line 1010 of file qgsprojectionselector.cpp.
References mSrsDatabaseFileName, QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, and showDBMissingWarning().
Referenced by on_pbnFind_clicked().
void QgsProjectionSelector::insertRecent | ( | long | theCrsId | ) | [private] |
add recently used CRS
Definition at line 320 of file qgsprojectionselector.cpp.
References AUTHID_COLUMN, mProjListDone, mUserProjListDone, NAME_COLUMN, and QGIS_CRS_ID_COLUMN.
Referenced by showEvent().
void QgsProjectionSelector::hideDeprecated | ( | QTreeWidgetItem * | item | ) | [private] |
hide deprecated CRSes
Definition at line 867 of file qgsprojectionselector.cpp.
Referenced by on_cbxHideDeprecated_stateChanged().
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 844 of file qgsprojectionselector.cpp.
References selectedCrsId(), selectedProj4String(), and sridSelected().
Referenced by QgsProjectionSelector().
QStringList QgsProjectionSelector::authorities | ( | ) | [private, slot] |
get list of authorities
Definition at line 1087 of file qgsprojectionselector.cpp.
References mSrsDatabaseFileName, and QgsDebugMsg.
Referenced by QgsProjectionSelector().
void QgsProjectionSelector::sridSelected | ( | QString | theSRID | ) | [signal] |
Referenced by coordinateSystemSelected().
void QgsProjectionSelector::refresh | ( | ) | [signal] |
Refresh any listening canvases.
void QgsProjectionSelector::searchBoxHasFocus | ( | bool | ) | [signal] |
Let listeners know if find has focus so they can adjust the default button.
QTreeWidgetItem* QgsProjectionSelector::mUserProjList [private] |
User defined projections node.
Definition at line 184 of file qgsprojectionselector.h.
Referenced by loadUserCrsList().
QTreeWidgetItem* QgsProjectionSelector::mGeoList [private] |
QTreeWidgetItem* QgsProjectionSelector::mProjList [private] |
QString QgsProjectionSelector::mCustomCsFile [private] |
QString QgsProjectionSelector::mSrsDatabaseFileName [private] |
File name of the sqlite3 database.
Definition at line 193 of file qgsprojectionselector.h.
Referenced by authorities(), getLargestCRSIDMatch(), getSelectedExpression(), loadCrsList(), on_pbnFind_clicked(), QgsProjectionSelector(), and selectedProj4String().
bool QgsProjectionSelector::mProjListDone [private] |
Has the Projection List been populated?
Definition at line 204 of file qgsprojectionselector.h.
Referenced by applyAuthIDSelection(), applyCRSIDSelection(), applyCRSNameSelection(), insertRecent(), loadCrsList(), setOgcWmsCrsFilter(), and showEvent().
bool QgsProjectionSelector::mUserProjListDone [private] |
Has the User Projection List been populated?
Definition at line 207 of file qgsprojectionselector.h.
Referenced by applyAuthIDSelection(), applyCRSIDSelection(), applyCRSNameSelection(), insertRecent(), loadUserCrsList(), setOgcWmsCrsFilter(), and showEvent().
bool QgsProjectionSelector::mCRSNameSelectionPending [private] |
Is there a pending selection to be made by CRS Name?
Definition at line 210 of file qgsprojectionselector.h.
Referenced by applyCRSNameSelection(), setSelectedAuthId(), setSelectedCrsId(), setSelectedCrsName(), and showEvent().
bool QgsProjectionSelector::mCRSIDSelectionPending [private] |
Is there a pending selection to be made by CRS ID?
Definition at line 213 of file qgsprojectionselector.h.
Referenced by applyCRSIDSelection(), setSelectedAuthId(), setSelectedCrsId(), setSelectedCrsName(), and showEvent().
bool QgsProjectionSelector::mAuthIDSelectionPending [private] |
Is there a pending selection to be made by Authority ID?
Definition at line 216 of file qgsprojectionselector.h.
Referenced by applyAuthIDSelection(), setSelectedAuthId(), setSelectedCrsId(), setSelectedCrsName(), and showEvent().
QString QgsProjectionSelector::mCRSNameSelection [private] |
The CRS Name that wants to be selected on this widget.
Definition at line 219 of file qgsprojectionselector.h.
Referenced by applyCRSNameSelection(), and setSelectedCrsName().
long QgsProjectionSelector::mCRSIDSelection [private] |
The CRS ID that wants to be selected on this widget.
Definition at line 222 of file qgsprojectionselector.h.
Referenced by applyCRSIDSelection(), and setSelectedCrsId().
QString QgsProjectionSelector::mAuthIDSelection [private] |
The Authority ID that wants to be selected on this widget.
Definition at line 225 of file qgsprojectionselector.h.
Referenced by applyAuthIDSelection(), and setSelectedAuthId().
QSet<QString> QgsProjectionSelector::mCrsFilter [private] |
The set of OGC WMS CRSs that want to be applied to this widget.
Definition at line 228 of file qgsprojectionselector.h.
Referenced by setOgcWmsCrsFilter(), and showEvent().
QStringList QgsProjectionSelector::mRecentProjections [private] |
Most recently used projections (trimmed at 25 entries).
Definition at line 231 of file qgsprojectionselector.h.
Referenced by QgsProjectionSelector(), showEvent(), and ~QgsProjectionSelector().