Skip to content
Permalink
Browse files

make color of new symbols random

git-svn-id: http://svn.osgeo.org/qgis/branches/symbology-ng-branch@11158 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Jul 23, 2009
1 parent f808b53 commit cac0f15e36c71a2f97c0d948c802d16d00c4f8e4
Showing with 9 additions and 3 deletions.
  1. +9 −3 src/core/symbology-ng/qgssymbolv2.cpp
@@ -14,6 +14,8 @@
#include <QPainter>
#include <QSize>

#include <cmath>

QgsSymbolV2::QgsSymbolV2(SymbolType type, QgsSymbolLayerV2List layers)
: mType(type), mLayers(layers)
{
@@ -43,13 +45,17 @@ QgsSymbolV2::~QgsSymbolV2()

QgsSymbolV2* QgsSymbolV2::defaultSymbol(QGis::GeometryType geomType)
{
QgsSymbolV2* s;
switch (geomType)
{
case QGis::Point: return new QgsMarkerSymbolV2();
case QGis::Line: return new QgsLineSymbolV2();
case QGis::Polygon: return new QgsFillSymbolV2();
case QGis::Point: s = new QgsMarkerSymbolV2(); break;
case QGis::Line: s = new QgsLineSymbolV2(); break;
case QGis::Polygon: s = new QgsFillSymbolV2(); break;
default: QgsDebugMsg("unknown layer's geometry type"); return NULL;
}

s->setColor( QColor::fromHsv(rand() % 360, 64 + rand() % 192, 128 + rand() % 128) );
return s;
}


0 comments on commit cac0f15

Please sign in to comment.
You can’t perform that action at this time.