[QGIS Commit] r10093 - trunk/qgis/src/gui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Feb 2 14:30:43 EST 2009


Author: jef
Date: 2009-02-02 14:30:43 -0500 (Mon, 02 Feb 2009)
New Revision: 10093

Modified:
   trunk/qgis/src/gui/CMakeLists.txt
   trunk/qgis/src/gui/qgsgenericprojectionselector.cpp
   trunk/qgis/src/gui/qgsgenericprojectionselector.h
   trunk/qgis/src/gui/qgsprojectionselector.cpp
   trunk/qgis/src/gui/qgsprojectionselector.h
Log:
add missing ui headers for gui includes for install and implement QgsProjectionSelector::setSelectedEpsg()

Modified: trunk/qgis/src/gui/CMakeLists.txt
===================================================================
--- trunk/qgis/src/gui/CMakeLists.txt	2009-02-02 19:19:49 UTC (rev 10092)
+++ trunk/qgis/src/gui/CMakeLists.txt	2009-02-02 19:30:43 UTC (rev 10093)
@@ -118,6 +118,11 @@
 qgsrubberband.h
 qgsvertexmarker.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
 )
 
 

Modified: trunk/qgis/src/gui/qgsgenericprojectionselector.cpp
===================================================================
--- trunk/qgis/src/gui/qgsgenericprojectionselector.cpp	2009-02-02 19:19:49 UTC (rev 10092)
+++ trunk/qgis/src/gui/qgsgenericprojectionselector.cpp	2009-02-02 19:30:43 UTC (rev 10093)
@@ -16,7 +16,7 @@
  *                                                                         *
  ***************************************************************************/
 /* $Id$ */
-#include "qgsgenericprojectionselector.h"
+#include <qgsgenericprojectionselector.h>
 #include <QApplication>
 
 /**

Modified: trunk/qgis/src/gui/qgsgenericprojectionselector.h
===================================================================
--- trunk/qgis/src/gui/qgsgenericprojectionselector.h	2009-02-02 19:19:49 UTC (rev 10092)
+++ trunk/qgis/src/gui/qgsgenericprojectionselector.h	2009-02-02 19:30:43 UTC (rev 10093)
@@ -18,8 +18,8 @@
 /* $Id$ */
 #ifndef QGSGENERICPROJECTIONSELECTOR_H
 #define QGSGENERICPROJECTIONSELECTOR_H
-#include "ui_qgsgenericprojectionselectorbase.h"
-#include "qgisgui.h"
+#include <ui_qgsgenericprojectionselectorbase.h>
+#include <qgisgui.h>
 
 #include <QSet>
 

Modified: trunk/qgis/src/gui/qgsprojectionselector.cpp
===================================================================
--- trunk/qgis/src/gui/qgsprojectionselector.cpp	2009-02-02 19:19:49 UTC (rev 10092)
+++ trunk/qgis/src/gui/qgsprojectionselector.cpp	2009-02-02 19:30:43 UTC (rev 10093)
@@ -9,7 +9,7 @@
  *   (at your option) any later version.                                   *
  ***************************************************************************/
 /* $Id$ */
-#include "qgsprojectionselector.h"
+#include <qgsprojectionselector.h>
 
 //standard includes
 #include <cassert>
@@ -41,8 +41,8 @@
     mProjListDone( FALSE ),
     mUserProjListDone( FALSE ),
     mCRSNameSelectionPending( FALSE ),
-    mCRSIDSelectionPending( FALSE )
-
+    mCRSIDSelectionPending( FALSE ),
+    mEPSGIDSelectionPending( FALSE )
 {
   setupUi( this );
   connect( lstCoordinateSystems, SIGNAL( currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ),
@@ -94,6 +94,10 @@
   {
     applyCRSIDSelection();
   }
+  if ( mEPSGIDSelectionPending )
+  {
+    applyEPSGIDSelection();
+  }
 
   // Pass up the inheritance heirarchy
   QWidget::showEvent( theEvent );
@@ -168,6 +172,7 @@
   mCRSNameSelection = theCRSName;
   mCRSNameSelectionPending = TRUE;
   mCRSIDSelectionPending = FALSE;  // only one type can be pending at a time
+  mEPSGIDSelectionPending = TRUE;
 
   if ( isVisible() )
   {
@@ -184,6 +189,7 @@
   mCRSIDSelection = theCRSID;
   mCRSIDSelectionPending = TRUE;
   mCRSNameSelectionPending = FALSE;  // only one type can be pending at a time
+  mEPSGIDSelectionPending = FALSE;
 
   if ( isVisible() )
   {
@@ -196,7 +202,10 @@
 
 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()
@@ -226,6 +235,33 @@
   }
 }
 
+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()
 {
   if (

Modified: trunk/qgis/src/gui/qgsprojectionselector.h
===================================================================
--- trunk/qgis/src/gui/qgsprojectionselector.h	2009-02-02 19:19:49 UTC (rev 10092)
+++ trunk/qgis/src/gui/qgsprojectionselector.h	2009-02-02 19:30:43 UTC (rev 10093)
@@ -11,7 +11,7 @@
 #ifndef QGSCRSSELECTOR_H
 #define QGSCRSSELECTOR_H
 
-#include "ui_qgsprojectionselectorbase.h"
+#include <ui_qgsprojectionselectorbase.h>
 
 #include <QSet>
 
@@ -151,10 +151,22 @@
     void applyCRSIDSelection();
 
     /**
-     * \brief gets an arbitrary sqlite3 attribute of type "long" from the selection
+     * \brief does the legwork of applying the EPSG ID Selection
      *
-     * \param attributeName   The sqlite3 column name, typically "srid" or "epsg"
+     * \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
+       *
+       * \param attributeName   The sqlite3 column name, typically "srid" or "epsg"
+       */
     long getSelectedLongAttribute( QString attributeName );
 
     /** Show the user a warning if the srs database could not be found */
@@ -189,12 +201,18 @@
     //! Is there a pending selection to be made by CRS ID?
     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
     QString mCRSNameSelection;
 
     //! The CRS ID that wants to be selected on this widget
     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
     QSet<QString> mCrsFilter;
 



More information about the QGIS-commit mailing list