6767#include < QVector>
6868
6969QgsRasterLayerProperties::QgsRasterLayerProperties ( QgsMapLayer* lyr, QgsMapCanvas* theCanvas, QWidget *parent, Qt::WindowFlags fl )
70- : QgsOptionsDialogBase( " RasterLayerProperties" , parent, fl ),
70+ : QgsOptionsDialogBase( " RasterLayerProperties" , parent, fl )
7171 // Constant that signals property not used.
72- TRSTRING_NOT_SET( tr( " Not Set" ) ),
73- mRasterLayer( qobject_cast<QgsRasterLayer *>( lyr ) ), mRendererWidget( 0 )
72+ , TRSTRING_NOT_SET( tr( " Not Set" ) )
73+ , mRasterLayer( qobject_cast<QgsRasterLayer *>( lyr ) ), mRendererWidget( 0 )
74+ , mMapCanvas( theCanvas )
7475{
7576 mGrayMinimumMaximumEstimated = true ;
7677 mRGBMinimumMaximumEstimated = true ;
@@ -81,9 +82,6 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
8182 // and connecting QDialogButtonBox's accepted/rejected signals to dialog's accept/reject slots
8283 initOptionsBase ( false );
8384
84- mMaximumScaleIconLabel ->setPixmap ( QgsApplication::getThemePixmap ( " /mActionZoomIn.svg" ) );
85- mMinimumScaleIconLabel ->setPixmap ( QgsApplication::getThemePixmap ( " /mActionZoomOut.svg" ) );
86-
8785 connect ( this , SIGNAL ( accepted () ), this , SLOT ( apply () ) );
8886 connect ( buttonBox->button ( QDialogButtonBox::Apply ), SIGNAL ( clicked () ), this , SLOT ( apply () ) );
8987
@@ -116,17 +114,9 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
116114 connect ( lbxPyramidResolutions, SIGNAL ( itemSelectionChanged () ), this , SLOT ( toggleBuildPyramidsButton () ) );
117115
118116 // set up the scale based layer visibility stuff....
117+ mScaleRangeWidget ->setMapCanvas ( mMapCanvas );
119118 chkUseScaleDependentRendering->setChecked ( lyr->hasScaleBasedVisibility () );
120- bool projectScales = QgsProject::instance ()->readBoolEntry ( " Scales" , " /useProjectScales" );
121- if ( projectScales )
122- {
123- QStringList scalesList = QgsProject::instance ()->readListEntry ( " Scales" , " /ScalesList" );
124- cbMinimumScale->updateScales ( scalesList );
125- cbMaximumScale->updateScales ( scalesList );
126- }
127- cbMinimumScale->setScale ( 1.0 / lyr->minimumScale () );
128- cbMaximumScale->setScale ( 1.0 / lyr->maximumScale () );
129-
119+ mScaleRangeWidget ->setScaleRange ( 1.0 / lyr->maximumScale (), 1.0 / lyr->minimumScale () ); // caution: layer uses scale denoms, widget uses true scales
130120
131121 leNoDataValue->setValidator ( new QDoubleValidator ( -std::numeric_limits<double >::max (), std::numeric_limits<double >::max (), 1000 , this ) );
132122
@@ -141,7 +131,6 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
141131 pbnImportTransparentPixelValues->setIcon ( QgsApplication::getThemeIcon ( " /mActionFileOpen.svg" ) );
142132 pbnExportTransparentPixelValues->setIcon ( QgsApplication::getThemeIcon ( " /mActionFileSave.svg" ) );
143133
144- mMapCanvas = theCanvas;
145134 mPixelSelectorTool = 0 ;
146135 if ( mMapCanvas )
147136 {
@@ -856,8 +845,9 @@ void QgsRasterLayerProperties::apply()
856845
857846 // set up the scale based layer visibility stuff....
858847 mRasterLayer ->toggleScaleBasedVisibility ( chkUseScaleDependentRendering->isChecked () );
859- mRasterLayer ->setMinimumScale ( 1.0 / cbMinimumScale->scale () );
860- mRasterLayer ->setMaximumScale ( 1.0 / cbMaximumScale->scale () );
848+ // caution: layer uses scale denoms, widget uses true scales
849+ mRasterLayer ->setMaximumScale ( 1.0 / mScaleRangeWidget ->minimumScale () );
850+ mRasterLayer ->setMinimumScale ( 1.0 / mScaleRangeWidget ->maximumScale () );
861851
862852 // update the legend pixmap
863853 // pixmapLegend->setPixmap( mRasterLayer->legendAsPixmap() );
@@ -1722,16 +1712,6 @@ void QgsRasterLayerProperties::toggleBuildPyramidsButton()
17221712 }
17231713}
17241714
1725- void QgsRasterLayerProperties::on_mMinimumScaleSetCurrentPushButton_clicked ()
1726- {
1727- cbMinimumScale->setScale ( 1.0 / QgisApp::instance ()->mapCanvas ()->mapSettings ().scale () );
1728- }
1729-
1730- void QgsRasterLayerProperties::on_mMaximumScaleSetCurrentPushButton_clicked ()
1731- {
1732- cbMaximumScale->setScale ( 1.0 / QgisApp::instance ()->mapCanvas ()->mapSettings ().scale () );
1733- }
1734-
17351715void QgsRasterLayerProperties::on_mResetColorRenderingBtn_clicked ()
17361716{
17371717 mBlendModeComboBox ->setBlendMode ( QPainter::CompositionMode_SourceOver );
0 commit comments