24 QString QgsDifferenceAlgorithm::name()
const 26 return QStringLiteral(
"difference" );
29 QString QgsDifferenceAlgorithm::displayName()
const 31 return QObject::tr(
"Difference" );
34 QString QgsDifferenceAlgorithm::group()
const 36 return QObject::tr(
"Vector overlay" );
39 QString QgsDifferenceAlgorithm::groupId()
const 41 return QStringLiteral(
"vectoroverlay" );
44 QString QgsDifferenceAlgorithm::shortHelpString()
const 46 return QObject::tr(
"This algorithm extracts features from the Input layer that fall outside, or partially overlap, features in the Overlay layer. " 47 "Input layer features that partially overlap feature(s) in the Overlay layer are split along those features' boundary " 48 "and only the portions outside the Overlay layer features are retained." )
49 + QStringLiteral(
"\n\n" )
50 + QObject::tr(
"Attributes are not modified, although properties such as area or length of the features will " 51 "be modified by the difference operation. If such properties are stored as attributes, those attributes will have to " 52 "be manually updated." );
55 bool QgsDifferenceAlgorithm::supportInPlaceEdit(
const QgsMapLayer *l )
const 64 QgsProcessingAlgorithm::Flags QgsDifferenceAlgorithm::flags()
const 73 return new QgsDifferenceAlgorithm();
76 void QgsDifferenceAlgorithm::initAlgorithm(
const QVariantMap & )
86 std::unique_ptr< QgsFeatureSource > sourceA( parameterAsSource( parameters, QStringLiteral(
"INPUT" ), context ) );
90 std::unique_ptr< QgsFeatureSource > sourceB( parameterAsSource( parameters, QStringLiteral(
"OVERLAY" ), context ) );
97 std::unique_ptr< QgsFeatureSink > sink( parameterAsSink( parameters, QStringLiteral(
"OUTPUT" ), context, dest, sourceA->fields(), geomType, sourceA->sourceCrs() ) );
102 outputs.insert( QStringLiteral(
"OUTPUT" ), dest );
105 int total = sourceA->featureCount();
106 QgsOverlayUtils::difference( *sourceA, *sourceB, *sink, context, feedback, count, total, QgsOverlayUtils::OutputA );
Base class for all map layer types.
static Type multiType(Type type)
Returns the multi type for a WKB type.
Base class for providing feedback from a processing algorithm.
Abstract base class for processing algorithms.
bool isSpatial() const FINAL
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeome...
A feature sink output for processing algorithms.
Type
The WKB type describes the number of dimensions a geometry has.
Custom exception class for processing related exceptions.
Algorithm supports in-place editing.
virtual Flags flags() const
Returns the flags indicating how and when the algorithm operates and should be exposed to users...
An input feature source (such as vector layers) parameter for processing algorithms.
Represents a vector layer which manages a vector based data sets.
Contains information about the context in which a processing algorithm is executed.