Skip to content
Permalink
Browse files

add histogram zoom in/out

  • Loading branch information
etiennesky committed Jul 14, 2012
1 parent 4a53350 commit 6b474fe563d6051d9bcb2237f91f9ae2f5852059
@@ -199,6 +199,7 @@
<file>themes/default/mIconWms.png</file>
<file>themes/default/mIconWmsLayer.png</file>
<file>themes/default/mIconWarn.png</file>
<file>themes/default/mIconZoom.png</file>
<file>themes/default/mIconZip.png</file>
<file>themes/default/mMapserverExport.png</file>
<file>themes/default/plugin.png</file>
Binary file not shown.
@@ -71,6 +71,7 @@
#include <qwt_plot_marker.h>
#include <qwt_plot_picker.h>
#include <qwt_picker_machine.h>
#include <qwt_plot_zoomer.h>

QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanvas* theCanvas, QWidget *parent, Qt::WFlags fl )
: QDialog( parent, fl ),
@@ -299,6 +300,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv

// histogram
mHistoPicker = NULL;
mHistoZoomer = NULL;
mHistoMarkerMin = NULL;
mHistoMarkerMax = NULL;
if ( tabPageHistogram->isEnabled() )
@@ -1392,10 +1394,21 @@ void QgsRasterLayerProperties::refreshHistogram()
connect( mHistoPicker, SIGNAL( selected( const QwtDoublePoint & ) ), this, SLOT( histoPickerSelected( const QwtDoublePoint & ) ) );
}

// plot zoomer
if ( ! mHistoZoomer )
{
mHistoZoomer = new QwtPlotZoomer( mpPlot->canvas() );
mHistoZoomer->setSelectionFlags( QwtPicker::RectSelection | QwtPicker::DragSelection );
mHistoZoomer->setTrackerMode( QwtPicker::AlwaysOff );
mHistoZoomer->setEnabled( true );
}

disconnect( mRasterLayer, SIGNAL( progressUpdate( int ) ), mHistogramProgress, SLOT( setValue( int ) ) );
// mHistogramProgress->hide();
stackedWidget2->setCurrentIndex( 0 );
mpPlot->canvas()->setCursor( Qt::ArrowCursor );
// mpPlot->canvas()->setCursor( Qt::ArrowCursor );
// icon from http://findicons.com/icon/169577/14_zoom?id=171427
mpPlot->canvas()->setCursor( QCursor( QgisApp::getThemePixmap( "/mIconZoom.png" ) ) );
on_cboHistoBand_currentIndexChanged( -1 );
QApplication::restoreOverrideCursor();
}
@@ -1777,6 +1790,8 @@ void QgsRasterLayerProperties::on_cboHistoBand_currentIndexChanged( int index )
mHistoPicker->setEnabled( false );
mHistoPicker->setRubberBandPen( QPen( mHistoColors.at( index + 1 ) ) );
}
if ( mHistoZoomer != NULL )
mHistoZoomer->setEnabled( true );
btnHistoMin->setEnabled( true );
btnHistoMax->setEnabled( true );

@@ -1989,6 +2004,8 @@ void QgsRasterLayerProperties::on_btnHistoMin_toggled()
btnHistoMax->setChecked( false );
QApplication::setOverrideCursor( Qt::PointingHandCursor );
}
if ( mHistoZoomer != NULL )
mHistoZoomer->setEnabled( ! btnHistoMax->isChecked() );
mHistoPicker->setEnabled( btnHistoMin->isChecked() );
}
}
@@ -2004,6 +2021,8 @@ void QgsRasterLayerProperties::on_btnHistoMax_toggled()
btnHistoMin->setChecked( false );
QApplication::setOverrideCursor( Qt::PointingHandCursor );
}
if ( mHistoZoomer != NULL )
mHistoZoomer->setEnabled( ! btnHistoMax->isChecked() );
mHistoPicker->setEnabled( btnHistoMax->isChecked() );
}
}
@@ -33,6 +33,7 @@ class QgsRasterRenderer;
class QgsRasterRendererWidget;
class QwtPlotPicker;
class QwtPlotMarker;
class QwtPlotZoomer;

/**Property sheet for a raster map layer
*@author Tim Sutton
@@ -176,6 +177,7 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope

// histogram
QwtPlotPicker* mHistoPicker;
QwtPlotZoomer* mHistoZoomer;
QwtPlotMarker* mHistoMarkerMin;
QwtPlotMarker* mHistoMarkerMax;
double mHistoMin;

0 comments on commit 6b474fe

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