23 void QgsTransformAlgorithm::initParameters(
const QVariantMap & )
25 addParameter(
new QgsProcessingParameterCrs( QStringLiteral(
"TARGET_CRS" ), QObject::tr(
"Target CRS" ), QStringLiteral(
"EPSG:4326" ) ) );
33 QString QgsTransformAlgorithm::outputName()
const 35 return QObject::tr(
"Reprojected" );
38 QString QgsTransformAlgorithm::name()
const 40 return QStringLiteral(
"reprojectlayer" );
43 QString QgsTransformAlgorithm::displayName()
const 45 return QObject::tr(
"Reproject layer" );
48 QStringList QgsTransformAlgorithm::tags()
const 50 return QObject::tr(
"transform,reprojection,crs,srs,warp" ).split(
',' );
53 QString QgsTransformAlgorithm::group()
const 55 return QObject::tr(
"Vector general" );
58 QString QgsTransformAlgorithm::groupId()
const 60 return QStringLiteral(
"vectorgeneral" );
63 QString QgsTransformAlgorithm::shortHelpString()
const 65 return QObject::tr(
"This algorithm reprojects a vector layer. It creates a new layer with the same features " 66 "as the input one, but with geometries reprojected to a new CRS.\n\n" 67 "Attributes are not modified by this algorithm." );
70 QgsTransformAlgorithm *QgsTransformAlgorithm::createInstance()
const 72 return new QgsTransformAlgorithm();
77 mDestCrs = parameterAsCrs( parameters, QStringLiteral(
"TARGET_CRS" ), context );
85 if ( !mCreatedTransform )
87 mCreatedTransform =
true;
108 feedback->
reportError( QObject::tr(
"Encountered a transform error when reprojecting feature with id %1." ).arg( f.
id() ) );
Base class for providing feedback from a processing algorithm.
OperationResult transform(const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection direction=QgsCoordinateTransform::ForwardTransform, bool transformZ=false) SIP_THROW(QgsCsException)
Transforms this geometry as described by the coordinate transform ct.
QList< QgsFeature > QgsFeatureList
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.
QgsCoordinateTransformContext transformContext() const
Returns a copy of the project's coordinate transform context, which stores various information regard...
QgsProject * project() const
Returns the project in which the algorithm is being executed.
Contains information about the context in which a coordinate transform is executed.
QgsGeometry geometry() const
Returns the geometry associated with this feature.
A coordinate reference system parameter for processing algorithms.
void clearGeometry()
Removes any geometry associated with the feature.
This class represents a coordinate reference system (CRS).
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
Custom exception class for Coordinate Reference System related exceptions.
Contains information about the context in which a processing algorithm is executed.
virtual void reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.