Skip to content

Commit 882f6f8

Browse files
committedApr 4, 2016
[symbology] Add some more dispersed marker symbols (half/quarter squares)
1 parent ad16fb4 commit 882f6f8

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed
 

‎python/core/symbology-ng/qgsmarkersymbollayerv2.sip

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ class QgsSimpleMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
55
%End
66

77
public:
8+
89
/** Constructor for QgsSimpleMarkerSymbolLayerV2.
910
* @param name symbol name, should be one of "square", "rectangle", "diamond",
1011
* "pentagon", "triangle", "equilateral_triangle", "star", "regular_star", "arrow",
11-
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead"
12-
* "semi_circle", "third_circle", "quarter_circle"
12+
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
13+
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
14+
* "diagonal_half_square"
1315
* @param color fill color for symbol
1416
* @param borderColor border color for symbol
1517
* @param size symbol size (in mm)

‎src/core/symbology-ng/qgsmarkersymbollayerv2.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,21 @@ bool QgsSimpleMarkerSymbolLayerV2::prepareShape( const QString& name, QPolygonF
342342
polygon = QPolygonF( QRectF( QPointF( -1, -1 ), QPointF( 1, 1 ) ) );
343343
return true;
344344
}
345+
else if ( name == "quarter_square" )
346+
{
347+
polygon = QPolygonF( QRectF( QPointF( -1, -1 ), QPointF( 0, 0 ) ) );
348+
return true;
349+
}
350+
else if ( name == "half_square" )
351+
{
352+
polygon = QPolygonF( QRectF( QPointF( -1, -1 ), QPointF( 0, 1 ) ) );
353+
return true;
354+
}
355+
else if ( name == "diagonal_half_square" )
356+
{
357+
polygon << QPointF( -1, -1 ) << QPointF( 1, 1 ) << QPointF( -1, 1 );
358+
return true;
359+
}
345360
else if ( name == "diamond" )
346361
{
347362
polygon << QPointF( -1, 0 ) << QPointF( 0, 1 )

‎src/core/symbology-ng/qgsmarkersymbollayerv2.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@
3535
class CORE_EXPORT QgsSimpleMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2
3636
{
3737
public:
38+
3839
/** Constructor for QgsSimpleMarkerSymbolLayerV2.
3940
* @param name symbol name, should be one of "square", "rectangle", "diamond",
4041
* "pentagon", "triangle", "equilateral_triangle", "star", "regular_star", "arrow",
41-
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
42-
* "semi_circle", "third_circle", "quarter_circle"
42+
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
43+
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
44+
* "diagonal_half_square"
4345
* @param color fill color for symbol
4446
* @param borderColor border color for symbol
4547
* @param size symbol size (in mm)

‎src/gui/symbology-ng/qgssymbollayerv2widget.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,8 @@ QgsSimpleMarkerSymbolLayerV2Widget::QgsSimpleMarkerSymbolLayerV2Widget( const Qg
441441
QSize size = lstNames->iconSize();
442442
QStringList names;
443443
names << "circle" << "rectangle" << "diamond" << "pentagon" << "cross" << "cross2" << "triangle" << "equilateral_triangle" << "star"
444-
<< "regular_star" << "arrow" << "line" << "arrowhead" << "filled_arrowhead" << "semi_circle" << "third_circle" << "quarter_circle";
444+
<< "regular_star" << "arrow" << "line" << "arrowhead" << "filled_arrowhead" << "semi_circle" << "third_circle" << "quarter_circle"
445+
<< "quarter_square" << "half_square" << "diagonal_half_square";
445446
double markerSize = DEFAULT_POINT_SIZE * 2;
446447
Q_FOREACH ( const QString& name, names )
447448
{
@@ -542,7 +543,8 @@ void QgsSimpleMarkerSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer
542543
"<b>pentagon</b>|<b>triangle</b>|<b>equilateral_triangle</b>|"
543544
"<b>star</b>|<b>regular_star</b>|<b>arrow</b>|<b>filled_arrowhead</b>|"
544545
"<b>circle</b>|<b>cross</b>|<b>x</b>|"
545-
"<b>cross2</b>|<b>line</b>|<b>arrowhead</b>|<b>semi_circle</b>|<b>third_circle</b>|<b>quarter_circle</b>]" ) );
546+
"<b>cross2</b>|<b>line</b>|<b>arrowhead</b>|<b>semi_circle</b>|<b>third_circle</b>|<b>quarter_circle</b>|"
547+
"<b>quarter_square</b>|<b>half_square</b>|<b>diagonal_half_square</b>]" ) );
546548
registerDataDefinedButton( mFillColorDDBtn, "color", QgsDataDefinedButton::String, QgsDataDefinedButton::colorAlphaDesc() );
547549
registerDataDefinedButton( mBorderColorDDBtn, "color_border", QgsDataDefinedButton::String, QgsDataDefinedButton::colorAlphaDesc() );
548550
registerDataDefinedButton( mOutlineWidthDDBtn, "outline_width", QgsDataDefinedButton::Double, QgsDataDefinedButton::doublePosDesc() );

0 commit comments

Comments
 (0)
Please sign in to comment.