mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Difference and split with lines can be used in in-place mode
This commit is contained in:
parent
b4883eecba
commit
8951e153f0
@ -16,6 +16,7 @@
|
||||
#include "qgsalgorithmdifference.h"
|
||||
|
||||
#include "qgsoverlayutils.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
|
||||
///@cond PRIVATE
|
||||
|
||||
@ -51,6 +52,22 @@ QString QgsDifferenceAlgorithm::shortHelpString() const
|
||||
"be manually updated." );
|
||||
}
|
||||
|
||||
bool QgsDifferenceAlgorithm::supportInPlaceEdit( const QgsMapLayer *l ) const
|
||||
{
|
||||
const QgsVectorLayer *layer = qobject_cast< const QgsVectorLayer * >( l );
|
||||
if ( !layer )
|
||||
return false;
|
||||
|
||||
return layer->isSpatial();
|
||||
}
|
||||
|
||||
QgsProcessingAlgorithm::Flags QgsDifferenceAlgorithm::flags() const
|
||||
{
|
||||
Flags f = QgsProcessingAlgorithm::flags();
|
||||
f |= QgsProcessingAlgorithm::FlagSupportsInPlaceEdits;
|
||||
return f;
|
||||
}
|
||||
|
||||
QgsProcessingAlgorithm *QgsDifferenceAlgorithm::createInstance() const
|
||||
{
|
||||
return new QgsDifferenceAlgorithm();
|
||||
|
@ -33,7 +33,8 @@ class QgsDifferenceAlgorithm : public QgsProcessingAlgorithm
|
||||
QString group() const override;
|
||||
QString groupId() const override;
|
||||
QString shortHelpString() const override;
|
||||
|
||||
bool supportInPlaceEdit( const QgsMapLayer *layer ) const override;
|
||||
QgsProcessingAlgorithm::Flags flags() const override;
|
||||
protected:
|
||||
QgsProcessingAlgorithm *createInstance() const override;
|
||||
void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "qgsalgorithmsplitwithlines.h"
|
||||
#include "qgsgeometryengine.h"
|
||||
|
||||
#include "qgsvectorlayer.h"
|
||||
///@cond PRIVATE
|
||||
|
||||
QString QgsSplitWithLinesAlgorithm::name() const
|
||||
@ -65,6 +65,22 @@ QgsSplitWithLinesAlgorithm *QgsSplitWithLinesAlgorithm::createInstance() const
|
||||
return new QgsSplitWithLinesAlgorithm();
|
||||
}
|
||||
|
||||
QgsProcessingAlgorithm::Flags QgsSplitWithLinesAlgorithm::flags() const
|
||||
{
|
||||
Flags f = QgsProcessingAlgorithm::flags();
|
||||
f |= QgsProcessingAlgorithm::FlagSupportsInPlaceEdits;
|
||||
return f;
|
||||
}
|
||||
|
||||
bool QgsSplitWithLinesAlgorithm::supportInPlaceEdit( const QgsMapLayer *l ) const
|
||||
{
|
||||
const QgsVectorLayer *layer = qobject_cast< const QgsVectorLayer * >( l );
|
||||
if ( !layer )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariantMap QgsSplitWithLinesAlgorithm::processAlgorithm( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
|
||||
{
|
||||
std::unique_ptr< QgsFeatureSource > source( parameterAsSource( parameters, QStringLiteral( "INPUT" ), context ) );
|
||||
|
@ -43,7 +43,8 @@ class QgsSplitWithLinesAlgorithm : public QgsProcessingAlgorithm
|
||||
QString groupId() const override;
|
||||
QString shortHelpString() const override;
|
||||
QgsSplitWithLinesAlgorithm *createInstance() const override SIP_FACTORY;
|
||||
|
||||
QgsProcessingAlgorithm::Flags flags() const override;
|
||||
bool supportInPlaceEdit( const QgsMapLayer *layer ) const override;
|
||||
protected:
|
||||
|
||||
QVariantMap processAlgorithm( const QVariantMap ¶meters,
|
||||
|
Loading…
x
Reference in New Issue
Block a user