mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-04 00:30:59 -05:00
optimize handling of missing geometries and zero count densification
This commit is contained in:
parent
d00178d6af
commit
32a01d1d32
@ -81,7 +81,7 @@ void QgsDensifyGeometriesByCountAlgorithm::initParameters( const QVariantMap &co
|
||||
QgsProcessingParameterNumber::Integer,
|
||||
1, false, 1, 10000000 );
|
||||
verticesCnt->setIsDynamic( true );
|
||||
verticesCnt->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "VerticesCount" ), QObject::tr( "Vertices count" ), QgsPropertyDefinition::IntegerPositiveGreaterZero ) );
|
||||
verticesCnt->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "VerticesCount" ), QObject::tr( "Vertices count" ), QgsPropertyDefinition::IntegerPositive ) );
|
||||
verticesCnt->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) );
|
||||
addParameter( verticesCnt.release() );
|
||||
}
|
||||
@ -107,14 +107,18 @@ QgsFeatureList QgsDensifyGeometriesByCountAlgorithm::processFeature( const QgsFe
|
||||
{
|
||||
Q_UNUSED( context )
|
||||
Q_UNUSED( feedback )
|
||||
|
||||
QgsFeature densifiedFeature = feature;
|
||||
|
||||
int verticesCnt = mVerticesCnt;
|
||||
if ( mDynamicVerticesCnt )
|
||||
verticesCnt = mVerticesCntProperty.valueAsInt( context.expressionContext(), verticesCnt );
|
||||
|
||||
if ( feature.hasGeometry() )
|
||||
densifiedFeature.setGeometry( feature.geometry().densifyByCount( verticesCnt ) );
|
||||
{
|
||||
int verticesCnt = mVerticesCnt;
|
||||
if ( mDynamicVerticesCnt )
|
||||
verticesCnt = mVerticesCntProperty.valueAsInt( context.expressionContext(), verticesCnt );
|
||||
|
||||
if ( verticesCnt > 0 )
|
||||
densifiedFeature.setGeometry( feature.geometry().densifyByCount( verticesCnt ) );
|
||||
}
|
||||
|
||||
return QgsFeatureList() << densifiedFeature;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user