Skip to content

Commit cac0f15

Browse files
author
wonder
committed
make color of new symbols random
git-svn-id: http://svn.osgeo.org/qgis/branches/symbology-ng-branch@11158 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent f808b53 commit cac0f15

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/core/symbology-ng/qgssymbolv2.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include <QPainter>
1515
#include <QSize>
1616

17+
#include <cmath>
18+
1719
QgsSymbolV2::QgsSymbolV2(SymbolType type, QgsSymbolLayerV2List layers)
1820
: mType(type), mLayers(layers)
1921
{
@@ -43,13 +45,17 @@ QgsSymbolV2::~QgsSymbolV2()
4345

4446
QgsSymbolV2* QgsSymbolV2::defaultSymbol(QGis::GeometryType geomType)
4547
{
48+
QgsSymbolV2* s;
4649
switch (geomType)
4750
{
48-
case QGis::Point: return new QgsMarkerSymbolV2();
49-
case QGis::Line: return new QgsLineSymbolV2();
50-
case QGis::Polygon: return new QgsFillSymbolV2();
51+
case QGis::Point: s = new QgsMarkerSymbolV2(); break;
52+
case QGis::Line: s = new QgsLineSymbolV2(); break;
53+
case QGis::Polygon: s = new QgsFillSymbolV2(); break;
5154
default: QgsDebugMsg("unknown layer's geometry type"); return NULL;
5255
}
56+
57+
s->setColor( QColor::fromHsv(rand() % 360, 64 + rand() % 192, 128 + rand() % 128) );
58+
return s;
5359
}
5460

5561

0 commit comments

Comments
 (0)