Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make sure we have a color ramp when creating categories/ranges.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12160 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Nov 17, 2009
1 parent a5658a3 commit 25b2f95
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp
Expand Up @@ -12,6 +12,7 @@
#include "qgsvectorlayer.h"
#include "qgsvectordataprovider.h" // for uniqueValues

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

Expand Down Expand Up @@ -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 );

Expand Down
10 changes: 10 additions & 0 deletions src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
Expand Up @@ -11,6 +11,7 @@

#include "qgssymbolv2selectordialog.h"

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

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 25b2f95

Please sign in to comment.