Skip to content

Commit a1eca86

Browse files
committedMar 23, 2012
Clean up raster properties dialog
1 parent 748d857 commit a1eca86

File tree

6 files changed

+197
-3020
lines changed

6 files changed

+197
-3020
lines changed
 

‎src/app/qgsrasterlayerproperties.cpp

Lines changed: 172 additions & 1810 deletions
Large diffs are not rendered by default.

‎src/app/qgsrasterlayerproperties.h

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -75,66 +75,15 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
7575
/** \brief slot executed when user presses "Remove Selected Row" button on the transparency page */
7676
void on_pbnRemoveSelectedRow_clicked();
7777
/** \brief slot executed when the single band radio button is pressed. */
78-
void on_rbtnSingleBand_toggled( bool );
79-
/** \brief slot executed when the single band min max radio button is pressed. */
80-
void on_rbtnSingleBandMinMax_toggled( bool );
81-
/** \brief slot executed when the single band standard deviation radio button is pressed. */
82-
void on_rbtnSingleBandStdDev_toggled( bool );
83-
/** \brief slot executed when the three band radio button is pressed. */
84-
void on_rbtnThreeBand_toggled( bool );
85-
/** \brief slot executed when the three band min max radio button is pressed. */
86-
void on_rbtnThreeBandMinMax_toggled( bool );
87-
/** \brief slot executed when the three band standard deviation radio button is pressed. */
88-
void on_rbtnThreeBandStdDev_toggled( bool );
8978
/** \brief slot executed when the reset null value to file default icon is selected */
9079
void on_btnResetNull_clicked( );
9180

9281
void pixelSelected( const QgsPoint& );
93-
/** \brief this slot clears min max values from gui */
94-
void sboxSingleBandStdDev_valueChanged( double );
95-
/** \brief this slot clears min max values from gui */
96-
void sboxThreeBandStdDev_valueChanged( double );
9782
/** \brief slot executed when the transparency level changes. */
9883
void sliderTransparency_valueChanged( int );
99-
/** \brief this slot sets StdDev switch box to 0.00 when user enters min max values */
100-
void userDefinedMinMax_textEdited( QString );
10184

10285
private slots:
10386
void on_mRenderTypeComboBox_currentIndexChanged( int index );
104-
/** This slow handles necessary interface modifications (i.e. loading min max values) */
105-
void on_cboBlue_currentIndexChanged( const QString& );
106-
/** This slow handles necessary interface modifications (i.e. loading min max values) */
107-
void on_cboGray_currentIndexChanged( const QString& );
108-
/** This slow handles necessary interface modifications (i.e. loading min max values) */
109-
void on_cboGreen_currentIndexChanged( const QString& );
110-
/** This slow handles necessary interface modifications (i.e. loading min max values) */
111-
void on_cboRed_currentIndexChanged( const QString& );
112-
/** This slot handles necessary interface modifications based when color map selected changes */
113-
void on_cboxColorMap_currentIndexChanged( const QString& );
114-
/** This slot calculates classification values and colors for the tree widget on the colormap tab */
115-
void on_mClassifyButton_clicked();
116-
/** This slot deletes the current class from the tree widget on the colormap tab */
117-
void on_mDeleteEntryButton_clicked();
118-
/** Callback for double clicks on the colormap entry widget */
119-
void handleColormapTreeWidgetDoubleClick( QTreeWidgetItem* item, int column );
120-
/** This slot adds a new row to the color map table */
121-
void on_pbtnAddColorMapEntry_clicked();
122-
/** This slots saves the current color map to a file */
123-
void on_pbtnExportColorMapToFile_clicked();
124-
/** This slots loads the current color map from a band */
125-
void on_pbtnLoadColorMapFromBand_clicked();
126-
/** This slots loads the current color map from a file */
127-
void on_pbtnLoadColorMapFromFile_clicked();
128-
/** This slot loads the minimum and maximum values from the raster band and updates the gui */
129-
void on_pbtnLoadMinMax_clicked();
130-
/** This slot sets the default band combination variable to current band combination */
131-
void on_pbtnMakeBandCombinationDefault_clicked();
132-
/** This slot sets the default contrast enhancement variable to current contrast enhancement algorithm */
133-
void on_pbtnMakeContrastEnhancementAlgorithmDefault_clicked();
134-
/** This slot sets the standard deviation default */
135-
void on_pbtnMakeStandardDeviationDefault_clicked();
136-
/** This slot will sort the color map in ascending order */
137-
void on_pbtnSortColorMap_clicked();
13887
/** Load the default style when appropriate button is pressed. */
13988
void on_pbnLoadDefaultStyle_clicked();
14089
/** Save the default style when appropriate button is pressed. */
@@ -169,9 +118,6 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
169118
int mDefaultGreenBand;
170119
int mDefaultBlueBand;
171120

172-
/** \brief Internal flag used to short circuit signal loop between min max field and stdDev spin box */
173-
bool ignoreSpinBoxEvent;
174-
175121
/** \brief Flag to indicate if Gray minimum maximum values are actual minimum maximum values */
176122
bool mGrayMinimumMaximumEstimated;
177123

@@ -190,21 +136,12 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
190136

191137
QgsRasterRendererWidget* mRendererWidget;
192138

193-
/** \brief Clear current color map table and population with values from new list */
194-
void populateColorMapTable( const QList<QgsColorRampShader::ColorRampItem>& );
195-
196139
/** \brief Clear the current transparency table and populate the table with the correct types for current drawing mode and data type*/
197140
void populateTransparencyTable();
198141

199-
/** \brief Set the message indicating if any min max values are estimates */
200-
void setMinimumMaximumEstimateWarning();
201-
202142
/**Restores the state of the colormap tab*/
203143
void syncColormapTab();
204144

205-
/** \brief Verify values in custom min max line edits */
206-
bool validUserDefinedMinMax();
207-
208145
//@TODO we should move these gradient generators somewhere more generic
209146
//so they can be used generically throughut the app
210147
QLinearGradient greenGradient();

‎src/core/raster/qgsrasterlayer.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,18 @@ void QgsRasterLayer::setRendererForDrawingStyle( const DrawingStyle & theDrawin
762762
}
763763

764764
renderer->setOpacity( mTransparencyLevel / 255.0 );
765-
renderer->setRasterTransparency( &mRasterTransparency );
765+
766+
QgsRasterTransparency* tr = new QgsRasterTransparency(); //renderer takes ownership
767+
if ( mDataProvider->bandCount() == 1 )
768+
{
769+
tr->setTransparentSingleValuePixelList( mRasterTransparency.transparentSingleValuePixelList() );
770+
}
771+
else if ( mDataProvider->bandCount() == 3 )
772+
{
773+
tr->setTransparentThreeValuePixelList( mRasterTransparency.transparentThreeValuePixelList() );
774+
}
775+
renderer->setRasterTransparency( tr );
776+
766777
if ( mTransparencyBandName != TRSTRING_NOT_SET )
767778
{
768779
int tBand = bandNumber( mTransparencyBandName );

‎src/core/raster/qgsrasterrenderer.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ QgsRasterRenderer::~QgsRasterRenderer()
4141

4242
delete mZoomedInResampler;
4343
delete mZoomedOutResampler;
44+
delete mRasterTransparency;
4445
}
4546

4647
void QgsRasterRenderer::setZoomedInResampler( QgsRasterResampler* r )
@@ -223,6 +224,12 @@ bool QgsRasterRenderer::usesTransparency( QgsCoordinateReferenceSystem& srcSRS,
223224
return ( mAlphaBand > 0 || ( mRasterTransparency && !mRasterTransparency->isEmpty( mProvider->noDataValue() ) ) || !doubleNear( mOpacity, 1.0 ) );
224225
}
225226

227+
void QgsRasterRenderer::setRasterTransparency( QgsRasterTransparency* t )
228+
{
229+
delete mRasterTransparency;
230+
mRasterTransparency = t;
231+
}
232+
226233
void QgsRasterRenderer::drawImage( QPainter* p, QgsRasterViewPort* viewPort, const QImage& img, int topLeftCol, int topLeftRow,
227234
int nCols, int nRows, double oversamplingX, double oversamplingY ) const
228235
{

‎src/core/raster/qgsrasterrenderer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class QgsRasterRenderer
5454
void setOpacity( double opacity ) { mOpacity = opacity; }
5555
double opacity() const { return mOpacity; }
5656

57-
void setRasterTransparency( QgsRasterTransparency* t ) { mRasterTransparency = t; }
57+
void setRasterTransparency( QgsRasterTransparency* t );
5858
const QgsRasterTransparency* rasterTransparency() const { return mRasterTransparency; }
5959

6060
void setAlphaBand( int band ) { mAlphaBand = band; }

‎src/ui/qgsrasterlayerpropertiesbase.ui

Lines changed: 5 additions & 1145 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.