1919
2020#include " qgsmaptopixel.h"
2121#include " qgsmapcanvas.h"
22+ #include " qgsmaprenderer.h"
2223#include " qgslogger.h"
2324#include " qgsapplication.h"
2425#include " qgisapp.h"
3334#include " qgsmaplayerregistry.h"
3435#include " qgscontrastenhancement.h"
3536#include " qgsrastertransparency.h"
37+ #include " qgsmaptoolemitpoint.h"
3638
3739#include < QTableWidgetItem>
3840#include < QHeaderView>
@@ -205,8 +207,8 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
205207 mPixelSelectorTool = 0 ;
206208 if ( mMapCanvas )
207209 {
208- mPixelSelectorTool = new QgsPixelSelectorTool ( theCanvas );
209- connect ( mPixelSelectorTool , SIGNAL ( pixelSelected ( int , int ) ), this , SLOT ( pixelSelected ( int , int ) ) );
210+ mPixelSelectorTool = new QgsMapToolEmitPoint ( theCanvas );
211+ connect ( mPixelSelectorTool , SIGNAL ( canvasClicked ( const QgsPoint&, Qt::MouseButton ) ), this , SLOT ( pixelSelected ( const QgsPoint& ) ) );
210212 }
211213 else
212214 {
@@ -2230,7 +2232,7 @@ void QgsRasterLayerProperties::on_rbtnThreeBandStdDev_toggled( bool theState )
22302232 sboxThreeBandStdDev->setValue ( mDefaultStandardDeviation );
22312233}
22322234
2233- void QgsRasterLayerProperties::pixelSelected ( int x, int y )
2235+ void QgsRasterLayerProperties::pixelSelected ( const QgsPoint& canvasPoint )
22342236{
22352237 // PixelSelectorTool has registered a mouse click on the canvas, so bring the dialog back to the front
22362238 raise ();
@@ -2242,7 +2244,7 @@ void QgsRasterLayerProperties::pixelSelected( int x, int y )
22422244 {
22432245 QMap< QString, QString > myPixelMap;
22442246 mMapCanvas ->unsetMapTool ( mPixelSelectorTool );
2245- mRasterLayer ->identify ( mMapCanvas ->getCoordinateTransform ( )->toMapCoordinates ( x, y ), myPixelMap );
2247+ mRasterLayer ->identify ( mMapCanvas ->mapRenderer ( )->mapToLayerCoordinates ( mRasterLayer , canvasPoint ), myPixelMap );
22462248 if ( tableTransparency->columnCount () == 2 )
22472249 {
22482250 QString myValue = myPixelMap[ mRasterLayer ->grayBandName ()];
@@ -3002,20 +3004,6 @@ void QgsRasterLayerProperties::on_pbnSaveStyleAs_clicked()
30023004 }
30033005}
30043006
3005- QgsPixelSelectorTool::QgsPixelSelectorTool ( QgsMapCanvas* theCanvas ) : QgsMapTool( theCanvas )
3006- {
3007- mMapCanvas = theCanvas;
3008- }
3009-
3010- QgsPixelSelectorTool::~QgsPixelSelectorTool ()
3011- {
3012- }
3013-
3014- void QgsPixelSelectorTool::canvasReleaseEvent ( QMouseEvent* theMouseEvent )
3015- {
3016- emit pixelSelected ( theMouseEvent->x ( ), theMouseEvent->y ( ) );
3017- }
3018-
30193007void QgsRasterLayerProperties::on_btnResetNull_clicked ( )
30203008{
30213009 // If reset NoDataValue is checked do this first, will ignore what ever is in the LineEdit
0 commit comments