Skip to content

Commit

Permalink
[symbology] Add some more dispersed marker symbols (half/quarter squa…
Browse files Browse the repository at this point in the history
…res)
  • Loading branch information
nyalldawson committed Apr 4, 2016
1 parent ad16fb4 commit 882f6f8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
6 changes: 4 additions & 2 deletions python/core/symbology-ng/qgsmarkersymbollayerv2.sip
Expand Up @@ -5,11 +5,13 @@ class QgsSimpleMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
%End

public:

/** Constructor for QgsSimpleMarkerSymbolLayerV2.
* @param name symbol name, should be one of "square", "rectangle", "diamond",
* "pentagon", "triangle", "equilateral_triangle", "star", "regular_star", "arrow",
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead"
* "semi_circle", "third_circle", "quarter_circle"
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
* "diagonal_half_square"
* @param color fill color for symbol
* @param borderColor border color for symbol
* @param size symbol size (in mm)
Expand Down
15 changes: 15 additions & 0 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
Expand Up @@ -342,6 +342,21 @@ bool QgsSimpleMarkerSymbolLayerV2::prepareShape( const QString& name, QPolygonF
polygon = QPolygonF( QRectF( QPointF( -1, -1 ), QPointF( 1, 1 ) ) );
return true;
}
else if ( name == "quarter_square" )
{
polygon = QPolygonF( QRectF( QPointF( -1, -1 ), QPointF( 0, 0 ) ) );
return true;
}
else if ( name == "half_square" )
{
polygon = QPolygonF( QRectF( QPointF( -1, -1 ), QPointF( 0, 1 ) ) );
return true;
}
else if ( name == "diagonal_half_square" )
{
polygon << QPointF( -1, -1 ) << QPointF( 1, 1 ) << QPointF( -1, 1 );
return true;
}
else if ( name == "diamond" )
{
polygon << QPointF( -1, 0 ) << QPointF( 0, 1 )
Expand Down
6 changes: 4 additions & 2 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.h
Expand Up @@ -35,11 +35,13 @@
class CORE_EXPORT QgsSimpleMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2
{
public:

/** Constructor for QgsSimpleMarkerSymbolLayerV2.
* @param name symbol name, should be one of "square", "rectangle", "diamond",
* "pentagon", "triangle", "equilateral_triangle", "star", "regular_star", "arrow",
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
* "semi_circle", "third_circle", "quarter_circle"
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
* "diagonal_half_square"
* @param color fill color for symbol
* @param borderColor border color for symbol
* @param size symbol size (in mm)
Expand Down
6 changes: 4 additions & 2 deletions src/gui/symbology-ng/qgssymbollayerv2widget.cpp
Expand Up @@ -441,7 +441,8 @@ QgsSimpleMarkerSymbolLayerV2Widget::QgsSimpleMarkerSymbolLayerV2Widget( const Qg
QSize size = lstNames->iconSize();
QStringList names;
names << "circle" << "rectangle" << "diamond" << "pentagon" << "cross" << "cross2" << "triangle" << "equilateral_triangle" << "star"
<< "regular_star" << "arrow" << "line" << "arrowhead" << "filled_arrowhead" << "semi_circle" << "third_circle" << "quarter_circle";
<< "regular_star" << "arrow" << "line" << "arrowhead" << "filled_arrowhead" << "semi_circle" << "third_circle" << "quarter_circle"
<< "quarter_square" << "half_square" << "diagonal_half_square";
double markerSize = DEFAULT_POINT_SIZE * 2;
Q_FOREACH ( const QString& name, names )
{
Expand Down Expand Up @@ -542,7 +543,8 @@ void QgsSimpleMarkerSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer
"<b>pentagon</b>|<b>triangle</b>|<b>equilateral_triangle</b>|"
"<b>star</b>|<b>regular_star</b>|<b>arrow</b>|<b>filled_arrowhead</b>|"
"<b>circle</b>|<b>cross</b>|<b>x</b>|"
"<b>cross2</b>|<b>line</b>|<b>arrowhead</b>|<b>semi_circle</b>|<b>third_circle</b>|<b>quarter_circle</b>]" ) );
"<b>cross2</b>|<b>line</b>|<b>arrowhead</b>|<b>semi_circle</b>|<b>third_circle</b>|<b>quarter_circle</b>|"
"<b>quarter_square</b>|<b>half_square</b>|<b>diagonal_half_square</b>]" ) );
registerDataDefinedButton( mFillColorDDBtn, "color", QgsDataDefinedButton::String, QgsDataDefinedButton::colorAlphaDesc() );
registerDataDefinedButton( mBorderColorDDBtn, "color_border", QgsDataDefinedButton::String, QgsDataDefinedButton::colorAlphaDesc() );
registerDataDefinedButton( mOutlineWidthDDBtn, "outline_width", QgsDataDefinedButton::Double, QgsDataDefinedButton::doublePosDesc() );
Expand Down

0 comments on commit 882f6f8

Please sign in to comment.