Skip to content
Permalink
Browse files

Make sure we have a color ramp when creating categories/ranges.

git-svn-id: http://svn.osgeo.org/qgis/trunk@12160 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Nov 17, 2009
1 parent 52eaabc commit 1d626d42c3b60827d24e6a40f204ba8040fedc2f
@@ -12,6 +12,7 @@
#include "qgsvectorlayer.h"
#include "qgsvectordataprovider.h" // for uniqueValues

#include <QMessageBox>
#include <QStandardItemModel>
#include <QStandardItem>

@@ -256,6 +257,15 @@ void QgsCategorizedSymbolRendererV2Widget::addCategories()
else
ramp = mStyle->colorRamp( rampName );

if ( ramp == NULL )
{
if ( cboCategorizedColorRamp->count() == 0 )
QMessageBox::critical( this, tr("Error"), tr("There are no available color ramps. You can add them in Style Manager.") );
else
QMessageBox::critical( this, tr("Error"), tr("The selected color ramp is not available.") );
return;
}

QgsCategoryList cats;
_createCategories( cats, unique_vals, mCategorizedSymbol, ramp );

@@ -11,6 +11,7 @@

#include "qgssymbolv2selectordialog.h"

#include <QMessageBox>
#include <QStandardItemModel>
#include <QStandardItem>

@@ -157,6 +158,15 @@ void QgsGraduatedSymbolRendererV2Widget::classifyGraduated()
else
ramp = mStyle->colorRamp( rampName );

if ( ramp == NULL )
{
if ( cboGraduatedColorRamp->count() == 0 )
QMessageBox::critical( this, tr("Error"), tr("There are no available color ramps. You can add them in Style Manager.") );
else
QMessageBox::critical( this, tr("Error"), tr("The selected color ramp is not available.") );
return;
}

QgsGraduatedSymbolRendererV2::Mode mode;
if (cboGraduatedMode->currentIndex() == 0)
mode = QgsGraduatedSymbolRendererV2::EqualInterval;

0 comments on commit 1d626d4

Please sign in to comment.