Quantum GIS API Documentation
1.8
|
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_lstCoordinateSystems_currentItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *prev) |
void | on_lstRecent_currentItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *prev) |
void | on_cbxHideDeprecated_stateChanged () |
void | on_leSearch_textChanged (const QString &) |
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 Types | |
enum | columns { NAME_COLUMN, AUTHID_COLUMN, QGIS_CRS_ID_COLUMN, NONE } |
Private Slots | |
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 (int column=NONE, QString value=QString::null) |
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? | |
int | mSearchColumn |
QString | mSearchValue |
bool | mSkipFirstRecent |
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.
enum QgsProjectionSelector::columns [private] |
Definition at line 191 of file qgsprojectionselector.h.
QgsProjectionSelector::QgsProjectionSelector | ( | QWidget * | parent, |
const char * | name = "" , |
||
Qt::WFlags | fl = 0 |
||
) |
Definition at line 29 of file qgsprojectionselector.cpp.
References AUTHID_COLUMN, QgsCoordinateReferenceSystem::createFromOgcWmsCrs(), QgsCoordinateReferenceSystem::createFromProj4(), QgsCoordinateReferenceSystem::isValid(), mRecentProjections, mSrsDatabaseFileName, QGIS_CRS_ID_COLUMN, QgsDebugMsg, QgsApplication::srsDbFilePath(), and QgsCoordinateReferenceSystem::srsid().
Definition at line 90 of file qgsprojectionselector.cpp.
References QgsCoordinateReferenceSystem::InternalCrsId, mRecentProjections, selectedCrsId(), and QgsCoordinateReferenceSystem::toProj4().
void QgsProjectionSelector::applySelection | ( | int | column = NONE , |
QString | value = QString::null |
||
) | [private] |
does the legwork of applying CRS Selection
Definition at line 240 of file qgsprojectionselector.cpp.
References mProjListDone, mSearchColumn, mSearchValue, mUserProjListDone, NONE, and QgsDebugMsg.
Referenced by setSelectedAuthId(), setSelectedCrsId(), setSelectedCrsName(), and showEvent().
QStringList QgsProjectionSelector::authorities | ( | ) | [private, slot] |
get list of authorities
Definition at line 938 of file qgsprojectionselector.cpp.
References mSrsDatabaseFileName, and QgsDebugMsg.
long QgsProjectionSelector::getLargestCRSIDMatch | ( | QString | theSql | ) | [private] |
Utility method used in conjunction with name based searching tool.
Definition at line 869 of file qgsprojectionselector.cpp.
References mSrsDatabaseFileName, QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, and showDBMissingWarning().
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 371 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 781 of file qgsprojectionselector.cpp.
Referenced by on_cbxHideDeprecated_stateChanged().
void QgsProjectionSelector::insertRecent | ( | long | theCrsId | ) | [private] |
add recently used CRS
Definition at line 279 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 565 of file qgsprojectionselector.cpp.
References QgsApplication::activeThemePath(), AUTHID_COLUMN, mGeoList, mProjList, mProjListDone, mSrsDatabaseFileName, NAME_COLUMN, 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 489 of file qgsprojectionselector.cpp.
References QgsApplication::activeThemePath(), AUTHID_COLUMN, 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 162 of file qgsprojectionselector.cpp.
References QgsDebugMsg.
Referenced by loadCrsList(), and loadUserCrsList().
void QgsProjectionSelector::on_cbxHideDeprecated_stateChanged | ( | ) | [slot] |
Definition at line 797 of file qgsprojectionselector.cpp.
References hideDeprecated().
void QgsProjectionSelector::on_leSearch_textChanged | ( | const QString & | theFilterTxt | ) | [slot] |
Definition at line 803 of file qgsprojectionselector.cpp.
References AUTHID_COLUMN, and NAME_COLUMN.
void QgsProjectionSelector::on_lstCoordinateSystems_currentItemChanged | ( | QTreeWidgetItem * | current, |
QTreeWidgetItem * | prev | ||
) | [slot] |
Definition at line 715 of file qgsprojectionselector.cpp.
References QGIS_CRS_ID_COLUMN, QgsDebugMsg, selectedCrsId(), selectedProj4String(), and sridSelected().
void QgsProjectionSelector::on_lstRecent_currentItemChanged | ( | QTreeWidgetItem * | current, |
QTreeWidgetItem * | prev | ||
) | [slot] |
Definition at line 758 of file qgsprojectionselector.cpp.
References mSkipFirstRecent, QGIS_CRS_ID_COLUMN, and QgsDebugMsg.
void QgsProjectionSelector::refresh | ( | ) | [signal] |
Refresh any listening canvases.
void QgsProjectionSelector::resizeEvent | ( | QResizeEvent * | theEvent | ) | [protected] |
Used to manage column sizes.
Definition at line 130 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 460 of file qgsprojectionselector.cpp.
References getSelectedExpression(), and USER_CRS_START_ID.
long QgsProjectionSelector::selectedCrsId | ( | ) | [slot] |
Gets the current QGIS projection identfier.
Definition at line 470 of file qgsprojectionselector.cpp.
References QGIS_CRS_ID_COLUMN.
Referenced by on_lstCoordinateSystems_currentItemChanged(), and ~QgsProjectionSelector().
long QgsProjectionSelector::selectedEpsg | ( | ) |
Gets the current EpsgCrsId-style projection identifier.
Definition at line 441 of file qgsprojectionselector.cpp.
References getSelectedExpression(), and QgsDebugMsg.
QString QgsProjectionSelector::selectedName | ( | ) | [slot] |
Definition at line 295 of file qgsprojectionselector.cpp.
References NAME_COLUMN.
long QgsProjectionSelector::selectedPostgresSrId | ( | ) | [slot] |
Gets the current PostGIS-style projection identifier.
Definition at line 454 of file qgsprojectionselector.cpp.
References getSelectedExpression().
QString QgsProjectionSelector::selectedProj4String | ( | ) | [slot] |
Definition at line 303 of file qgsprojectionselector.cpp.
References mSrsDatabaseFileName, QGIS_CRS_ID_COLUMN, QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, showDBMissingWarning(), and USER_CRS_START_ID.
Referenced by on_lstCoordinateSystems_currentItemChanged().
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 481 of file qgsprojectionselector.cpp.
References mCrsFilter, mProjListDone, and mUserProjListDone.
void QgsProjectionSelector::setSelectedAuthId | ( | QString | authId | ) | [slot] |
Definition at line 235 of file qgsprojectionselector.cpp.
References applySelection(), and AUTHID_COLUMN.
Referenced by setSelectedEpsg().
void QgsProjectionSelector::setSelectedCrsId | ( | long | theCRSID | ) | [slot] |
Definition at line 225 of file qgsprojectionselector.cpp.
References applySelection(), and QGIS_CRS_ID_COLUMN.
void QgsProjectionSelector::setSelectedCrsName | ( | QString | theCRSName | ) | [slot] |
Definition at line 220 of file qgsprojectionselector.cpp.
References applySelection(), and NAME_COLUMN.
void QgsProjectionSelector::setSelectedEpsg | ( | long | epsg | ) | [slot] |
Get the selected coordinate system.
Definition at line 230 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 991 of file qgsprojectionselector.cpp.
Referenced by getLargestCRSIDMatch(), getSelectedExpression(), loadCrsList(), loadUserCrsList(), and selectedProj4String().
void QgsProjectionSelector::showEvent | ( | QShowEvent * | theEvent | ) | [protected] |
Used to ensure the projection list view is actually populated.
Definition at line 141 of file qgsprojectionselector.cpp.
References applySelection(), insertRecent(), loadCrsList(), loadUserCrsList(), mCrsFilter, mRecentProjections, and mRecentProjListDone.
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 981 of file qgsprojectionselector.cpp.
void QgsProjectionSelector::sridSelected | ( | QString | theSRID | ) | [signal] |
Referenced by on_lstCoordinateSystems_currentItemChanged().
QSet<QString> QgsProjectionSelector::mCrsFilter [private] |
The set of OGC WMS CRSs that want to be applied to this widget.
Definition at line 198 of file qgsprojectionselector.h.
Referenced by setOgcWmsCrsFilter(), and showEvent().
QString QgsProjectionSelector::mCustomCsFile [private] |
Users custom coordinate system file.
Definition at line 169 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 182 of file qgsprojectionselector.h.
Referenced by applySelection(), insertRecent(), loadCrsList(), and setOgcWmsCrsFilter().
QStringList QgsProjectionSelector::mRecentProjections [private] |
Most recently used projections (trimmed at 25 entries)
Definition at line 201 of file qgsprojectionselector.h.
Referenced by QgsProjectionSelector(), showEvent(), and ~QgsProjectionSelector().
bool QgsProjectionSelector::mRecentProjListDone [private] |
Has the Recent Projection List been populated?
Definition at line 189 of file qgsprojectionselector.h.
Referenced by showEvent().
int QgsProjectionSelector::mSearchColumn [private] |
Definition at line 192 of file qgsprojectionselector.h.
Referenced by applySelection().
QString QgsProjectionSelector::mSearchValue [private] |
Definition at line 193 of file qgsprojectionselector.h.
Referenced by applySelection().
bool QgsProjectionSelector::mSkipFirstRecent [private] |
Definition at line 195 of file qgsprojectionselector.h.
Referenced by on_lstRecent_currentItemChanged().
QString QgsProjectionSelector::mSrsDatabaseFileName [private] |
File name of the sqlite3 database.
Definition at line 171 of file qgsprojectionselector.h.
Referenced by authorities(), getLargestCRSIDMatch(), getSelectedExpression(), loadCrsList(), QgsProjectionSelector(), and selectedProj4String().
QTreeWidgetItem* QgsProjectionSelector::mUserProjList [private] |
User defined projections node.
Definition at line 162 of file qgsprojectionselector.h.
Referenced by loadUserCrsList().
bool QgsProjectionSelector::mUserProjListDone [private] |
Has the User Projection List been populated?
Definition at line 185 of file qgsprojectionselector.h.
Referenced by applySelection(), insertRecent(), loadUserCrsList(), and setOgcWmsCrsFilter().