23void QgsSaveSelectedFeatures::initAlgorithm(
const QVariantMap & )
29QString QgsSaveSelectedFeatures::name()
const
31 return QStringLiteral(
"saveselectedfeatures" );
34QString QgsSaveSelectedFeatures::displayName()
const
36 return QObject::tr(
"Extract selected features" );
39QStringList QgsSaveSelectedFeatures::tags()
const
41 return QObject::tr(
"selection,save,by" ).split(
',' );
44QString QgsSaveSelectedFeatures::group()
const
46 return QObject::tr(
"Vector general" );
49QString QgsSaveSelectedFeatures::groupId()
const
51 return QStringLiteral(
"vectorgeneral" );
54QString QgsSaveSelectedFeatures::shortHelpString()
const
56 return QObject::tr(
"This algorithm creates a new layer with all the selected features in a given vector layer.\n\n"
57 "If the selected layer has no selected features, the newly created layer will be empty." );
60QgsSaveSelectedFeatures *QgsSaveSelectedFeatures::createInstance()
const
62 return new QgsSaveSelectedFeatures();
67 QgsVectorLayer *selectLayer = parameterAsVectorLayer( parameters, QStringLiteral(
"INPUT" ), context );
77 QgsVectorLayer *selectLayer = parameterAsVectorLayer( parameters, QStringLiteral(
"INPUT" ), context );
82 std::unique_ptr<QgsFeatureSink> sink( parameterAsSink( parameters, QStringLiteral(
"OUTPUT" ), context, dest, selectLayer->
fields(), selectLayer->
wkbType(), selectLayer->
sourceCrs() ) );
87 const int count = mSelection.count();
89 const double step = count > 0 ? 100.0 / count : 1;
109 outputs.insert( QStringLiteral(
"OUTPUT" ), dest );
@ Vector
Tables (i.e. vector layers with or without geometry). When used for a sink this indicates the sink ha...
Wrapper for iterator of features from vector data provider or vector layer.
bool nextFeature(QgsFeature &f)
Fetch next feature and stores in f, returns true on success.
This class wraps a request for features to a vector layer (or directly its vector data provider).
@ FastInsert
Use faster inserts, at the cost of updating the passed features to reflect changes made at the provid...
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
bool isCanceled() const
Tells whether the operation has been canceled already.
void setProgress(double progress)
Sets the current progress for the feedback object.
Contains information about the context in which a processing algorithm is executed.
Custom exception class for processing related exceptions.
Base class for providing feedback from a processing algorithm.
A feature sink output for processing algorithms.
A vector layer (with or without geometry) parameter for processing algorithms.
Represents a vector layer which manages a vector based data sets.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL
Queries the layer for features specified in request.
QgsCoordinateReferenceSystem sourceCrs() const FINAL
Returns the coordinate reference system for features in the source.
Q_INVOKABLE const QgsFeatureIds & selectedFeatureIds() const
Returns a list of the selected features IDs in this layer.
Q_INVOKABLE Qgis::WkbType wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.