Skip to content

Commit

Permalink
hardcode values for pentagon, hexagon, and equilateral triangle
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn authored and nyalldawson committed Apr 13, 2016
1 parent ef77e19 commit ecc85a9
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
Expand Up @@ -365,17 +365,34 @@ bool QgsSimpleMarkerSymbolLayerV2::prepareShape( const QString& name, QPolygonF
}
else if ( name == "pentagon" )
{
/* angular-representation of hardcoded values used
polygon << QPointF( sin( DEG2RAD( 288.0 ) ), - cos( DEG2RAD( 288.0 ) ) )
<< QPointF( sin( DEG2RAD( 216.0 ) ), - cos( DEG2RAD( 216.0 ) ) )
<< QPointF( sin( DEG2RAD( 144.0 ) ), - cos( DEG2RAD( 144.0 ) ) )
<< QPointF( sin( DEG2RAD( 72.0 ) ), - cos( DEG2RAD( 72.0 ) ) )
<< QPointF( 0, -1 ); */
polygon << QPointF( -0.9511, -0.3090 )
<< QPointF( -0.5878, 0.8090 )
<< QPointF( 0.5878, 0.8090 )
<< QPointF( 0.9511, -0.3090 )
<< QPointF( 0, -1 );
return true;
}
else if ( name == "hexagon" )
{
polygon << QPointF( -1, 0.5 ) << QPointF( 0, 1 ) << QPointF( 1, 0.5 )
<< QPointF( 1, -0.5 ) << QPointF( 0, -1 ) << QPointF( -1, -0.5 );
/* angular-representation of hardcoded values used
polygon << QPointF( sin( DEG2RAD( 300.0 ) ), - cos( DEG2RAD( 300.0 ) ) )
<< QPointF( sin( DEG2RAD( 240.0 ) ), - cos( DEG2RAD( 240.0 ) ) )
<< QPointF( sin( DEG2RAD( 180.0 ) ), - cos( DEG2RAD( 180.0 ) ) )
<< QPointF( sin( DEG2RAD( 120.0 ) ), - cos( DEG2RAD( 120.0 ) ) )
<< QPointF( sin( DEG2RAD( 60.0 ) ), - cos( DEG2RAD( 60.0 ) ) )
<< QPointF( 0, -1 ); */
polygon << QPointF( -0.8660, -0.5 )
<< QPointF( -0.8660, 0.5 )
<< QPointF( 0, 1 )
<< QPointF( 0.8660, 0.5 )
<< QPointF( 0.8660, -0.5 )
<< QPointF( 0, -1 );
return true;
}
else if ( name == "triangle" )
Expand All @@ -385,8 +402,12 @@ bool QgsSimpleMarkerSymbolLayerV2::prepareShape( const QString& name, QPolygonF
}
else if ( name == "equilateral_triangle" )
{
/* angular-representation of hardcoded values used
polygon << QPointF( sin( DEG2RAD( 240.0 ) ), - cos( DEG2RAD( 240.0 ) ) )
<< QPointF( sin( DEG2RAD( 120.0 ) ), - cos( DEG2RAD( 120.0 ) ) )
<< QPointF( 0, -1 ); */
polygon << QPointF( -0.8660, 0.5 )
<< QPointF( 0.8660, 0.5 )
<< QPointF( 0, -1 );
return true;
}
Expand Down

1 comment on commit ecc85a9

@nirvn
Copy link
Contributor Author

@nirvn nirvn commented on ecc85a9 Apr 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nyalldawson , thanks. I ❤️ hexagons:
hexagon

Please sign in to comment.