mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
[symbology] add half triangle markers
This commit is contained in:
parent
9c0a291046
commit
7b233e514c
@ -11,7 +11,7 @@ class QgsSimpleMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
|
|||||||
* "pentagon", "triangle", "equilateral_triangle", "star", "regular_star", "arrow",
|
* "pentagon", "triangle", "equilateral_triangle", "star", "regular_star", "arrow",
|
||||||
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
|
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
|
||||||
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
|
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
|
||||||
* "diagonal_half_square"
|
* "diagonal_half_square", "right_half_triangle", "left_half_triangle"
|
||||||
* @param color fill color for symbol
|
* @param color fill color for symbol
|
||||||
* @param borderColor border color for symbol
|
* @param borderColor border color for symbol
|
||||||
* @param size symbol size (in mm)
|
* @param size symbol size (in mm)
|
||||||
|
@ -565,6 +565,11 @@ void QgsEllipseSymbolLayerV2::preparePath( const QString& symbolName, QgsSymbolV
|
|||||||
{
|
{
|
||||||
mPainterPath.addEllipse( QRectF( -size.width() / 2.0, -size.height() / 2.0, size.width(), size.height() ) );
|
mPainterPath.addEllipse( QRectF( -size.width() / 2.0, -size.height() / 2.0, size.width(), size.height() ) );
|
||||||
}
|
}
|
||||||
|
else if ( symbolName == "semi_circle" )
|
||||||
|
{
|
||||||
|
mPainterPath.arcTo( -size.width() / 2.0, -size.height() / 2.0, size.width(), size.height(), 0, 180 );
|
||||||
|
mPainterPath.lineTo( 0, 0 );
|
||||||
|
}
|
||||||
else if ( symbolName == "rectangle" )
|
else if ( symbolName == "rectangle" )
|
||||||
{
|
{
|
||||||
mPainterPath.addRect( QRectF( -size.width() / 2.0, -size.height() / 2.0, size.width(), size.height() ) );
|
mPainterPath.addRect( QRectF( -size.width() / 2.0, -size.height() / 2.0, size.width(), size.height() ) );
|
||||||
@ -583,6 +588,20 @@ void QgsEllipseSymbolLayerV2::preparePath( const QString& symbolName, QgsSymbolV
|
|||||||
mPainterPath.lineTo( size.width() / 2.0, size.height() / 2.0 );
|
mPainterPath.lineTo( size.width() / 2.0, size.height() / 2.0 );
|
||||||
mPainterPath.lineTo( 0, -size.height() / 2.0 );
|
mPainterPath.lineTo( 0, -size.height() / 2.0 );
|
||||||
}
|
}
|
||||||
|
else if ( symbolName == "left_half_triangle" )
|
||||||
|
{
|
||||||
|
mPainterPath.moveTo( 0, size.height() / 2.0 );
|
||||||
|
mPainterPath.lineTo( size.width() / 2.0, size.height() / 2.0 );
|
||||||
|
mPainterPath.lineTo( 0, -size.height() / 2.0 );
|
||||||
|
mPainterPath.lineTo( 0, size.height() / 2.0 );
|
||||||
|
}
|
||||||
|
else if ( symbolName == "right_half_triangle" )
|
||||||
|
{
|
||||||
|
mPainterPath.moveTo( -size.width() / 2.0, size.height() / 2.0 );
|
||||||
|
mPainterPath.lineTo( 0, size.height() / 2.0 );
|
||||||
|
mPainterPath.lineTo( 0, -size.height() / 2.0 );
|
||||||
|
mPainterPath.lineTo( -size.width() / 2.0, size.height() / 2.0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsEllipseSymbolLayerV2::setOutputUnit( QgsSymbolV2::OutputUnit unit )
|
void QgsEllipseSymbolLayerV2::setOutputUnit( QgsSymbolV2::OutputUnit unit )
|
||||||
|
@ -384,6 +384,16 @@ bool QgsSimpleMarkerSymbolLayerV2::prepareShape( const QString& name, QPolygonF
|
|||||||
<< QPointF( 0, -1 );
|
<< QPointF( 0, -1 );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if ( name == "left_half_triangle" )
|
||||||
|
{
|
||||||
|
polygon << QPointF( 0, 1 ) << QPointF( 1, 1 ) << QPointF( 0, -1 );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if ( name == "right_half_triangle" )
|
||||||
|
{
|
||||||
|
polygon << QPointF( -1, 1 ) << QPointF( 0, 1 ) << QPointF( 0, -1 );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if ( name == "star" )
|
else if ( name == "star" )
|
||||||
{
|
{
|
||||||
double sixth = 1.0 / 3;
|
double sixth = 1.0 / 3;
|
||||||
|
@ -41,7 +41,7 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2
|
|||||||
* "pentagon", "triangle", "equilateral_triangle", "star", "regular_star", "arrow",
|
* "pentagon", "triangle", "equilateral_triangle", "star", "regular_star", "arrow",
|
||||||
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
|
* "circle", "cross", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
|
||||||
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
|
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
|
||||||
* "diagonal_half_square"
|
* "diagonal_half_square", "right_half_triangle", "left_half_triangle"
|
||||||
* @param color fill color for symbol
|
* @param color fill color for symbol
|
||||||
* @param borderColor border color for symbol
|
* @param borderColor border color for symbol
|
||||||
* @param size symbol size (in mm)
|
* @param size symbol size (in mm)
|
||||||
|
@ -904,7 +904,8 @@ QString QgsDataDefinedButton::fillStyleDesc()
|
|||||||
|
|
||||||
QString QgsDataDefinedButton::markerStyleDesc()
|
QString QgsDataDefinedButton::markerStyleDesc()
|
||||||
{
|
{
|
||||||
return trString() + QLatin1String( "[<b>circle</b>|<b>rectangle</b>|<b>cross</b>|<b>triangle</b>]" );
|
return trString() + QLatin1String( "[<b>circle</b>|<b>rectangle</b>|<b>cross</b>|<b>triangle"
|
||||||
|
"</b>|<b>right_half_triangle</b>|<b>left_half_triangle</b>|<b>semi_circle</b>]" );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QgsDataDefinedButton::customDashDesc()
|
QString QgsDataDefinedButton::customDashDesc()
|
||||||
|
@ -46,7 +46,7 @@ QgsEllipseSymbolLayerV2Widget::QgsEllipseSymbolLayerV2Widget( const QgsVectorLay
|
|||||||
mRotationSpinBox->setClearValue( 0.0 );
|
mRotationSpinBox->setClearValue( 0.0 );
|
||||||
|
|
||||||
QStringList names;
|
QStringList names;
|
||||||
names << "circle" << "rectangle" << "cross" << "triangle";
|
names << "circle" << "rectangle" << "cross" << "triangle" << "right_half_triangle" << "left_half_triangle" << "semi_circle";
|
||||||
QSize iconSize = mShapeListWidget->iconSize();
|
QSize iconSize = mShapeListWidget->iconSize();
|
||||||
|
|
||||||
Q_FOREACH ( const QString& name, names )
|
Q_FOREACH ( const QString& name, names )
|
||||||
|
@ -442,7 +442,7 @@ QgsSimpleMarkerSymbolLayerV2Widget::QgsSimpleMarkerSymbolLayerV2Widget( const Qg
|
|||||||
QStringList names;
|
QStringList names;
|
||||||
names << "circle" << "rectangle" << "diamond" << "pentagon" << "cross" << "cross2" << "triangle" << "equilateral_triangle" << "star"
|
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";
|
<< "quarter_square" << "half_square" << "diagonal_half_square" << "right_half_triangle" << "left_half_triangle";
|
||||||
double markerSize = DEFAULT_POINT_SIZE * 2;
|
double markerSize = DEFAULT_POINT_SIZE * 2;
|
||||||
Q_FOREACH ( const QString& name, names )
|
Q_FOREACH ( const QString& name, names )
|
||||||
{
|
{
|
||||||
@ -544,7 +544,7 @@ void QgsSimpleMarkerSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer
|
|||||||
"<b>star</b>|<b>regular_star</b>|<b>arrow</b>|<b>filled_arrowhead</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>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>]" ) );
|
"<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( mFillColorDDBtn, "color", QgsDataDefinedButton::String, QgsDataDefinedButton::colorAlphaDesc() );
|
||||||
registerDataDefinedButton( mBorderColorDDBtn, "color_border", QgsDataDefinedButton::String, QgsDataDefinedButton::colorAlphaDesc() );
|
registerDataDefinedButton( mBorderColorDDBtn, "color_border", QgsDataDefinedButton::String, QgsDataDefinedButton::colorAlphaDesc() );
|
||||||
registerDataDefinedButton( mOutlineWidthDDBtn, "outline_width", QgsDataDefinedButton::Double, QgsDataDefinedButton::doublePosDesc() );
|
registerDataDefinedButton( mOutlineWidthDDBtn, "outline_width", QgsDataDefinedButton::Double, QgsDataDefinedButton::doublePosDesc() );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user