22 QString QgsSymmetricalDifferenceAlgorithm::name()
const 24 return QStringLiteral(
"symmetricaldifference" );
27 QString QgsSymmetricalDifferenceAlgorithm::displayName()
const 29 return QObject::tr(
"Symmetrical difference" );
32 QString QgsSymmetricalDifferenceAlgorithm::group()
const 34 return QObject::tr(
"Vector overlay" );
37 QString QgsSymmetricalDifferenceAlgorithm::groupId()
const 39 return QStringLiteral(
"vectoroverlay" );
42 QString QgsSymmetricalDifferenceAlgorithm::shortHelpString()
const 44 return QObject::tr(
"This algorithm creates a layer containing features from both the Input and Difference layers but with the overlapping areas between the two layers removed. The attribute table of the Symmetrical Difference layer contains attributes from both the Input and Difference layers." );
49 return new QgsSymmetricalDifferenceAlgorithm();
52 void QgsSymmetricalDifferenceAlgorithm::initAlgorithm(
const QVariantMap & )
62 std::unique_ptr< QgsFeatureSource > sourceA( parameterAsSource( parameters, QStringLiteral(
"INPUT" ), context ) );
66 std::unique_ptr< QgsFeatureSource > sourceB( parameterAsSource( parameters, QStringLiteral(
"OVERLAY" ), context ) );
75 std::unique_ptr< QgsFeatureSink > sink( parameterAsSink( parameters, QStringLiteral(
"OUTPUT" ), context, dest, fields, geomType, sourceA->sourceCrs() ) );
80 outputs.insert( QStringLiteral(
"OUTPUT" ), dest );
83 int total = sourceA->featureCount() + sourceB->featureCount();
85 QgsOverlayUtils::difference( *sourceA.get(), *sourceB.get(), *sink.get(), context, feedback, count, total, QgsOverlayUtils::OutputAB );
87 QgsOverlayUtils::difference( *sourceB.get(), *sourceA.get(), *sink.get(), context, feedback, count, total, QgsOverlayUtils::OutputBA );
static Type multiType(Type type)
Returns the multi type for a WKB type.
Base class for providing feedback from a processing algorithm.
Container of fields for a vector layer.
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.
static QgsFields combineFields(const QgsFields &fieldsA, const QgsFields &fieldsB)
Combines two field lists, avoiding duplicate field names (in a case-insensitive manner).
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.