22using namespace Qt::StringLiterals;
26QString QgsRemoveHolesAlgorithm::name()
const
28 return u
"deleteholes"_s;
31QString QgsRemoveHolesAlgorithm::displayName()
const
33 return QObject::tr(
"Delete holes" );
36QStringList QgsRemoveHolesAlgorithm::tags()
const
38 return QObject::tr(
"remove,delete,drop,holes,rings,fill" ).split(
',' );
41QString QgsRemoveHolesAlgorithm::group()
const
43 return QObject::tr(
"Vector geometry" );
46QString QgsRemoveHolesAlgorithm::groupId()
const
48 return u
"vectorgeometry"_s;
51QString QgsRemoveHolesAlgorithm::outputName()
const
53 return QObject::tr(
"Cleaned" );
56QList<int> QgsRemoveHolesAlgorithm::inputLayerTypes()
const
66QString QgsRemoveHolesAlgorithm::shortHelpString()
const
68 return QObject::tr(
"This algorithm takes a polygon layer and removes holes in polygons. It creates a new vector "
69 "layer in which polygons with holes have been replaced by polygons with only their external ring. "
70 "Attributes are not modified.\n\n"
71 "An optional minimum area parameter allows removing only holes which are smaller than a specified "
72 "area threshold. Leaving this parameter as 0.0 results in all holes being removed." );
75QString QgsRemoveHolesAlgorithm::shortDescription()
const
77 return QObject::tr(
"Creates a vector layer in which polygons with holes are replaced by polygons with only their external ring." );
80QgsRemoveHolesAlgorithm *QgsRemoveHolesAlgorithm::createInstance()
const
82 return new QgsRemoveHolesAlgorithm();
91void QgsRemoveHolesAlgorithm::initParameters(
const QVariantMap & )
93 auto minArea = std::make_unique<QgsProcessingParameterArea>( u
"MIN_AREA"_s, QObject::tr(
"Remove holes with area less than" ), 0.0, u
"INPUT"_s,
false, 0 );
94 minArea->setIsDynamic(
true );
96 minArea->setDynamicLayerParameterName( u
"INPUT"_s );
97 addParameter( minArea.release() );
102 mMinArea = parameterAsDouble( parameters, u
"MIN_AREA"_s, context );
104 if ( mDynamicMinArea )
105 mMinAreaProperty = parameters.value( u
"MIN_AREA"_s ).value<
QgsProperty>();
117 double minArea = mMinArea;
118 if ( mDynamicMinArea )
119 minArea = mMinAreaProperty.valueAsDouble( context.
expressionContext(), minArea );
ProcessingSourceType
Processing data source types.
@ VectorPolygon
Vector polygon layers.
@ SkipGeometryValidityChecks
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
QFlags< ProcessingFeatureSourceFlag > ProcessingFeatureSourceFlags
Flags which control how QgsProcessingFeatureSource fetches features.
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.
Base class for providing feedback from a processing algorithm.
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...
Definition for a property.
@ DoublePositive
Positive double value (including 0).
A store for object properties.
QList< QgsFeature > QgsFeatureList