QGIS API Documentation  3.2.0-Bonn (bc43194)
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 
19 
21 
22 QString QgsDropGeometryAlgorithm::name() const
23 {
24  return QStringLiteral( "dropgeometries" );
25 }
26 
27 QString QgsDropGeometryAlgorithm::displayName() const
28 {
29  return QObject::tr( "Drop geometries" );
30 }
31 
32 QStringList QgsDropGeometryAlgorithm::tags() const
33 {
34  return QObject::tr( "remove,drop,delete,geometry,objects" ).split( ',' );
35 }
36 
37 QString QgsDropGeometryAlgorithm::group() const
38 {
39  return QObject::tr( "Vector general" );
40 }
41 
42 QString QgsDropGeometryAlgorithm::groupId() const
43 {
44  return QStringLiteral( "vectorgeneral" );
45 }
46 
47 QString QgsDropGeometryAlgorithm::outputName() const
48 {
49  return QObject::tr( "Dropped geometries" );
50 }
51 
52 QString QgsDropGeometryAlgorithm::shortHelpString() const
53 {
54  return QObject::tr( "This algorithm removes any geometries from an input layer and returns a layer containing only the feature attributes." );
55 }
56 
57 QgsDropGeometryAlgorithm *QgsDropGeometryAlgorithm::createInstance() const
58 {
59  return new QgsDropGeometryAlgorithm();
60 }
61 
62 QgsCoordinateReferenceSystem QgsDropGeometryAlgorithm::outputCrs( const QgsCoordinateReferenceSystem & ) const
63 {
65 }
66 
67 QgsWkbTypes::Type QgsDropGeometryAlgorithm::outputWkbType( QgsWkbTypes::Type ) const
68 {
70 }
71 
72 QgsProcessingFeatureSource::Flag QgsDropGeometryAlgorithm::sourceFlags() const
73 {
75 }
76 
77 QgsFeatureRequest QgsDropGeometryAlgorithm::request() const
78 {
80 }
81 
82 QgsFeatureList QgsDropGeometryAlgorithm::processFeature( const QgsFeature &feature, QgsProcessingContext &, QgsProcessingFeedback * )
83 {
84  QgsFeature f = feature;
85  f.clearGeometry();
86  return QgsFeatureList() << f;
87 }
88 
Base class for providing feedback from a processing algorithm.
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:549
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:62
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:67
This class wraps a request for features to a vector layer (or directly its vector data provider)...
Flag
Flags controlling how QgsProcessingFeatureSource fetches features.
void clearGeometry()
Removes any geometry associated with the feature.
Definition: qgsfeature.cpp:144
This class represents a coordinate reference system (CRS).
Geometry is not required. It may still be returned if e.g. required for a filter condition.
Contains information about the context in which a processing algorithm is executed.
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Sets flags that affect how features will be fetched.