Skip to content

Commit f35b051

Browse files
author
mhugent
committed
Added hardcoded markers 'triangle' and 'star' to have all of the well-known symbols
git-svn-id: http://svn.osgeo.org/qgis/trunk@5499 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 32c9908 commit f35b051

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/core/qgsmarkercatalogue.cpp

+29-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ QgsMarkerCatalogue::QgsMarkerCatalogue()
4444
mList.append ( "hard:diamond" );
4545
mList.append ( "hard:cross" );
4646
mList.append ( "hard:cross2" );
47+
mList.append ( "hard:triangle");
48+
mList.append ( "hard:star");
4749

4850
// SVG
4951
QString svgPath = QgsApplication::svgPath();
@@ -187,7 +189,6 @@ QPixmap QgsMarkerCatalogue::hardMarker ( QString name, int s, QPen pen, QBrush b
187189

188190
if ( name == "circle" )
189191
{
190-
std::cout << "Drawing circle of " << size << std::endl;
191192
myPainter.drawEllipse(0, 0, size, size);
192193
}
193194
else if ( name == "rectangle" )
@@ -244,6 +245,33 @@ QPixmap QgsMarkerCatalogue::hardMarker ( QString name, int s, QPen pen, QBrush b
244245

245246
box.setRect ( -addwidth, -addwidth, size + 2*addwidth, size + 2*addwidth );
246247
}
248+
else if ( name == "triangle")
249+
{
250+
QPolygon pa(3);
251+
pa.setPoint ( 0, 0, size);
252+
pa.setPoint ( 1, size, size);
253+
pa.setPoint ( 2, half, 0);
254+
myPainter.drawPolygon ( pa );
255+
}
256+
else if (name == "star")
257+
{
258+
int oneThird = (int)(floor(size/3+0.5));
259+
int twoThird = (int)(floor(size/3*2+0.5));
260+
int oneQuarter = (int)(floor(size/4+0.5));
261+
int threeQuarter = (int)(floor(size/4*3+0.5));
262+
QPolygon pa(10);
263+
pa.setPoint(0, half, 0);
264+
pa.setPoint(1, oneThird, oneThird);
265+
pa.setPoint(2, 0, oneThird);
266+
pa.setPoint(3, oneThird, half);
267+
pa.setPoint(4, 0, size);
268+
pa.setPoint(5, half, twoThird);
269+
pa.setPoint(6, size, size);
270+
pa.setPoint(7, twoThird, half);
271+
pa.setPoint(8, size, oneThird);
272+
pa.setPoint(9, twoThird, oneThird);
273+
myPainter.drawPolygon ( pa );
274+
}
247275
if ( name == "cross" || name == "cross2" )
248276
{
249277
picture.setBoundingRect ( box );

0 commit comments

Comments
 (0)