Skip to content
Permalink
Browse files
fix: #3688
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15656 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
stopa85 committed Apr 1, 2011
1 parent 5f7561c commit 1c41b4002d1461b4832397597db540f9324c1419
Showing with 9 additions and 44 deletions.
  1. +6 −18 src/app/qgsrasterlayerproperties.cpp
  2. +3 −26 src/app/qgsrasterlayerproperties.h
@@ -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 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
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 @@ void QgsRasterLayerProperties::on_rbtnThreeBandStdDev_toggled( bool theState )
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 @@ void QgsRasterLayerProperties::pixelSelected( int x, int y )
{
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 @@ void QgsRasterLayerProperties::on_pbnSaveStyleAs_clicked()
}
}

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
@@ -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 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
/** \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 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
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

0 comments on commit 1c41b40

Please sign in to comment.