QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
src
analysis
processing
qgsalgorithmdropgeometry.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsalgorithmdropgeometry.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 "
qgsalgorithmdropgeometry.h
"
19
#include "
qgsvectorlayer.h
"
20
22
23
QString QgsDropGeometryAlgorithm::name()
const
24
{
25
return
QStringLiteral(
"dropgeometries"
);
26
}
27
28
QString QgsDropGeometryAlgorithm::displayName()
const
29
{
30
return
QObject::tr(
"Drop geometries"
);
31
}
32
33
QStringList QgsDropGeometryAlgorithm::tags()
const
34
{
35
return
QObject::tr(
"remove,drop,delete,geometry,objects"
).split(
','
);
36
}
37
38
QString QgsDropGeometryAlgorithm::group()
const
39
{
40
return
QObject::tr(
"Vector general"
);
41
}
42
43
QString QgsDropGeometryAlgorithm::groupId()
const
44
{
45
return
QStringLiteral(
"vectorgeneral"
);
46
}
47
48
QString QgsDropGeometryAlgorithm::outputName()
const
49
{
50
return
QObject::tr(
"Dropped geometries"
);
51
}
52
53
QString QgsDropGeometryAlgorithm::shortHelpString()
const
54
{
55
return
QObject::tr(
"This algorithm removes any geometries from an input layer and returns a layer containing only the feature attributes."
);
56
}
57
58
QgsDropGeometryAlgorithm *QgsDropGeometryAlgorithm::createInstance()
const
59
{
60
return
new
QgsDropGeometryAlgorithm();
61
}
62
63
QgsCoordinateReferenceSystem
QgsDropGeometryAlgorithm::outputCrs
(
const
QgsCoordinateReferenceSystem
& )
const
64
{
65
return
QgsCoordinateReferenceSystem
();
66
}
67
68
bool
QgsDropGeometryAlgorithm::supportInPlaceEdit(
const
QgsMapLayer
*l )
const
69
{
70
return
qobject_cast< const QgsVectorLayer * >( l );
71
}
72
73
QgsWkbTypes::Type
QgsDropGeometryAlgorithm::outputWkbType(
QgsWkbTypes::Type
)
const
74
{
75
return
QgsWkbTypes::NoGeometry
;
76
}
77
78
QgsProcessingFeatureSource::Flag
QgsDropGeometryAlgorithm::sourceFlags()
const
79
{
80
return
QgsProcessingFeatureSource::FlagSkipGeometryValidityChecks
;
81
}
82
83
QgsFeatureRequest
QgsDropGeometryAlgorithm::request()
const
84
{
85
return
QgsFeatureRequest
().
setFlags
(
QgsFeatureRequest::NoGeometry
);
86
}
87
88
QgsFeatureList
QgsDropGeometryAlgorithm::processFeature(
const
QgsFeature
&feature,
QgsProcessingContext
&,
QgsProcessingFeedback
* )
89
{
90
QgsFeature
f = feature;
91
f.
clearGeometry
();
92
return
QgsFeatureList
() << f;
93
}
94
QgsFeatureRequest::NoGeometry
@ NoGeometry
Geometry is not required. It may still be returned if e.g. required for a filter condition.
Definition:
qgsfeaturerequest.h:81
outputCrs
const QgsCoordinateReferenceSystem & outputCrs
Definition:
qgswfsgetfeature.cpp:61
QgsProcessingFeedback
Base class for providing feedback from a processing algorithm.
Definition:
qgsprocessingfeedback.h:38
QgsProcessingFeatureSource::FlagSkipGeometryValidityChecks
@ FlagSkipGeometryValidityChecks
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
Definition:
qgsprocessingutils.h:477
QgsWkbTypes::Type
Type
The WKB type describes the number of dimensions a geometry has.
Definition:
qgswkbtypes.h:70
QgsFeature::clearGeometry
void clearGeometry()
Removes any geometry associated with the feature.
Definition:
qgsfeature.cpp:153
QgsFeatureRequest
This class wraps a request for features to a vector layer (or directly its vector data provider).
Definition:
qgsfeaturerequest.h:76
QgsProcessingContext
Contains information about the context in which a processing algorithm is executed.
Definition:
qgsprocessingcontext.h:44
QgsFeatureList
QList< QgsFeature > QgsFeatureList
Definition:
qgsfeature.h:583
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition:
qgscoordinatereferencesystem.h:206
qgsalgorithmdropgeometry.h
qgsvectorlayer.h
QgsProcessingFeatureSource::Flag
Flag
Flags controlling how QgsProcessingFeatureSource fetches features.
Definition:
qgsprocessingutils.h:476
QgsWkbTypes::NoGeometry
@ NoGeometry
Definition:
qgswkbtypes.h:85
QgsMapLayer
Base class for all map layer types.
Definition:
qgsmaplayer.h:83
QgsFeature
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition:
qgsfeature.h:56
QgsFeatureRequest::setFlags
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Sets flags that affect how features will be fetched.
Definition:
qgsfeaturerequest.cpp:179
Generated on Sat Oct 24 2020 17:43:09 for QGIS API Documentation by
1.8.20