23 QgsProcessingAlgorithm::Flags QgsSaveSelectedFeatures::flags()
const 28 void QgsSaveSelectedFeatures::initAlgorithm(
const QVariantMap & )
35 QString QgsSaveSelectedFeatures::name()
const 37 return QStringLiteral(
"saveselectedfeatures" );
40 QString QgsSaveSelectedFeatures::displayName()
const 42 return QObject::tr(
"Extract selected features" );
45 QStringList QgsSaveSelectedFeatures::tags()
const 47 return QObject::tr(
"selection,save,by" ).split(
',' );
50 QString QgsSaveSelectedFeatures::group()
const 52 return QObject::tr(
"Vector general" );
55 QString QgsSaveSelectedFeatures::groupId()
const 57 return QStringLiteral(
"vectorgeneral" );
60 QString QgsSaveSelectedFeatures::shortHelpString()
const 62 return QObject::tr(
"This algorithm creates a new layer with all the selected features in a given vector layer.\n\n" 63 "If the selected layer has no selected features, the newly created layer will be empty." );
66 QgsSaveSelectedFeatures *QgsSaveSelectedFeatures::createInstance()
const 68 return new QgsSaveSelectedFeatures();
73 QgsVectorLayer *selectLayer = parameterAsVectorLayer( parameters, QStringLiteral(
"INPUT" ), context );
78 std::unique_ptr< QgsFeatureSink > sink( parameterAsSink( parameters, QStringLiteral(
"OUTPUT" ), context, dest, selectLayer->
fields(), selectLayer->
wkbType(), selectLayer->
sourceCrs() ) );
85 double step = count > 0 ? 100.0 / count : 1;
102 outputs.insert( QStringLiteral(
"OUTPUT" ), dest );
Wrapper for iterator of features from vector data provider or vector layer.
Use faster inserts, at the cost of updating the passed features to reflect changes made at the provid...
Base class for providing feedback from a processing algorithm.
QgsWkbTypes::Type wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
int selectedFeatureCount() const
Returns the number of features that are selected in this layer.
void setProgress(double progress)
Sets the current progress for the feedback object.
virtual Flags flags() const
Returns the flags indicating how and when the algorithm operates and should be exposed to users...
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
A feature sink output for processing algorithms.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
Algorithm is not thread safe and cannot be run in a background thread, e.g. for algorithms which mani...
QgsFeatureIterator getSelectedFeatures(QgsFeatureRequest request=QgsFeatureRequest()) const
Returns an iterator of the selected features.
Custom exception class for processing related exceptions.
A vector layer (with or without geometry) parameter for processing algorithms.
bool isCanceled() const
Tells whether the operation has been canceled already.
Tables (i.e. vector layers with or without geometry). When used for a sink this indicates the sink ha...
QgsCoordinateReferenceSystem sourceCrs() const FINAL
Returns the coordinate reference system for features in the source.
bool nextFeature(QgsFeature &f)
Represents a vector layer which manages a vector based data sets.
Contains information about the context in which a processing algorithm is executed.