Skip to content

Commit 3cf75d8

Browse files
committed
[symbology] add filled cross and hexagon markers
1 parent 9a161ac commit 3cf75d8

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

python/core/symbology-ng/qgsmarkersymbollayerv2.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ class QgsSimpleMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
88

99
/** Constructor for QgsSimpleMarkerSymbolLayerV2.
1010
* @param name symbol name, should be one of "square", "rectangle", "diamond",
11-
* "pentagon", "triangle", "equilateral_triangle", "star", "arrow",
12-
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
11+
* "pentagon", "hexagon", "triangle", "equilateral_triangle", "star", "arrow",
12+
* "circle", "cross", "cross_fill", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
1313
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
1414
* "diagonal_half_square", "right_half_triangle", "left_half_triangle"
1515
* @param color fill color for symbol

src/core/symbology-ng/qgsmarkersymbollayerv2.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,12 @@ bool QgsSimpleMarkerSymbolLayerV2::prepareShape( const QString& name, QPolygonF
372372
<< QPointF( 0, -1 );
373373
return true;
374374
}
375+
else if ( name == "hexagon" )
376+
{
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 );
379+
return true;
380+
}
375381
else if ( name == "triangle" )
376382
{
377383
polygon << QPointF( -1, 1 ) << QPointF( 1, 1 ) << QPointF( 0, -1 );
@@ -469,6 +475,23 @@ bool QgsSimpleMarkerSymbolLayerV2::preparePath( QString name )
469475
mPath.lineTo( 0, 1 ); // vertical
470476
return true;
471477
}
478+
else if ( name == "cross_fill" )
479+
{
480+
mPath.moveTo( -1, -0.2 );
481+
mPath.lineTo( -1, 0.2 );
482+
mPath.lineTo( -0.2, 0.2 );
483+
mPath.lineTo( -0.2, 1 );
484+
mPath.lineTo( 0.2, 1 );
485+
mPath.lineTo( 0.2, 0.2 );
486+
mPath.lineTo( 1, 0.2 );
487+
mPath.lineTo( 1, -0.2 );
488+
mPath.lineTo( 0.2, -0.2 );
489+
mPath.lineTo( 0.2, -1 );
490+
mPath.lineTo( -0.2, -1 );
491+
mPath.lineTo( -0.2, -0.2 );
492+
mPath.lineTo( -1, -0.2 );
493+
return true;
494+
}
472495
else if ( name == "x" || name == "cross2" )
473496
{
474497
mPath.moveTo( -1, -1 );

src/core/symbology-ng/qgsmarkersymbollayerv2.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2
3838

3939
/** Constructor for QgsSimpleMarkerSymbolLayerV2.
4040
* @param name symbol name, should be one of "square", "rectangle", "diamond",
41-
* "pentagon", "triangle", "equilateral_triangle", "star", "arrow",
42-
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
41+
* "pentagon", "hexagon", "triangle", "equilateral_triangle", "star", "arrow",
42+
* "circle", "cross", "cross_fill", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
4343
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
4444
* "diagonal_half_square", "right_half_triangle", "left_half_triangle"
4545
* @param color fill color for symbol

src/gui/symbology-ng/qgssymbollayerv2widget.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,8 @@ QgsSimpleMarkerSymbolLayerV2Widget::QgsSimpleMarkerSymbolLayerV2Widget( const Qg
440440

441441
QSize size = lstNames->iconSize();
442442
QStringList names;
443-
names << "circle" << "rectangle" << "diamond" << "pentagon" << "cross" << "cross2" << "triangle" << "equilateral_triangle" << "star"
444-
<< "arrow" << "line" << "arrowhead" << "filled_arrowhead" << "semi_circle" << "third_circle" << "quarter_circle"
443+
names << "circle" << "rectangle" << "diamond" << "pentagon" << "hexagon" << "cross" << "cross_fill" << "triangle" << "equilateral_triangle"
444+
<< "star" << "arrow" << "line" << "arrowhead" << "cross2" << "filled_arrowhead" << "semi_circle" << "third_circle" << "quarter_circle"
445445
<< "quarter_square" << "half_square" << "diagonal_half_square" << "right_half_triangle" << "left_half_triangle";
446446
double markerSize = DEFAULT_POINT_SIZE * 2;
447447
Q_FOREACH ( const QString& name, names )
@@ -540,10 +540,10 @@ void QgsSimpleMarkerSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer
540540
mVerticalAnchorComboBox->blockSignals( false );
541541

542542
registerDataDefinedButton( mNameDDBtn, "name", QgsDataDefinedButton::String, tr( "string " ) + QLatin1String( "[<b>square</b>|<b>rectangle</b>|<b>diamond</b>|"
543-
"<b>pentagon</b>|<b>triangle</b>|<b>equilateral_triangle</b>|"
543+
"<b>pentagon</b>|<b>hexagon</b>|<b>triangle</b>|<b>equilateral_triangle</b>|"
544544
"<b>star</b>|<b>arrow</b>|<b>filled_arrowhead</b>|"
545-
"<b>circle</b>|<b>cross</b>|<b>x</b>|"
546-
"<b>cross2</b>|<b>line</b>|<b>arrowhead</b>|<b>semi_circle</b>|<b>third_circle</b>|<b>quarter_circle</b>|"
545+
"<b>circle</b>|<b>cross</b>|<b>cross_fill</b>|<b>x</b>|"
546+
"<b>line</b>|<b>arrowhead</b>|<b>cross2</b>|<b>semi_circle</b>|<b>third_circle</b>|<b>quarter_circle</b>|"
547547
"<b>quarter_square</b>|<b>half_square</b>|<b>diagonal_half_square</b>|<b>right_half_triangle</b>|<b>left_half_triangle</b>]" ) );
548548
registerDataDefinedButton( mFillColorDDBtn, "color", QgsDataDefinedButton::String, QgsDataDefinedButton::colorAlphaDesc() );
549549
registerDataDefinedButton( mBorderColorDDBtn, "color_border", QgsDataDefinedButton::String, QgsDataDefinedButton::colorAlphaDesc() );

0 commit comments

Comments
 (0)