Skip to content
Permalink
Browse files
Add 0 pointer for renderer widget in case of singleband data
  • Loading branch information
mhugent committed Mar 24, 2012
1 parent ee06512 commit e3ce0338fe06a7c2257d866902c0dd27d20fbc5e
Showing with 12 additions and 6 deletions.
  1. +9 −6 src/app/qgsrasterlayerproperties.cpp
  2. +3 −0 src/core/raster/qgsrasterrendererregistry.cpp
@@ -97,11 +97,6 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
leNoDataValue->setValidator( new QDoubleValidator( -std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), 1000, this ) );

// build GUI components

//
// Set up the combo boxes that contain band lists using the qstring list generated above
//

QIcon myPyramidPixmap( QgisApp::getThemeIcon( "/mIconPyramid.png" ) );
QIcon myNoPyramidPixmap( QgisApp::getThemeIcon( "/mIconNoPyramid.png" ) );

@@ -554,7 +549,10 @@ void QgsRasterLayerProperties::apply()

//set renderer from widget
QgsRasterRendererWidget* rendererWidget = dynamic_cast<QgsRasterRendererWidget*>( mRendererStackedWidget->currentWidget() );
mRasterLayer->setRenderer( rendererWidget->renderer() );
if ( rendererWidget )
{
mRasterLayer->setRenderer( rendererWidget->renderer() );
}

//resampling
QgsRasterRenderer* rasterRenderer = mRasterLayer->renderer();
@@ -917,6 +915,11 @@ void QgsRasterLayerProperties::on_mRenderTypeComboBox_currentIndexChanged( int i
mRendererWidget = ( *rendererEntry.widgetCreateFunction )( mRasterLayer );
mRendererStackedWidget->addWidget( mRendererWidget );
}
else //single band color data renderer e.g. has no widget
{
delete mRendererWidget;
mRendererWidget = 0;
}
}
}

@@ -18,6 +18,7 @@
#include "qgsrasterrendererregistry.h"
#include "qgsmultibandcolorrenderer.h"
#include "qgspalettedrasterrenderer.h"
#include "qgssinglebandcolordatarenderer.h"
#include "qgssinglebandgrayrenderer.h"
#include "qgssinglebandpseudocolorrenderer.h"

@@ -53,6 +54,8 @@ QgsRasterRendererRegistry::QgsRasterRendererRegistry()
QgsSingleBandPseudoColorRenderer::create, 0 ) );
insert( QgsRasterRendererRegistryEntry( "singlebandgray", QObject::tr( "Singleband gray" ),
QgsSingleBandGrayRenderer::create, 0 ) );
insert( QgsRasterRendererRegistryEntry( "singlebandcolordata", QObject::tr( "Singleband color data" ),
QgsSingleBandColorDataRenderer::create, 0 ) );
}

QgsRasterRendererRegistry::~QgsRasterRendererRegistry()

0 comments on commit e3ce033

Please sign in to comment.