QGIS API Documentation  master-59fd5e0
QgsProjectionSelector Class Reference

A widget for selecting a Coordinate reference system from a tree. More...

#include <qgsprojectionselector.h>

List of all members.

Public Slots

void on_cbxHideDeprecated_stateChanged ()
void on_leSearch_textChanged (const QString &)
void on_lstCoordinateSystems_currentItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *prev)
void on_lstRecent_currentItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *prev)
long selectedCrsId ()
 Gets the current QGIS projection identfier.
QString selectedName ()
long selectedPostgresSrId ()
 Gets the current PostGIS-style projection identifier.
QString selectedProj4String ()
void setOgcWmsCrsFilter (QSet< QString > crsFilter)
 filters this widget by the given CRSs
void setSelectedAuthId (QString authId)
void setSelectedCrsId (long theCRSID)
void setSelectedCrsName (QString theCRSName)

Signals

void refresh ()
 Refresh any listening canvases.
void searchBoxHasFocus (bool)
 Let listeners know if find has focus so they can adjust the default button.
void sridSelected (QString theSRID)

Public Member Functions

 QgsProjectionSelector (QWidget *parent, const char *name="", Qt::WFlags fl=0)
 ~QgsProjectionSelector ()
void loadCrsList (QSet< QString > *crsFilter=0)
 Populate the proj tree view with system projection names...
void loadUserCrsList (QSet< QString > *crsFilter=0)
 Populate the proj tree view with user defined projection names...
QString selectedAuthId ()
 Gets the current authority-style projection identifier.
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.

Protected Member Functions

void resizeEvent (QResizeEvent *theEvent)
 Used to manage column sizes.
void showEvent (QShowEvent *theEvent)
 Used to ensure the projection list view is actually populated.

Private Types

enum  columns { NAME_COLUMN, AUTHID_COLUMN, QGIS_CRS_ID_COLUMN, NONE }

Private Slots

QStringList authorities ()
 get list of authorities

Private Member Functions

void applySelection (int column=NONE, QString value=QString::null)
 does the legwork of applying CRS Selection
long getLargestCRSIDMatch (QString theSql)
 Utility method used in conjunction with name based searching tool.
QString getSelectedExpression (QString e)
 gets an arbitrary sqlite3 expression from the selection
void hideDeprecated (QTreeWidgetItem *item)
 hide deprecated CRSes
void insertRecent (long theCrsId)
 add recently used CRS
QString ogcWmsCrsFilterAsSqlExpression (QSet< QString > *crsFilter)
 converts the CRS group to a SQL expression fragment
void showDBMissingWarning (const QString theFileName)
 Show the user a warning if the srs database could not be found.

Private Attributes

QSet< QString > mCrsFilter
 The set of OGC WMS CRSs that want to be applied to this widget.
QString mCustomCsFile
 Users custom coordinate system file.
QTreeWidgetItem * mGeoList
 GEOGCS node.
QTreeWidgetItem * mProjList
 PROJCS node.
bool mProjListDone
 Has the Projection List been populated?
QStringList mRecentProjections
 Most recently used projections (trimmed at 25 entries)
bool mRecentProjListDone
 Has the Recent Projection List been populated?
int mSearchColumn
QString mSearchValue
bool mSkipFirstRecent
QString mSrsDatabaseFileName
 File name of the sqlite3 database.
QTreeWidgetItem * mUserProjList
 User defined projections node.
bool mUserProjListDone
 Has the User Projection List been populated?

Detailed Description

A widget for selecting a Coordinate reference system from a tree.

See also:
QgsGenericProjectionSelector.
Author:
Tim Sutton

Definition at line 28 of file qgsprojectionselector.h.


Member Enumeration Documentation

Enumerator:
NAME_COLUMN 
AUTHID_COLUMN 
QGIS_CRS_ID_COLUMN 
NONE 

Definition at line 180 of file qgsprojectionselector.h.


Constructor & Destructor Documentation


Member Function Documentation

void QgsProjectionSelector::applySelection ( int  column = NONE,
QString  value = QString::null 
) [private]

does the legwork of applying CRS Selection

Warning:
This function does nothing unless getUserList() and getUserProjList() Have already been called
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 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 934 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 865 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

Parameters:
eThe sqlite3 expression (typically "srid" or "sridid")

Definition at line 372 of file qgsprojectionselector.cpp.

References mSrsDatabaseFileName, QGIS_CRS_ID_COLUMN, QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, showDBMissingWarning(), and USER_CRS_START_ID.

Referenced by selectedAuthId(), and selectedPostgresSrId().

void QgsProjectionSelector::hideDeprecated ( QTreeWidgetItem *  item) [private]

hide deprecated CRSes

Definition at line 772 of file qgsprojectionselector.cpp.

Referenced by on_cbxHideDeprecated_stateChanged().

void QgsProjectionSelector::insertRecent ( long  theCrsId) [private]

add recently used CRS

Definition at line 280 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...

Parameters:
crsFiltera 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.
Todo:
Should this be public?

Definition at line 554 of file qgsprojectionselector.cpp.

References QgsApplication::activeThemePath(), AUTHID_COLUMN, mGeoList, mProjList, mProjListDone, mSrsDatabaseFileName, NAME_COLUMN, ogcWmsCrsFilterAsSqlExpression(), QGIS_CRS_ID_COLUMN, showDBMissingWarning(), and tr.

Referenced by showEvent().

void QgsProjectionSelector::loadUserCrsList ( QSet< QString > *  crsFilter = 0)

Populate the proj tree view with user defined projection names...

Parameters:
crsFiltera 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.
Todo:
Should this be public?

Definition at line 478 of file qgsprojectionselector.cpp.

References QgsApplication::activeThemePath(), AUTHID_COLUMN, mUserProjList, mUserProjListDone, ogcWmsCrsFilterAsSqlExpression(), QGIS_CRS_ID_COLUMN, QgsApplication::qgisUserDbFilePath(), QgsDebugMsg, showDBMissingWarning(), and tr.

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.

Parameters:
crsFiltera 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 167 of file qgsprojectionselector.cpp.

References QgsDebugMsg.

Referenced by loadCrsList(), and loadUserCrsList().

void QgsProjectionSelector::on_leSearch_textChanged ( const QString &  theFilterTxt) [slot]

Definition at line 795 of file qgsprojectionselector.cpp.

References AUTHID_COLUMN, and NAME_COLUMN.

void QgsProjectionSelector::on_lstCoordinateSystems_currentItemChanged ( QTreeWidgetItem *  current,
QTreeWidgetItem *  prev 
) [slot]
void QgsProjectionSelector::on_lstRecent_currentItemChanged ( QTreeWidgetItem *  current,
QTreeWidgetItem *  prev 
) [slot]

Definition at line 749 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 135 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.

Gets the current authority-style projection identifier.

Definition at line 449 of file qgsprojectionselector.cpp.

References getSelectedExpression(), and USER_CRS_START_ID.

Gets the current QGIS projection identfier.

Definition at line 459 of file qgsprojectionselector.cpp.

References QGIS_CRS_ID_COLUMN.

Referenced by on_lstCoordinateSystems_currentItemChanged(), and ~QgsProjectionSelector().

Definition at line 296 of file qgsprojectionselector.cpp.

References NAME_COLUMN.

Referenced by on_lstCoordinateSystems_currentItemChanged().

Gets the current PostGIS-style projection identifier.

Definition at line 443 of file qgsprojectionselector.cpp.

References getSelectedExpression().

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.

Parameters:
crsFiltera 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.
Warning:
This function's behaviour is undefined if it is called after the widget is shown.

Definition at line 470 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.

void QgsProjectionSelector::setSelectedCrsId ( long  theCRSID) [slot]

Definition at line 230 of file qgsprojectionselector.cpp.

References applySelection(), and QGIS_CRS_ID_COLUMN.

void QgsProjectionSelector::setSelectedCrsName ( QString  theCRSName) [slot]

Definition at line 225 of file qgsprojectionselector.cpp.

References applySelection(), and NAME_COLUMN.

void QgsProjectionSelector::showDBMissingWarning ( const QString  theFileName) [private]

Show the user a warning if the srs database could not be found.

Definition at line 987 of file qgsprojectionselector.cpp.

References tr.

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 146 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.

  • const QString in The input string to make safe.
    Returns:
    The string made safe for SQL statements.
    linfinity qtcreator qgis
  • const QString in The input string to make safe.
    Returns:
    The string made safe for SQL statements.

Definition at line 977 of file qgsprojectionselector.cpp.

void QgsProjectionSelector::sridSelected ( QString  theSRID) [signal]

Member Data Documentation

QSet<QString> QgsProjectionSelector::mCrsFilter [private]

The set of OGC WMS CRSs that want to be applied to this widget.

Definition at line 187 of file qgsprojectionselector.h.

Referenced by setOgcWmsCrsFilter(), and showEvent().

Users custom coordinate system file.

Definition at line 158 of file qgsprojectionselector.h.

QTreeWidgetItem* QgsProjectionSelector::mGeoList [private]

GEOGCS node.

Definition at line 153 of file qgsprojectionselector.h.

Referenced by loadCrsList().

QTreeWidgetItem* QgsProjectionSelector::mProjList [private]

PROJCS node.

Definition at line 155 of file qgsprojectionselector.h.

Referenced by loadCrsList().

Has the Projection List been populated?

Definition at line 171 of file qgsprojectionselector.h.

Referenced by applySelection(), insertRecent(), loadCrsList(), and setOgcWmsCrsFilter().

Most recently used projections (trimmed at 25 entries)

Definition at line 190 of file qgsprojectionselector.h.

Referenced by QgsProjectionSelector(), showEvent(), and ~QgsProjectionSelector().

Has the Recent Projection List been populated?

Definition at line 178 of file qgsprojectionselector.h.

Referenced by showEvent().

Definition at line 181 of file qgsprojectionselector.h.

Referenced by applySelection().

Definition at line 182 of file qgsprojectionselector.h.

Referenced by applySelection().

QTreeWidgetItem* QgsProjectionSelector::mUserProjList [private]

User defined projections node.

Definition at line 151 of file qgsprojectionselector.h.

Referenced by loadUserCrsList().

Has the User Projection List been populated?

Definition at line 174 of file qgsprojectionselector.h.

Referenced by applySelection(), insertRecent(), loadUserCrsList(), and setOgcWmsCrsFilter().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines