Skip to content

Commit

Permalink
throw exception if multipart input found
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Jan 15, 2020
1 parent fb4d9c0 commit a6d2a82
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -48,7 +48,8 @@ QString QgsRectanglesOvalsDiamondsAlgorithm::groupId() const
QString QgsRectanglesOvalsDiamondsAlgorithm::shortHelpString() const
{
return QObject::tr( "Creates rectangle, oval or diamond-shaped polygons from the input point layer using "
"specified width, height and (optional) rotation values." );
"specified width, height and (optional) rotation values. Multipart inputs should be promoted"
"to singleparts first." );
}

QString QgsRectanglesOvalsDiamondsAlgorithm::outputName() const
Expand Down Expand Up @@ -140,6 +141,12 @@ QgsFeatureList QgsRectanglesOvalsDiamondsAlgorithm::processFeature( const QgsFea
QgsFeature outFeature = feature;
if ( outFeature.hasGeometry() )
{
QgsGeometry geometry = outFeature.geometry();
if ( geometry.isMultipart() )
{
throw QgsProcessingException( QObject::tr( "Multipart geometry. Please promote input layer to singleparts first." ) );
}

double width = mWidth;
if ( mDynamicWidth )
width = mWidthProperty.valueAsDouble( context.expressionContext(), width );
Expand Down

0 comments on commit a6d2a82

Please sign in to comment.