QgsProjectionSelector Class Reference
[QGIS gui library.]

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

#include <qgsprojectionselector.h>

List of all members.

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


Detailed Description

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

See also:
QgsGenericProjectionSelector.
Author:
Tim Sutton

Definition at line 26 of file qgsprojectionselector.h.


Constructor & Destructor Documentation

QgsProjectionSelector::QgsProjectionSelector ( QWidget *  parent,
const char *  name = "",
Qt::WFlags  fl = 0 
)

QgsProjectionSelector::~QgsProjectionSelector (  ) 


Member Function Documentation

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

Populate the proj tree view with user defined projection names.

..

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

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.

..

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

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.

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

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]

QString QgsProjectionSelector::selectedName (  )  [slot]

Definition at line 384 of file qgsprojectionselector.cpp.

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

void QgsProjectionSelector::setSelectedAuthId ( QString  authId  )  [slot]

void QgsProjectionSelector::setSelectedEpsg ( long  epsg  )  [slot]

Definition at line 280 of file qgsprojectionselector.cpp.

References setSelectedAuthId().

QString QgsProjectionSelector::selectedProj4String (  )  [slot]

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.

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

Definition at line 609 of file qgsprojectionselector.cpp.

References mCrsFilter, mProjListDone, and mUserProjListDone.

void QgsProjectionSelector::on_pbnFind_clicked (  )  [slot]

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]

Definition at line 883 of file qgsprojectionselector.cpp.

References hideDeprecated().

void QgsProjectionSelector::showEvent ( QShowEvent *  theEvent  )  [protected]

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.

Parameters:
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

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

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

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

Parameters:
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]

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.


Member Data Documentation

QTreeWidgetItem* QgsProjectionSelector::mUserProjList [private]

User defined projections node.

Definition at line 184 of file qgsprojectionselector.h.

Referenced by loadUserCrsList().

QTreeWidgetItem* QgsProjectionSelector::mGeoList [private]

GEOGCS node.

Definition at line 186 of file qgsprojectionselector.h.

Referenced by loadCrsList().

QTreeWidgetItem* QgsProjectionSelector::mProjList [private]

PROJCS node.

Definition at line 188 of file qgsprojectionselector.h.

Referenced by loadCrsList().

Users custom coordinate system file.

Definition at line 191 of file qgsprojectionselector.h.

Has the Projection List been populated?

Definition at line 204 of file qgsprojectionselector.h.

Referenced by applyAuthIDSelection(), applyCRSIDSelection(), applyCRSNameSelection(), insertRecent(), loadCrsList(), setOgcWmsCrsFilter(), and showEvent().

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().

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().

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().

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().

The CRS Name that wants to be selected on this widget.

Definition at line 219 of file qgsprojectionselector.h.

Referenced by applyCRSNameSelection(), and setSelectedCrsName().

The CRS ID that wants to be selected on this widget.

Definition at line 222 of file qgsprojectionselector.h.

Referenced by applyCRSIDSelection(), and setSelectedCrsId().

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().

Most recently used projections (trimmed at 25 entries).

Definition at line 231 of file qgsprojectionselector.h.

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


The documentation for this class was generated from the following files:

Generated on Sat Feb 4 19:17:45 2012 for Quantum GIS API Documentation by  doxygen 1.5.6