Skip to content

Commit 9b08521

Browse files
author
jef
committed
add missing ui headers for gui includes for install and implement QgsProjectionSelector::setSelectedEpsg()
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10093 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent d5ff56c commit 9b08521

5 files changed

+69
-10
lines changed

src/gui/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ qgsprojectionselector.h
118118
qgsrubberband.h
119119
qgsvertexmarker.h
120120
qgsmaptip.h
121+
122+
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsdetaileditemwidgetbase.h
123+
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsgenericprojectionselectorbase.h
124+
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsmessageviewer.h
125+
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsprojectionselectorbase.h
121126
)
122127

123128

src/gui/qgsgenericprojectionselector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* *
1717
***************************************************************************/
1818
/* $Id$ */
19-
#include "qgsgenericprojectionselector.h"
19+
#include <qgsgenericprojectionselector.h>
2020
#include <QApplication>
2121

2222
/**

src/gui/qgsgenericprojectionselector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
/* $Id$ */
1919
#ifndef QGSGENERICPROJECTIONSELECTOR_H
2020
#define QGSGENERICPROJECTIONSELECTOR_H
21-
#include "ui_qgsgenericprojectionselectorbase.h"
22-
#include "qgisgui.h"
21+
#include <ui_qgsgenericprojectionselectorbase.h>
22+
#include <qgisgui.h>
2323

2424
#include <QSet>
2525

src/gui/qgsprojectionselector.cpp

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* (at your option) any later version. *
1010
***************************************************************************/
1111
/* $Id$ */
12-
#include "qgsprojectionselector.h"
12+
#include <qgsprojectionselector.h>
1313

1414
//standard includes
1515
#include <cassert>
@@ -41,8 +41,8 @@ QgsProjectionSelector::QgsProjectionSelector( QWidget* parent,
4141
mProjListDone( FALSE ),
4242
mUserProjListDone( FALSE ),
4343
mCRSNameSelectionPending( FALSE ),
44-
mCRSIDSelectionPending( FALSE )
45-
44+
mCRSIDSelectionPending( FALSE ),
45+
mEPSGIDSelectionPending( FALSE )
4646
{
4747
setupUi( this );
4848
connect( lstCoordinateSystems, SIGNAL( currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ),
@@ -94,6 +94,10 @@ void QgsProjectionSelector::showEvent( QShowEvent * theEvent )
9494
{
9595
applyCRSIDSelection();
9696
}
97+
if ( mEPSGIDSelectionPending )
98+
{
99+
applyEPSGIDSelection();
100+
}
97101

98102
// Pass up the inheritance heirarchy
99103
QWidget::showEvent( theEvent );
@@ -168,6 +172,7 @@ void QgsProjectionSelector::setSelectedCrsName( QString theCRSName )
168172
mCRSNameSelection = theCRSName;
169173
mCRSNameSelectionPending = TRUE;
170174
mCRSIDSelectionPending = FALSE; // only one type can be pending at a time
175+
mEPSGIDSelectionPending = TRUE;
171176

172177
if ( isVisible() )
173178
{
@@ -184,6 +189,7 @@ void QgsProjectionSelector::setSelectedCrsId( long theCRSID )
184189
mCRSIDSelection = theCRSID;
185190
mCRSIDSelectionPending = TRUE;
186191
mCRSNameSelectionPending = FALSE; // only one type can be pending at a time
192+
mEPSGIDSelectionPending = FALSE;
187193

188194
if ( isVisible() )
189195
{
@@ -196,7 +202,10 @@ void QgsProjectionSelector::setSelectedCrsId( long theCRSID )
196202

197203
void QgsProjectionSelector::setSelectedEpsg( long epsg )
198204
{
199-
//QgsSpatial
205+
mEPSGIDSelection = epsg;
206+
mCRSIDSelectionPending = FALSE;
207+
mEPSGIDSelectionPending = TRUE;
208+
mCRSNameSelectionPending = FALSE; // only one type can be pending at a time
200209
}
201210

202211
void QgsProjectionSelector::applyCRSNameSelection()
@@ -226,6 +235,33 @@ void QgsProjectionSelector::applyCRSNameSelection()
226235
}
227236
}
228237

238+
void QgsProjectionSelector::applyEPSGIDSelection()
239+
{
240+
if (
241+
( mEPSGIDSelectionPending ) &&
242+
( mProjListDone ) &&
243+
( mUserProjListDone )
244+
)
245+
{
246+
//get the srid given the wkt so we can pick the correct list item
247+
QgsDebugMsg( "called with " + QString::number( mEPSGIDSelection ) );
248+
QList<QTreeWidgetItem*> nodes = lstCoordinateSystems->findItems( QString::number( mEPSGIDSelection ), Qt::MatchExactly | Qt::MatchRecursive, EPSG_COLUMN );
249+
250+
if ( nodes.count() > 0 )
251+
{
252+
lstCoordinateSystems->setCurrentItem( nodes.first() );
253+
lstCoordinateSystems->scrollToItem( nodes.first() );
254+
}
255+
else // unselect the selected item to avoid confusing the user
256+
{
257+
lstCoordinateSystems->clearSelection();
258+
teProjection->setText( "" );
259+
}
260+
261+
mEPSGIDSelectionPending = FALSE;
262+
}
263+
}
264+
229265
void QgsProjectionSelector::applyCRSIDSelection()
230266
{
231267
if (

src/gui/qgsprojectionselector.h

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#ifndef QGSCRSSELECTOR_H
1212
#define QGSCRSSELECTOR_H
1313

14-
#include "ui_qgsprojectionselectorbase.h"
14+
#include <ui_qgsprojectionselectorbase.h>
1515

1616
#include <QSet>
1717

@@ -151,10 +151,22 @@ class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectio
151151
void applyCRSIDSelection();
152152

153153
/**
154-
* \brief gets an arbitrary sqlite3 attribute of type "long" from the selection
154+
* \brief does the legwork of applying the EPSG ID Selection
155155
*
156-
* \param attributeName The sqlite3 column name, typically "srid" or "epsg"
156+
* \warning This function does nothing unless getUserList() and getUserProjList()
157+
* Have already been called
158+
*
159+
* \warning This function only expands the parents of the selection and
160+
* does not scroll the list to the selection if the widget is not visible.
161+
* Therefore you will typically want to use this in a showEvent().
157162
*/
163+
void applyEPSGIDSelection();
164+
165+
/**
166+
* \brief gets an arbitrary sqlite3 attribute of type "long" from the selection
167+
*
168+
* \param attributeName The sqlite3 column name, typically "srid" or "epsg"
169+
*/
158170
long getSelectedLongAttribute( QString attributeName );
159171

160172
/** Show the user a warning if the srs database could not be found */
@@ -189,12 +201,18 @@ class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectio
189201
//! Is there a pending selection to be made by CRS ID?
190202
bool mCRSIDSelectionPending;
191203

204+
//! Is there a pending selection to be made by EPSG ID?
205+
bool mEPSGIDSelectionPending;
206+
192207
//! The CRS Name that wants to be selected on this widget
193208
QString mCRSNameSelection;
194209

195210
//! The CRS ID that wants to be selected on this widget
196211
long mCRSIDSelection;
197212

213+
//! The EPSG ID that wants to be selected on this widget
214+
long mEPSGIDSelection;
215+
198216
//! The set of OGC WMS CRSs that want to be applied to this widget
199217
QSet<QString> mCrsFilter;
200218

0 commit comments

Comments
 (0)