Skip to content
Permalink
Browse files

Merge pull request #2997 from nirvn/more_n_more_markers

[symbology] add a filled cross simple marker
  • Loading branch information
nyalldawson committed Apr 13, 2016
2 parents 9a161ac + 6da1899 commit cbe919d28f6bc8041cab81d9d376d98bdedb0820
@@ -8,8 +8,8 @@ class QgsSimpleMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2

/** Constructor for QgsSimpleMarkerSymbolLayerV2.
* @param name symbol name, should be one of "square", "rectangle", "diamond",
* "pentagon", "triangle", "equilateral_triangle", "star", "arrow",
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
* "pentagon", "hexagon", "triangle", "equilateral_triangle", "star", "arrow",
* "circle", "cross", "cross_fill", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
* "diagonal_half_square", "right_half_triangle", "left_half_triangle"
* @param color fill color for symbol
@@ -379,6 +379,9 @@ QgsEllipseSymbolLayerV2* QgsEllipseSymbolLayerV2::clone() const
m->setSymbolHeightMapUnitScale( mSymbolHeightMapUnitScale );
m->setOutlineWidthUnit( mOutlineWidthUnit );
m->setOutlineWidthMapUnitScale( mOutlineWidthMapUnitScale );
m->setAngle( mAngle );
m->setHorizontalAnchorPoint( mHorizontalAnchorPoint );
m->setVerticalAnchorPoint( mVerticalAnchorPoint );

copyDataDefinedProperties( m );
copyPaintEffect( m );
@@ -372,6 +372,12 @@ bool QgsSimpleMarkerSymbolLayerV2::prepareShape( const QString& name, QPolygonF
<< 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 );
return true;
}
else if ( name == "triangle" )
{
polygon << QPointF( -1, 1 ) << QPointF( 1, 1 ) << QPointF( 0, -1 );
@@ -469,6 +475,23 @@ bool QgsSimpleMarkerSymbolLayerV2::preparePath( QString name )
mPath.lineTo( 0, 1 ); // vertical
return true;
}
else if ( name == "cross_fill" )
{
mPath.moveTo( -1, -0.2 );
mPath.lineTo( -1, 0.2 );
mPath.lineTo( -0.2, 0.2 );
mPath.lineTo( -0.2, 1 );
mPath.lineTo( 0.2, 1 );
mPath.lineTo( 0.2, 0.2 );
mPath.lineTo( 1, 0.2 );
mPath.lineTo( 1, -0.2 );
mPath.lineTo( 0.2, -0.2 );
mPath.lineTo( 0.2, -1 );
mPath.lineTo( -0.2, -1 );
mPath.lineTo( -0.2, -0.2 );
mPath.lineTo( -1, -0.2 );
return true;
}
else if ( name == "x" || name == "cross2" )
{
mPath.moveTo( -1, -1 );
@@ -38,8 +38,8 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2

/** Constructor for QgsSimpleMarkerSymbolLayerV2.
* @param name symbol name, should be one of "square", "rectangle", "diamond",
* "pentagon", "triangle", "equilateral_triangle", "star", "arrow",
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
* "pentagon", "hexagon", "triangle", "equilateral_triangle", "star", "arrow",
* "circle", "cross", "cross_fill", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
* "diagonal_half_square", "right_half_triangle", "left_half_triangle"
* @param color fill color for symbol
@@ -440,8 +440,8 @@ QgsSimpleMarkerSymbolLayerV2Widget::QgsSimpleMarkerSymbolLayerV2Widget( const Qg

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

registerDataDefinedButton( mNameDDBtn, "name", QgsDataDefinedButton::String, tr( "string " ) + QLatin1String( "[<b>square</b>|<b>rectangle</b>|<b>diamond</b>|"
"<b>pentagon</b>|<b>triangle</b>|<b>equilateral_triangle</b>|"
"<b>pentagon</b>|<b>hexagon</b>|<b>triangle</b>|<b>equilateral_triangle</b>|"
"<b>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>circle</b>|<b>cross</b>|<b>cross_fill</b>|<b>x</b>|"
"<b>line</b>|<b>arrowhead</b>|<b>cross2</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>|<b>right_half_triangle</b>|<b>left_half_triangle</b>]" ) );
registerDataDefinedButton( mFillColorDDBtn, "color", QgsDataDefinedButton::String, QgsDataDefinedButton::colorAlphaDesc() );
registerDataDefinedButton( mBorderColorDDBtn, "color_border", QgsDataDefinedButton::String, QgsDataDefinedButton::colorAlphaDesc() );

0 comments on commit cbe919d

Please sign in to comment.
You can’t perform that action at this time.