Skip to content

Commit

Permalink
make color of new symbols random
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/branches/symbology-ng-branch@11158 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jul 23, 2009
1 parent f808b53 commit cac0f15
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/core/symbology-ng/qgssymbolv2.cpp
Expand Up @@ -14,6 +14,8 @@
#include <QPainter>
#include <QSize>

#include <cmath>

QgsSymbolV2::QgsSymbolV2(SymbolType type, QgsSymbolLayerV2List layers)
: mType(type), mLayers(layers)
{
Expand Down Expand Up @@ -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;
}


Expand Down

0 comments on commit cac0f15

Please sign in to comment.