[QGIS Commit] r15656 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Fri Apr 1 07:09:22 EDT 2011
Author: stopa85
Date: 2011-04-01 04:09:22 -0700 (Fri, 01 Apr 2011)
New Revision: 15656
Modified:
trunk/qgis/src/app/qgsrasterlayerproperties.cpp
trunk/qgis/src/app/qgsrasterlayerproperties.h
Log:
fix: #3688
Modified: trunk/qgis/src/app/qgsrasterlayerproperties.cpp
===================================================================
--- trunk/qgis/src/app/qgsrasterlayerproperties.cpp 2011-03-31 15:30:24 UTC (rev 15655)
+++ trunk/qgis/src/app/qgsrasterlayerproperties.cpp 2011-04-01 11:09:22 UTC (rev 15656)
@@ -19,6 +19,7 @@
#include "qgsmaptopixel.h"
#include "qgsmapcanvas.h"
+#include "qgsmaprenderer.h"
#include "qgslogger.h"
#include "qgsapplication.h"
#include "qgisapp.h"
@@ -33,6 +34,7 @@
#include "qgsmaplayerregistry.h"
#include "qgscontrastenhancement.h"
#include "qgsrastertransparency.h"
+#include "qgsmaptoolemitpoint.h"
#include <QTableWidgetItem>
#include <QHeaderView>
@@ -205,8 +207,8 @@
mPixelSelectorTool = 0;
if ( mMapCanvas )
{
- mPixelSelectorTool = new QgsPixelSelectorTool( theCanvas );
- connect( mPixelSelectorTool, SIGNAL( pixelSelected( int, int ) ), this, SLOT( pixelSelected( int, int ) ) );
+ mPixelSelectorTool = new QgsMapToolEmitPoint( theCanvas );
+ connect( mPixelSelectorTool, SIGNAL( canvasClicked( const QgsPoint&, Qt::MouseButton ) ), this, SLOT( pixelSelected( const QgsPoint& ) ) );
}
else
{
@@ -2230,7 +2232,7 @@
sboxThreeBandStdDev->setValue( mDefaultStandardDeviation );
}
-void QgsRasterLayerProperties::pixelSelected( int x, int y )
+void QgsRasterLayerProperties::pixelSelected( const QgsPoint& canvasPoint )
{
//PixelSelectorTool has registered a mouse click on the canvas, so bring the dialog back to the front
raise();
@@ -2242,7 +2244,7 @@
{
QMap< QString, QString > myPixelMap;
mMapCanvas->unsetMapTool( mPixelSelectorTool );
- mRasterLayer->identify( mMapCanvas->getCoordinateTransform( )->toMapCoordinates( x, y ), myPixelMap );
+ mRasterLayer->identify( mMapCanvas->mapRenderer()->mapToLayerCoordinates( mRasterLayer, canvasPoint ), myPixelMap );
if ( tableTransparency->columnCount() == 2 )
{
QString myValue = myPixelMap[ mRasterLayer->grayBandName()];
@@ -3002,20 +3004,6 @@
}
}
-QgsPixelSelectorTool::QgsPixelSelectorTool( QgsMapCanvas* theCanvas ) : QgsMapTool( theCanvas )
-{
- mMapCanvas = theCanvas;
-}
-
-QgsPixelSelectorTool::~QgsPixelSelectorTool()
-{
-}
-
-void QgsPixelSelectorTool::canvasReleaseEvent( QMouseEvent* theMouseEvent )
-{
- emit pixelSelected( theMouseEvent->x( ), theMouseEvent->y( ) );
-}
-
void QgsRasterLayerProperties::on_btnResetNull_clicked( )
{
//If reset NoDataValue is checked do this first, will ignore what ever is in the LineEdit
Modified: trunk/qgis/src/app/qgsrasterlayerproperties.h
===================================================================
--- trunk/qgis/src/app/qgsrasterlayerproperties.h 2011-03-31 15:30:24 UTC (rev 15655)
+++ trunk/qgis/src/app/qgsrasterlayerproperties.h 2011-04-01 11:09:22 UTC (rev 15656)
@@ -29,7 +29,7 @@
class QgsMapLayer;
class QgsMapCanvas;
class QgsRasterLayer;
-class QgsPixelSelectorTool;
+class QgsMapToolEmitPoint;
/**Property sheet for a raster map layer
*@author Tim Sutton
@@ -89,7 +89,7 @@
/** \brief slot executed when the reset null value to file default icon is selected */
void on_btnResetNull_clicked( );
- void pixelSelected( int x, int y );
+ void pixelSelected( const QgsPoint& );
/** \brief this slot clears min max values from gui */
void sboxSingleBandStdDev_valueChanged( double );
/** \brief this slot clears min max values from gui */
@@ -213,29 +213,6 @@
qreal mGradientWidth;
QgsMapCanvas* mMapCanvas;
- QgsPixelSelectorTool* mPixelSelectorTool;
+ QgsMapToolEmitPoint* mPixelSelectorTool;
};
-
-/**
- *Simple map tool for selecting pixels, specific to QgsRasterLayerProperties
- */
-class QgsPixelSelectorTool: public QgsMapTool
-{
- Q_OBJECT
-
- public:
- QgsPixelSelectorTool( QgsMapCanvas* );
- ~QgsPixelSelectorTool( );
-
- /** \brief Method to handle mouse release, i.e., select, event */
- void canvasReleaseEvent( QMouseEvent* theMouseEvent );
-
- signals:
- /** \brief Alter the listener ( raster properties dialog ) that a mouse click was registered */
- void pixelSelected( int x, int y );
-
- private:
- QgsMapCanvas * mMapCanvas;
-};
-
#endif
More information about the QGIS-commit
mailing list