22 QString QgsRemoveHolesAlgorithm::name()
const
24 return QStringLiteral(
"deleteholes" );
27 QString QgsRemoveHolesAlgorithm::displayName()
const
29 return QObject::tr(
"Delete holes" );
32 QStringList QgsRemoveHolesAlgorithm::tags()
const
34 return QObject::tr(
"remove,delete,drop,holes,rings,fill" ).split(
',' );
37 QString QgsRemoveHolesAlgorithm::group()
const
39 return QObject::tr(
"Vector geometry" );
42 QString QgsRemoveHolesAlgorithm::groupId()
const
44 return QStringLiteral(
"vectorgeometry" );
47 QString QgsRemoveHolesAlgorithm::outputName()
const
49 return QObject::tr(
"Cleaned" );
52 QList<int> QgsRemoveHolesAlgorithm::inputLayerTypes()
const
62 QString QgsRemoveHolesAlgorithm::shortHelpString()
const
64 return QObject::tr(
"This algorithm takes a polygon layer and removes holes in polygons. It creates a new vector "
65 "layer in which polygons with holes have been replaced by polygons with only their external ring. "
66 "Attributes are not modified.\n\n"
67 "An optional minimum area parameter allows removing only holes which are smaller than a specified "
68 "area threshold. Leaving this parameter as 0.0 results in all holes being removed." );
71 QgsRemoveHolesAlgorithm *QgsRemoveHolesAlgorithm::createInstance()
const
73 return new QgsRemoveHolesAlgorithm();
82 void QgsRemoveHolesAlgorithm::initParameters(
const QVariantMap & )
84 std::unique_ptr< QgsProcessingParameterNumber > minArea = std::make_unique< QgsProcessingParameterNumber >( QStringLiteral(
"MIN_AREA" ),
87 minArea->setIsDynamic(
true );
89 minArea->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
90 addParameter( minArea.release() );
95 mMinArea = parameterAsDouble( parameters, QStringLiteral(
"MIN_AREA" ), context );
97 if ( mDynamicMinArea )
98 mMinAreaProperty = parameters.value( QStringLiteral(
"MIN_AREA" ) ).value<
QgsProperty >();
110 double minArea = mMinArea;
111 if ( mDynamicMinArea )
112 minArea = mMinAreaProperty.valueAsDouble( context.
expressionContext(), minArea );
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
bool hasGeometry() const
Returns true if the feature has an associated geometry.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
A geometry is the spatial representation of a feature.
QgsGeometry removeInteriorRings(double minimumAllowedArea=-1) const
Removes the interior rings from a (multi)polygon geometry.
Contains information about the context in which a processing algorithm is executed.
QgsExpressionContext & expressionContext()
Returns the expression context.
Flag
Flags controlling how QgsProcessingFeatureSource fetches features.
@ FlagSkipGeometryValidityChecks
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
Base class for providing feedback from a processing algorithm.
@ Double
Double/float values.
static bool isDynamic(const QVariantMap ¶meters, const QString &name)
Returns true if the parameter with matching name is a dynamic parameter, and must be evaluated once f...
SourceType
Data source types enum.
@ TypeVectorPolygon
Vector polygon layers.
Definition for a property.
@ DoublePositive
Positive double value (including 0)
A store for object properties.
QList< QgsFeature > QgsFeatureList