Skip to content
Permalink
Browse files

add missing ui headers for gui includes for install and implement Qgs…

…ProjectionSelector::setSelectedEpsg()

git-svn-id: http://svn.osgeo.org/qgis/trunk@10093 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Feb 2, 2009
1 parent bacd648 commit 6f8d3109f3738fca6d3543df21b5fa39d990aa73
@@ -118,6 +118,11 @@ qgsprojectionselector.h
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
)


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

/**
@@ -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>

@@ -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 @@ QgsProjectionSelector::QgsProjectionSelector( QWidget* parent,
mProjListDone( FALSE ),
mUserProjListDone( FALSE ),
mCRSNameSelectionPending( FALSE ),
mCRSIDSelectionPending( FALSE )

mCRSIDSelectionPending( FALSE ),
mEPSGIDSelectionPending( FALSE )
{
setupUi( this );
connect( lstCoordinateSystems, SIGNAL( currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ),
@@ -94,6 +94,10 @@ void QgsProjectionSelector::showEvent( QShowEvent * theEvent )
{
applyCRSIDSelection();
}
if ( mEPSGIDSelectionPending )
{
applyEPSGIDSelection();
}

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

if ( isVisible() )
{
@@ -184,6 +189,7 @@ void QgsProjectionSelector::setSelectedCrsId( long theCRSID )
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::setSelectedCrsId( long theCRSID )

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::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()
{
if (
@@ -11,7 +11,7 @@
#ifndef QGSCRSSELECTOR_H
#define QGSCRSSELECTOR_H

#include "ui_qgsprojectionselectorbase.h"
#include <ui_qgsprojectionselectorbase.h>

#include <QSet>

@@ -151,10 +151,22 @@ class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectio
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 @@ class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectio
//! 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;

0 comments on commit 6f8d310

Please sign in to comment.
You can’t perform that action at this time.