Skip to content

Commit

Permalink
[processing] rename algorithm to "Multi-ring buffer (constant distance)"
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Mar 2, 2018
1 parent 669beac commit df61548
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4766,7 +4766,7 @@ tests:
name: expected/biggest_parts.gml
type: vector

- algorithm: native:multiringbuffer
- algorithm: native:multiringconstantbuffer
name: Multi-ring buffer with points
params:
DISTANCE: 0.05
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ SET(QGIS_ANALYSIS_SRCS
processing/qgsalgorithmmergevector.cpp
processing/qgsalgorithmminimumenclosingcircle.cpp
processing/qgsalgorithmmultiparttosinglepart.cpp
processing/qgsalgorithmmultiringbuffer.cpp
processing/qgsalgorithmmultiringconstantbuffer.cpp
processing/qgsalgorithmorderbyexpression.cpp
processing/qgsalgorithmorientedminimumboundingbox.cpp
processing/qgsalgorithmpackage.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
qgsalgorithmnultitingbuffer.cpp
qgsalgorithmnultitingconstantbuffer.cpp
--------------------------
begin : February 2018
copyright : (C) 2018 by Alexander Bruy
Expand All @@ -15,51 +15,51 @@
* *
***************************************************************************/

#include "qgsalgorithmmultiringbuffer.h"
#include "qgsalgorithmmultiringconstantbuffer.h"

///@cond PRIVATE

QString QgsMultiRingBufferAlgorithm::name() const
QString QgsMultiRingConstantBufferAlgorithm::name() const
{
return QStringLiteral( "multiringbuffer" );
return QStringLiteral( "multiringconstantbuffer" );
}

QString QgsMultiRingBufferAlgorithm::displayName() const
QString QgsMultiRingConstantBufferAlgorithm::displayName() const
{
return QObject::tr( "Multi-ring buffer" );
return QObject::tr( "Multi-ring buffer (constant distance)" );
}

QStringList QgsMultiRingBufferAlgorithm::tags() const
QStringList QgsMultiRingConstantBufferAlgorithm::tags() const
{
return QObject::tr( "buffer,grow,multiple,rings,distance,donut" ).split( ',' );
}

QString QgsMultiRingBufferAlgorithm::group() const
QString QgsMultiRingConstantBufferAlgorithm::group() const
{
return QObject::tr( "Vector geometry" );
}

QString QgsMultiRingBufferAlgorithm::groupId() const
QString QgsMultiRingConstantBufferAlgorithm::groupId() const
{
return QStringLiteral( "vectorgeometry" );
}

QString QgsMultiRingBufferAlgorithm::outputName() const
QString QgsMultiRingConstantBufferAlgorithm::outputName() const
{
return QObject::tr( "Multi-ring buffer" );
return QObject::tr( "Multi-ring buffer (constant distance)" );
}

QString QgsMultiRingBufferAlgorithm::shortHelpString() const
QString QgsMultiRingConstantBufferAlgorithm::shortHelpString() const
{
return QObject::tr( "This algorithm computes multi-ring ('donuts') buffer for all the features in an input layer, using a fixed or dynamic distance and rings number." );
}

QgsMultiRingBufferAlgorithm *QgsMultiRingBufferAlgorithm::createInstance() const
QgsMultiRingConstantBufferAlgorithm *QgsMultiRingConstantBufferAlgorithm::createInstance() const
{
return new QgsMultiRingBufferAlgorithm();
return new QgsMultiRingConstantBufferAlgorithm();
}

void QgsMultiRingBufferAlgorithm::initParameters( const QVariantMap & )
void QgsMultiRingConstantBufferAlgorithm::initParameters( const QVariantMap & )
{
std::unique_ptr< QgsProcessingParameterNumber> rings = qgis::make_unique< QgsProcessingParameterNumber >( QStringLiteral( "RINGS" ),
QObject::tr( "Number of rings" ), QgsProcessingParameterNumber::Integer,
Expand All @@ -78,7 +78,7 @@ void QgsMultiRingBufferAlgorithm::initParameters( const QVariantMap & )
addParameter( distance.release() );
}

bool QgsMultiRingBufferAlgorithm::prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback * )
bool QgsMultiRingConstantBufferAlgorithm::prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback * )
{
mRingsNumber = parameterAsInt( parameters, QStringLiteral( "RINGS" ), context );
mDynamicRingsNumber = QgsProcessingParameters::isDynamic( parameters, QStringLiteral( "RINGS" ) );
Expand All @@ -93,15 +93,15 @@ bool QgsMultiRingBufferAlgorithm::prepareAlgorithm( const QVariantMap &parameter
return true;
}

QgsFields QgsMultiRingBufferAlgorithm::outputFields( const QgsFields &inputFields ) const
QgsFields QgsMultiRingConstantBufferAlgorithm::outputFields( const QgsFields &inputFields ) const
{
QgsFields fields = inputFields;
fields.append( QgsField( QStringLiteral( "ringId" ), QVariant::Int, QString(), 10, 0 ) );
fields.append( QgsField( QStringLiteral( "distance" ), QVariant::Double, QString(), 20, 6 ) );
return fields;
}

QgsFeatureList QgsMultiRingBufferAlgorithm::processFeature( const QgsFeature &feature, QgsProcessingContext &, QgsProcessingFeedback *feedback )
QgsFeatureList QgsMultiRingConstantBufferAlgorithm::processFeature( const QgsFeature &feature, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
{
double currentDistance = 0;
QgsGeometry outputGeometry, previousGeometry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
qgsalgorithmmultiringbuffer.h
qgsalgorithmmultiringconstantbuffer.h
-------------------------
begin : February 2018
copyright : (C) 2018 by Alexander Bruy
Expand All @@ -15,8 +15,8 @@
* *
***************************************************************************/

#ifndef QGSALGORITHMMULTIRINGBUFFER_H
#define QGSALGORITHMMULTIRINGBUFFER_H
#ifndef QGSALGORITHMMULTIRINGCONSTANTBUFFER_H
#define QGSALGORITHMMULTIRINGCONSTANTBUFFER_H

#define SIP_NO_FILE

Expand All @@ -28,19 +28,19 @@
/**
* Native multiring buffer algorithm.
*/
class QgsMultiRingBufferAlgorithm : public QgsProcessingFeatureBasedAlgorithm
class QgsMultiRingConstantBufferAlgorithm : public QgsProcessingFeatureBasedAlgorithm
{

public:

QgsMultiRingBufferAlgorithm() = default;
QgsMultiRingConstantBufferAlgorithm() = default;
QString name() const override;
QString displayName() const override;
QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsMultiRingBufferAlgorithm *createInstance() const override SIP_FACTORY;
QgsMultiRingConstantBufferAlgorithm *createInstance() const override SIP_FACTORY;
void initParameters( const QVariantMap &configuration = QVariantMap() ) override;

protected:
Expand All @@ -64,6 +64,6 @@ class QgsMultiRingBufferAlgorithm : public QgsProcessingFeatureBasedAlgorithm

///@endcond PRIVATE

#endif // QGSALGORITHMMULTIRINGBUFFER_H
#endif // QGSALGORITHMMULTIRINGCONSTANTBUFFER_H


4 changes: 2 additions & 2 deletions src/analysis/processing/qgsnativealgorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include "qgsalgorithmmergevector.h"
#include "qgsalgorithmminimumenclosingcircle.h"
#include "qgsalgorithmmultiparttosinglepart.h"
#include "qgsalgorithmmultiringbuffer.h"
#include "qgsalgorithmmultiringconstantbuffer.h"
#include "qgsalgorithmorderbyexpression.h"
#include "qgsalgorithmorientedminimumboundingbox.h"
#include "qgsalgorithmpackage.h"
Expand Down Expand Up @@ -135,7 +135,7 @@ void QgsNativeAlgorithms::loadAlgorithms()
addAlgorithm( new QgsMergeVectorAlgorithm() );
addAlgorithm( new QgsMinimumEnclosingCircleAlgorithm() );
addAlgorithm( new QgsMultipartToSinglepartAlgorithm() );
addAlgorithm( new QgsMultiRingBufferAlgorithm() );
addAlgorithm( new QgsMultiRingConstantBufferAlgorithm() );
addAlgorithm( new QgsOrderByExpressionAlgorithm() );
addAlgorithm( new QgsOrientedMinimumBoundingBoxAlgorithm() );
addAlgorithm( new QgsPackageAlgorithm() );
Expand Down

0 comments on commit df61548

Please sign in to comment.