24using namespace Qt::StringLiterals;
28QString QgsSetZValueAlgorithm::name()
const
30 return u
"setzvalue"_s;
33QString QgsSetZValueAlgorithm::displayName()
const
35 return QObject::tr(
"Set Z value" );
38QStringList QgsSetZValueAlgorithm::tags()
const
40 return QObject::tr(
"set,add,z,25d,3d,values" ).split(
',' );
43QString QgsSetZValueAlgorithm::group()
const
45 return QObject::tr(
"Vector geometry" );
48QString QgsSetZValueAlgorithm::groupId()
const
50 return u
"vectorgeometry"_s;
53QString QgsSetZValueAlgorithm::shortHelpString()
const
55 return QObject::tr(
"This algorithm sets the Z value for geometries in a layer.\n\n"
56 "If Z values already exist in the layer, they will be overwritten "
57 "with the new value. If no Z values exist, the geometry will be "
58 "upgraded to include Z values and the specified value used as "
59 "the initial Z value for all geometries." );
62QString QgsSetZValueAlgorithm::shortDescription()
const
64 return QObject::tr(
"Sets the Z value for geometries in a layer." );
67QString QgsSetZValueAlgorithm::outputName()
const
69 return QObject::tr(
"Z Added" );
72QgsSetZValueAlgorithm *QgsSetZValueAlgorithm::createInstance()
const
74 return new QgsSetZValueAlgorithm();
77bool QgsSetZValueAlgorithm::supportInPlaceEdit(
const QgsMapLayer *l )
const
79 const QgsVectorLayer *layer = qobject_cast<const QgsVectorLayer *>( l );
96void QgsSetZValueAlgorithm::initParameters(
const QVariantMap & )
99 zValueParam->setIsDynamic(
true );
101 zValueParam->setDynamicLayerParameterName( u
"INPUT"_s );
102 addParameter( zValueParam.release() );
107 mZValue = parameterAsDouble( parameters, u
"Z_VALUE"_s, context );
109 if ( mDynamicZValue )
110 mZValueProperty = parameters.value( u
"Z_VALUE"_s ).value<
QgsProperty>();
124 newGeometry->dropZValue();
127 if ( mDynamicZValue )
130 newGeometry->addZValue( z );
@ SkipGeometryValidityChecks
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
WkbType
The WKB type describes the number of dimensions a geometry has.
QFlags< ProcessingFeatureSourceFlag > ProcessingFeatureSourceFlags
Flags which control how QgsProcessingFeatureSource fetches features.
@ Double
Double/float values.
virtual QgsAbstractGeometry * clone() const =0
Clones the geometry by performing a deep copy.
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.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
Base class for all map layer types.
Contains information about the context in which a processing algorithm is executed.
QgsExpressionContext & expressionContext()
Returns the expression context.
bool supportInPlaceEdit(const QgsMapLayer *layer) const override
Checks whether this algorithm supports in-place editing on the given layer Default implementation for...
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.
@ Double
Double value (including negative values).
A store for object properties.
Represents a vector layer which manages a vector based dataset.
Q_INVOKABLE Qgis::WkbType wkbType() const final
Returns the WKBType or WKBUnknown in case of error.
static Qgis::WkbType addZ(Qgis::WkbType type)
Adds the z dimension to a WKB type and returns the new type.
static Q_INVOKABLE bool hasZ(Qgis::WkbType type)
Tests whether a WKB type contains the z-dimension.
QList< QgsFeature > QgsFeatureList