QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
src
analysis
processing
qgsalgorithmassignprojection.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsalgorithmassignprojection.cpp
3
--------------------------------
4
begin : April 2017
5
copyright : (C) 2017 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#include "
qgsalgorithmassignprojection.h
"
19
21
22
QString QgsAssignProjectionAlgorithm::name()
const
23
{
24
return
QStringLiteral(
"assignprojection"
);
25
}
26
27
QString QgsAssignProjectionAlgorithm::displayName()
const
28
{
29
return
QObject::tr(
"Assign projection"
);
30
}
31
32
QStringList QgsAssignProjectionAlgorithm::tags()
const
33
{
34
return
QObject::tr(
"assign,set,transform,reproject,crs,srs,warp"
).split(
','
);
35
}
36
37
QString QgsAssignProjectionAlgorithm::group()
const
38
{
39
return
QObject::tr(
"Vector general"
);
40
}
41
42
QString QgsAssignProjectionAlgorithm::groupId()
const
43
{
44
return
QStringLiteral(
"vectorgeneral"
);
45
}
46
47
QString QgsAssignProjectionAlgorithm::outputName()
const
48
{
49
return
QObject::tr(
"Assigned CRS"
);
50
}
51
52
QString QgsAssignProjectionAlgorithm::shortHelpString()
const
53
{
54
return
QObject::tr(
"This algorithm assigns a new projection to a vector layer. It creates a new layer with the exact same features "
55
"and geometries as the input one, but assigned to a new CRS. E.g. the geometries are not reprojected, they are just assigned "
56
"to a different CRS. This algorithm can be used to repair layers which have been assigned an incorrect projection.\n\n"
57
"Attributes are not modified by this algorithm."
);
58
}
59
60
QgsAssignProjectionAlgorithm *QgsAssignProjectionAlgorithm::createInstance()
const
61
{
62
return
new
QgsAssignProjectionAlgorithm();
63
}
64
65
bool
QgsAssignProjectionAlgorithm::supportInPlaceEdit(
const
QgsMapLayer
*layer )
const
66
{
67
Q_UNUSED( layer )
68
return
false
;
69
}
70
71
void
QgsAssignProjectionAlgorithm::initParameters(
const
QVariantMap & )
72
{
73
addParameter(
new
QgsProcessingParameterCrs
( QStringLiteral(
"CRS"
), QObject::tr(
"Assigned CRS"
), QStringLiteral(
"EPSG:4326"
) ) );
74
}
75
76
QgsProcessingFeatureSource::Flag
QgsAssignProjectionAlgorithm::sourceFlags()
const
77
{
78
return
QgsProcessingFeatureSource::FlagSkipGeometryValidityChecks
;
79
}
80
81
bool
QgsAssignProjectionAlgorithm::prepareAlgorithm(
const
QVariantMap ¶meters,
QgsProcessingContext
&context,
QgsProcessingFeedback
* )
82
{
83
mDestCrs = parameterAsCrs( parameters, QStringLiteral(
"CRS"
), context );
84
return
true
;
85
}
86
87
QgsFeatureList
QgsAssignProjectionAlgorithm::processFeature(
const
QgsFeature
&feature,
QgsProcessingContext
&,
QgsProcessingFeedback
* )
88
{
89
return
QgsFeatureList
() << feature;
90
}
91
93
QgsProcessingFeedback
Base class for providing feedback from a processing algorithm.
Definition:
qgsprocessingfeedback.h:37
QgsProcessingFeatureSource::FlagSkipGeometryValidityChecks
@ FlagSkipGeometryValidityChecks
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
Definition:
qgsprocessingutils.h:584
QgsProcessingParameterCrs
A coordinate reference system parameter for processing algorithms.
Definition:
qgsprocessingparameters.h:1740
QgsProcessingContext
Contains information about the context in which a processing algorithm is executed.
Definition:
qgsprocessingcontext.h:46
QgsFeatureList
QList< QgsFeature > QgsFeatureList
Definition:
qgsfeature.h:882
QgsProcessingFeatureSource::Flag
Flag
Flags controlling how QgsProcessingFeatureSource fetches features.
Definition:
qgsprocessingutils.h:582
QgsMapLayer
Base class for all map layer types. This is the base class for all map layer types (vector,...
Definition:
qgsmaplayer.h:72
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition:
qgsfeature.h:55
qgsalgorithmassignprojection.h
Generated on Sun Sep 11 2022 00:03:17 for QGIS API Documentation by
1.8.17