Skip to content

Commit ecc85a9

Browse files
nirvnnyalldawson
authored andcommitted
hardcode values for pentagon, hexagon, and equilateral triangle
1 parent ef77e19 commit ecc85a9

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/core/symbology-ng/qgsmarkersymbollayerv2.cpp

+23-2
Original file line numberDiff line numberDiff line change
@@ -365,17 +365,34 @@ bool QgsSimpleMarkerSymbolLayerV2::prepareShape( const QString& name, QPolygonF
365365
}
366366
else if ( name == "pentagon" )
367367
{
368+
/* angular-representation of hardcoded values used
368369
polygon << QPointF( sin( DEG2RAD( 288.0 ) ), - cos( DEG2RAD( 288.0 ) ) )
369370
<< QPointF( sin( DEG2RAD( 216.0 ) ), - cos( DEG2RAD( 216.0 ) ) )
370371
<< QPointF( sin( DEG2RAD( 144.0 ) ), - cos( DEG2RAD( 144.0 ) ) )
371372
<< QPointF( sin( DEG2RAD( 72.0 ) ), - cos( DEG2RAD( 72.0 ) ) )
373+
<< QPointF( 0, -1 ); */
374+
polygon << QPointF( -0.9511, -0.3090 )
375+
<< QPointF( -0.5878, 0.8090 )
376+
<< QPointF( 0.5878, 0.8090 )
377+
<< QPointF( 0.9511, -0.3090 )
372378
<< QPointF( 0, -1 );
373379
return true;
374380
}
375381
else if ( name == "hexagon" )
376382
{
377-
polygon << QPointF( -1, 0.5 ) << QPointF( 0, 1 ) << QPointF( 1, 0.5 )
378-
<< QPointF( 1, -0.5 ) << QPointF( 0, -1 ) << QPointF( -1, -0.5 );
383+
/* angular-representation of hardcoded values used
384+
polygon << QPointF( sin( DEG2RAD( 300.0 ) ), - cos( DEG2RAD( 300.0 ) ) )
385+
<< QPointF( sin( DEG2RAD( 240.0 ) ), - cos( DEG2RAD( 240.0 ) ) )
386+
<< QPointF( sin( DEG2RAD( 180.0 ) ), - cos( DEG2RAD( 180.0 ) ) )
387+
<< QPointF( sin( DEG2RAD( 120.0 ) ), - cos( DEG2RAD( 120.0 ) ) )
388+
<< QPointF( sin( DEG2RAD( 60.0 ) ), - cos( DEG2RAD( 60.0 ) ) )
389+
<< QPointF( 0, -1 ); */
390+
polygon << QPointF( -0.8660, -0.5 )
391+
<< QPointF( -0.8660, 0.5 )
392+
<< QPointF( 0, 1 )
393+
<< QPointF( 0.8660, 0.5 )
394+
<< QPointF( 0.8660, -0.5 )
395+
<< QPointF( 0, -1 );
379396
return true;
380397
}
381398
else if ( name == "triangle" )
@@ -385,8 +402,12 @@ bool QgsSimpleMarkerSymbolLayerV2::prepareShape( const QString& name, QPolygonF
385402
}
386403
else if ( name == "equilateral_triangle" )
387404
{
405+
/* angular-representation of hardcoded values used
388406
polygon << QPointF( sin( DEG2RAD( 240.0 ) ), - cos( DEG2RAD( 240.0 ) ) )
389407
<< QPointF( sin( DEG2RAD( 120.0 ) ), - cos( DEG2RAD( 120.0 ) ) )
408+
<< QPointF( 0, -1 ); */
409+
polygon << QPointF( -0.8660, 0.5 )
410+
<< QPointF( 0.8660, 0.5 )
390411
<< QPointF( 0, -1 );
391412
return true;
392413
}

0 commit comments

Comments
 (0)