22 QString QgsTranslateAlgorithm::name()
const 24 return QStringLiteral(
"translategeometry" );
27 QString QgsTranslateAlgorithm::displayName()
const 29 return QObject::tr(
"Translate" );
32 QStringList QgsTranslateAlgorithm::tags()
const 34 return QObject::tr(
"move,shift,transform,z,m,values,add" ).split(
',' );
37 QString QgsTranslateAlgorithm::group()
const 39 return QObject::tr(
"Vector geometry" );
42 QString QgsTranslateAlgorithm::groupId()
const 44 return QStringLiteral(
"vectorgeometry" );
47 QString QgsTranslateAlgorithm::outputName()
const 49 return QObject::tr(
"Translated" );
52 QString QgsTranslateAlgorithm::shortHelpString()
const 54 return QObject::tr(
"This algorithm moves the geometries within a layer, by offsetting them with a specified x and y displacement." )
55 + QStringLiteral(
"\n\n" )
56 + QObject::tr(
"Z and M values present in the geometry can also be translated." );
59 QgsTranslateAlgorithm *QgsTranslateAlgorithm::createInstance()
const 61 return new QgsTranslateAlgorithm();
64 void QgsTranslateAlgorithm::initParameters(
const QVariantMap & )
82 mDeltaX = parameterAsDouble( parameters, QStringLiteral(
"DELTA_X" ), context );
83 mDeltaY = parameterAsDouble( parameters, QStringLiteral(
"DELTA_Y" ), context );
84 mDeltaZ = parameterAsDouble( parameters, QStringLiteral(
"DELTA_Z" ), context );
85 mDeltaM = parameterAsDouble( parameters, QStringLiteral(
"DELTA_M" ), context );
101 geometry.
translate( mDeltaX, mDeltaY, mDeltaZ, mDeltaM );
bool isMeasure() const
Returns true if the geometry contains m values.
Base class for providing feedback from a processing algorithm.
QList< QgsFeature > QgsFeatureList
virtual bool addMValue(double mValue=0)=0
Adds a measure to the geometry, initialized to a preset value.
A geometry is the spatial representation of a feature.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
bool hasGeometry() const
Returns true if the feature has an associated geometry.
Type
The WKB type describes the number of dimensions a geometry has.
static Type addM(Type type)
Adds the m dimension to a WKB type and returns the new type.
static Type addZ(Type type)
Adds the z dimension to a WKB type and returns the new type.
QgsGeometry geometry() const
Returns the geometry associated with this feature.
A numeric parameter for processing algorithms.
QgsAbstractGeometry * get()
Returns a modifiable (non-const) reference to the underlying abstract geometry primitive.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
virtual bool addZValue(double zValue=0)=0
Adds a z-dimension to the geometry, initialized to a preset value.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
OperationResult translate(double dx, double dy, double dz=0.0, double dm=0.0)
Translates this geometry by dx, dy, dz and dm.
Contains information about the context in which a processing algorithm is executed.
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.