23 QString QgsDifferenceAlgorithm::name()
const 25 return QStringLiteral(
"difference" );
28 QString QgsDifferenceAlgorithm::displayName()
const 30 return QObject::tr(
"Difference" );
33 QString QgsDifferenceAlgorithm::group()
const 35 return QObject::tr(
"Vector overlay" );
38 QString QgsDifferenceAlgorithm::groupId()
const 40 return QStringLiteral(
"vectoroverlay" );
43 QString QgsDifferenceAlgorithm::shortHelpString()
const 45 return QObject::tr(
"This algorithm extracts features from the Input layer that fall outside, or partially overlap, features in the Difference layer. Input layer features that partially overlap the difference layer feature(s) are split along the boundary of the difference layer feature(s) and only the portions outside the difference layer features are retained." )
46 + QStringLiteral(
"\n\n" )
47 + QObject::tr(
"Attributes are not modified." );
52 return new QgsDifferenceAlgorithm();
55 void QgsDifferenceAlgorithm::initAlgorithm(
const QVariantMap & )
65 std::unique_ptr< QgsFeatureSource > sourceA( parameterAsSource( parameters, QStringLiteral(
"INPUT" ), context ) );
69 std::unique_ptr< QgsFeatureSource > sourceB( parameterAsSource( parameters, QStringLiteral(
"OVERLAY" ), context ) );
76 std::unique_ptr< QgsFeatureSink > sink( parameterAsSink( parameters, QStringLiteral(
"OUTPUT" ), context, dest, sourceA->fields(), geomType, sourceA->sourceCrs() ) );
81 outputs.insert( QStringLiteral(
"OUTPUT" ), dest );
84 int total = sourceA->featureCount();
85 QgsOverlayUtils::difference( *sourceA.get(), *sourceB.get(), *sink.get(), context, feedback, count, total, QgsOverlayUtils::OutputA );
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.
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.
An input feature source (such as vector layers) parameter for processing algorithms.
Contains information about the context in which a processing algorithm is executed.