Skip to content
Permalink
Browse files

Address review

  • Loading branch information
nirvn committed Mar 17, 2021
1 parent 01f1f0c commit 2cbb1307cbb901e9076fa23dcb5b5770f5e09ade
@@ -52,7 +52,7 @@ leaves the actual drawing of the symbols to subclasses.
Octagon,
SquareWithCorners,
AsteriskFill,
SemiArc,
HalfArc,
ThirdArc,
QuarterArc,
};
@@ -641,7 +641,7 @@ void QgsEllipseSymbolLayer::preparePath( const QString &symbolName, QgsSymbolRen
mPainterPath.lineTo( 0, -size.height() / 2.0 );
mPainterPath.lineTo( size.width() / 2.0, size.height() / 2.0 );
}
else if ( symbolName == QLatin1String( "semi_arc" ) )
else if ( symbolName == QLatin1String( "half_arc" ) )
{
mPainterPath.moveTo( size.width() / 2.0, 0 );
mPainterPath.arcTo( -size.width() / 2.0, -size.height() / 2.0, size.width(), size.height(), 0, 180 );
@@ -671,7 +671,7 @@ void QgsEllipseSymbolLayer::preparePath( const QString &symbolName, QgsSymbolRen

bool QgsEllipseSymbolLayer::shapeIsFilled( const QString &symbolName ) const
{
return symbolName == QLatin1String( "cross" ) || symbolName == QLatin1String( "arrow" ) || symbolName == QLatin1String( "semi_arc" ) ? false : true;
return symbolName == QLatin1String( "cross" ) || symbolName == QLatin1String( "arrow" ) || symbolName == QLatin1String( "half_arc" ) ? false : true;
}

void QgsEllipseSymbolLayer::setSize( double size )
@@ -75,7 +75,7 @@ QList<QgsSimpleMarkerSymbolLayerBase::Shape> QgsSimpleMarkerSymbolLayerBase::ava
<< CrossFill
<< Cross2
<< Line
<< SemiArc
<< HalfArc
<< ThirdArc
<< QuarterArc
<< ArrowHead
@@ -136,7 +136,7 @@ bool QgsSimpleMarkerSymbolLayerBase::shapeIsFilled( QgsSimpleMarkerSymbolLayerBa
case Cross2:
case Line:
case ArrowHead:
case SemiArc:
case HalfArc:
case ThirdArc:
case QuarterArc:
return false;
@@ -362,8 +362,8 @@ QgsSimpleMarkerSymbolLayerBase::Shape QgsSimpleMarkerSymbolLayerBase::decodeShap
return LeftHalfTriangle;
else if ( cleaned == QLatin1String( "asterisk_fill" ) )
return AsteriskFill;
else if ( cleaned == QLatin1String( "semi_arc" ) )
return SemiArc;
else if ( cleaned == QLatin1String( "half_arc" ) )
return HalfArc;
else if ( cleaned == QLatin1String( "third_arc" ) )
return ThirdArc;
else if ( cleaned == QLatin1String( "quarter_arc" ) )
@@ -430,8 +430,8 @@ QString QgsSimpleMarkerSymbolLayerBase::encodeShape( QgsSimpleMarkerSymbolLayerB
return QStringLiteral( "quarter_circle" );
case AsteriskFill:
return QStringLiteral( "asterisk_fill" );
case SemiArc:
return QStringLiteral( "semi_arc" );
case HalfArc:
return QStringLiteral( "half_arc" );
case ThirdArc:
return QStringLiteral( "third_arc" );
case QuarterArc:
@@ -653,7 +653,7 @@ bool QgsSimpleMarkerSymbolLayerBase::shapeToPolygon( QgsSimpleMarkerSymbolLayerB
case SemiCircle:
case ThirdCircle:
case QuarterCircle:
case SemiArc:
case HalfArc:
case ThirdArc:
case QuarterArc:
return false;
@@ -688,7 +688,7 @@ bool QgsSimpleMarkerSymbolLayerBase::prepareMarkerPath( QgsSimpleMarkerSymbolLay
mPath.lineTo( 0, 0 );
return true;

case SemiArc:
case HalfArc:
mPath.moveTo( 1, 0 );
mPath.arcTo( -1, -1, 2, 2, 0, 180 );
return true;
@@ -74,9 +74,9 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerBase : public QgsMarkerSymbolLayer
Octagon, //!< Octagon (since QGIS 3.18)
SquareWithCorners, //!< A square with diagonal corners (since QGIS 3.18)
AsteriskFill, //!< A filled asterisk shape (since QGIS 3.18)
SemiArc, //!< A line-only semi arc (since QGIS 3.20)
HalfArc, //!< A line-only half arc (since QGIS 3.20)
ThirdArc, //!< A line-only one third arc (since QGIS 3.20)
QuarterArc, //!< A line-only quarter arc (since QGIS 3.20)
QuarterArc, //!< A line-only one quarter arc (since QGIS 3.20)
};

//! Returns a list of all available shape types.
@@ -66,7 +66,7 @@ QgsEllipseSymbolLayerWidget::QgsEllipseSymbolLayerWidget( QgsVectorLayer *vl, QW
mRotationSpinBox->setClearValue( 0.0 );

QStringList names;
names << QStringLiteral( "circle" ) << QStringLiteral( "rectangle" ) << QStringLiteral( "diamond" ) << QStringLiteral( "cross" ) << QStringLiteral( "arrow" ) << QStringLiteral( "semi_arc" ) << QStringLiteral( "triangle" ) << QStringLiteral( "right_half_triangle" ) << QStringLiteral( "left_half_triangle" ) << QStringLiteral( "semi_circle" );
names << QStringLiteral( "circle" ) << QStringLiteral( "rectangle" ) << QStringLiteral( "diamond" ) << QStringLiteral( "cross" ) << QStringLiteral( "arrow" ) << QStringLiteral( "half_arc" ) << QStringLiteral( "triangle" ) << QStringLiteral( "right_half_triangle" ) << QStringLiteral( "left_half_triangle" ) << QStringLiteral( "semi_circle" );

int size = mShapeListWidget->iconSize().width();
size = std::max( 30, static_cast< int >( std::round( Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance( 'X' ) * 3 ) ) );

0 comments on commit 2cbb130

Please sign in to comment.