add missing ui headers for gui includes for install and implement QgsProjectionSelector::setSelectedEpsg()

git-svn-id: http://svn.osgeo.org/qgis/trunk@10093 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
jef 2009-02-02 19:30:43 +00:00
parent bacd648fa5
commit 6f8d3109f3
5 changed files with 69 additions and 10 deletions

View File

@ -118,6 +118,11 @@ qgsprojectionselector.h
qgsrubberband.h qgsrubberband.h
qgsvertexmarker.h qgsvertexmarker.h
qgsmaptip.h qgsmaptip.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsdetaileditemwidgetbase.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsgenericprojectionselectorbase.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsmessageviewer.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsprojectionselectorbase.h
) )

View File

@ -16,7 +16,7 @@
* * * *
***************************************************************************/ ***************************************************************************/
/* $Id$ */ /* $Id$ */
#include "qgsgenericprojectionselector.h" #include <qgsgenericprojectionselector.h>
#include <QApplication> #include <QApplication>
/** /**

View File

@ -18,8 +18,8 @@
/* $Id$ */ /* $Id$ */
#ifndef QGSGENERICPROJECTIONSELECTOR_H #ifndef QGSGENERICPROJECTIONSELECTOR_H
#define QGSGENERICPROJECTIONSELECTOR_H #define QGSGENERICPROJECTIONSELECTOR_H
#include "ui_qgsgenericprojectionselectorbase.h" #include <ui_qgsgenericprojectionselectorbase.h>
#include "qgisgui.h" #include <qgisgui.h>
#include <QSet> #include <QSet>

View File

@ -9,7 +9,7 @@
* (at your option) any later version. * * (at your option) any later version. *
***************************************************************************/ ***************************************************************************/
/* $Id$ */ /* $Id$ */
#include "qgsprojectionselector.h" #include <qgsprojectionselector.h>
//standard includes //standard includes
#include <cassert> #include <cassert>
@ -41,8 +41,8 @@ QgsProjectionSelector::QgsProjectionSelector( QWidget* parent,
mProjListDone( FALSE ), mProjListDone( FALSE ),
mUserProjListDone( FALSE ), mUserProjListDone( FALSE ),
mCRSNameSelectionPending( FALSE ), mCRSNameSelectionPending( FALSE ),
mCRSIDSelectionPending( FALSE ) mCRSIDSelectionPending( FALSE ),
mEPSGIDSelectionPending( FALSE )
{ {
setupUi( this ); setupUi( this );
connect( lstCoordinateSystems, SIGNAL( currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ), connect( lstCoordinateSystems, SIGNAL( currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ),
@ -94,6 +94,10 @@ void QgsProjectionSelector::showEvent( QShowEvent * theEvent )
{ {
applyCRSIDSelection(); applyCRSIDSelection();
} }
if ( mEPSGIDSelectionPending )
{
applyEPSGIDSelection();
}
// Pass up the inheritance heirarchy // Pass up the inheritance heirarchy
QWidget::showEvent( theEvent ); QWidget::showEvent( theEvent );
@ -168,6 +172,7 @@ void QgsProjectionSelector::setSelectedCrsName( QString theCRSName )
mCRSNameSelection = theCRSName; mCRSNameSelection = theCRSName;
mCRSNameSelectionPending = TRUE; mCRSNameSelectionPending = TRUE;
mCRSIDSelectionPending = FALSE; // only one type can be pending at a time mCRSIDSelectionPending = FALSE; // only one type can be pending at a time
mEPSGIDSelectionPending = TRUE;
if ( isVisible() ) if ( isVisible() )
{ {
@ -184,6 +189,7 @@ void QgsProjectionSelector::setSelectedCrsId( long theCRSID )
mCRSIDSelection = theCRSID; mCRSIDSelection = theCRSID;
mCRSIDSelectionPending = TRUE; mCRSIDSelectionPending = TRUE;
mCRSNameSelectionPending = FALSE; // only one type can be pending at a time mCRSNameSelectionPending = FALSE; // only one type can be pending at a time
mEPSGIDSelectionPending = FALSE;
if ( isVisible() ) if ( isVisible() )
{ {
@ -196,7 +202,10 @@ void QgsProjectionSelector::setSelectedCrsId( long theCRSID )
void QgsProjectionSelector::setSelectedEpsg( long epsg ) void QgsProjectionSelector::setSelectedEpsg( long epsg )
{ {
//QgsSpatial mEPSGIDSelection = epsg;
mCRSIDSelectionPending = FALSE;
mEPSGIDSelectionPending = TRUE;
mCRSNameSelectionPending = FALSE; // only one type can be pending at a time
} }
void QgsProjectionSelector::applyCRSNameSelection() void QgsProjectionSelector::applyCRSNameSelection()
@ -226,6 +235,33 @@ void QgsProjectionSelector::applyCRSNameSelection()
} }
} }
void QgsProjectionSelector::applyEPSGIDSelection()
{
if (
( mEPSGIDSelectionPending ) &&
( mProjListDone ) &&
( mUserProjListDone )
)
{
//get the srid given the wkt so we can pick the correct list item
QgsDebugMsg( "called with " + QString::number( mEPSGIDSelection ) );
QList<QTreeWidgetItem*> nodes = lstCoordinateSystems->findItems( QString::number( mEPSGIDSelection ), Qt::MatchExactly | Qt::MatchRecursive, EPSG_COLUMN );
if ( nodes.count() > 0 )
{
lstCoordinateSystems->setCurrentItem( nodes.first() );
lstCoordinateSystems->scrollToItem( nodes.first() );
}
else // unselect the selected item to avoid confusing the user
{
lstCoordinateSystems->clearSelection();
teProjection->setText( "" );
}
mEPSGIDSelectionPending = FALSE;
}
}
void QgsProjectionSelector::applyCRSIDSelection() void QgsProjectionSelector::applyCRSIDSelection()
{ {
if ( if (

View File

@ -11,7 +11,7 @@
#ifndef QGSCRSSELECTOR_H #ifndef QGSCRSSELECTOR_H
#define QGSCRSSELECTOR_H #define QGSCRSSELECTOR_H
#include "ui_qgsprojectionselectorbase.h" #include <ui_qgsprojectionselectorbase.h>
#include <QSet> #include <QSet>
@ -150,6 +150,18 @@ class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectio
*/ */
void applyCRSIDSelection(); void applyCRSIDSelection();
/**
* \brief does the legwork of applying the EPSG ID Selection
*
* \warning This function does nothing unless getUserList() and getUserProjList()
* Have already been called
*
* \warning 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().
*/
void applyEPSGIDSelection();
/** /**
* \brief gets an arbitrary sqlite3 attribute of type "long" from the selection * \brief gets an arbitrary sqlite3 attribute of type "long" from the selection
* *
@ -189,12 +201,18 @@ class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectio
//! Is there a pending selection to be made by CRS ID? //! Is there a pending selection to be made by CRS ID?
bool mCRSIDSelectionPending; bool mCRSIDSelectionPending;
//! Is there a pending selection to be made by EPSG ID?
bool mEPSGIDSelectionPending;
//! The CRS Name that wants to be selected on this widget //! The CRS Name that wants to be selected on this widget
QString mCRSNameSelection; QString mCRSNameSelection;
//! The CRS ID that wants to be selected on this widget //! The CRS ID that wants to be selected on this widget
long mCRSIDSelection; long mCRSIDSelection;
//! The EPSG ID that wants to be selected on this widget
long mEPSGIDSelection;
//! The set of OGC WMS CRSs that want to be applied to this widget //! The set of OGC WMS CRSs that want to be applied to this widget
QSet<QString> mCrsFilter; QSet<QString> mCrsFilter;