Skip to content
Permalink
Browse files

Enable in-place buffer on polygons

Fixes #20101 - "Buffer" is not listed as an edit in place algorithm for polygon layer
  • Loading branch information
elpaso committed Oct 18, 2018
1 parent 89058ba commit 51c3c2a6182684961572a0e1f90c6d8c55af21ea
Showing with 22 additions and 0 deletions.
  1. +18 −0 src/analysis/processing/qgsalgorithmbuffer.cpp
  2. +4 −0 src/analysis/processing/qgsalgorithmbuffer.h
@@ -16,6 +16,8 @@
***************************************************************************/

#include "qgsalgorithmbuffer.h"
#include "qgswkbtypes.h"
#include "qgsvectorlayer.h"

///@cond PRIVATE

@@ -165,4 +167,20 @@ QVariantMap QgsBufferAlgorithm::processAlgorithm( const QVariantMap &parameters,
return outputs;
}

QgsProcessingAlgorithm::Flags QgsBufferAlgorithm::flags() const
{
Flags f = QgsProcessingAlgorithm::flags();
f |= QgsProcessingAlgorithm::FlagSupportsInPlaceEdits;
return f;
}

bool QgsBufferAlgorithm::supportInPlaceEdit( const QgsMapLayer *layer ) const
{
const QgsVectorLayer *vlayer = qobject_cast< const QgsVectorLayer * >( layer );
if ( !vlayer )
return false;
QgsWkbTypes::GeometryType inPlaceGeometryType = vlayer->geometryType();
return inPlaceGeometryType == QgsWkbTypes::GeometryType::PolygonGeometry;
}

///@endcond
@@ -44,12 +44,16 @@ class QgsBufferAlgorithm : public QgsProcessingAlgorithm
QString groupId() const override;
QString shortHelpString() const override;
QgsBufferAlgorithm *createInstance() const override SIP_FACTORY;
bool supportInPlaceEdit( const QgsMapLayer *layer ) const override;
QgsProcessingAlgorithm::Flags flags() const override;


protected:

QVariantMap processAlgorithm( const QVariantMap &parameters,
QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;


};

///@endcond PRIVATE

0 comments on commit 51c3c2a

Please sign in to comment.
You can’t perform that action at this time.