22QString QgsTaperedBufferAlgorithm::name()
 const 
   24  return QStringLiteral( 
"taperedbuffer" );
 
   27QString QgsTaperedBufferAlgorithm::displayName()
 const 
   29  return QObject::tr( 
"Tapered buffers" );
 
   32QStringList QgsTaperedBufferAlgorithm::tags()
 const 
   34  return QObject::tr( 
"variable,distance,length,line,buffer" ).split( 
',' );
 
   37QString QgsTaperedBufferAlgorithm::group()
 const 
   39  return QObject::tr( 
"Vector geometry" );
 
   42QString QgsTaperedBufferAlgorithm::groupId()
 const 
   44  return QStringLiteral( 
"vectorgeometry" );
 
   47QString QgsTaperedBufferAlgorithm::outputName()
 const 
   49  return QObject::tr( 
"Buffered" );
 
   64  mStartWidth = parameterAsDouble( parameters, QStringLiteral( 
"START_WIDTH" ), context );
 
   66  if ( mDynamicStartWidth )
 
   67    mStartWidthProperty = parameters.value( QStringLiteral( 
"START_WIDTH" ) ).value<
QgsProperty>();
 
   69  mEndWidth = parameterAsDouble( parameters, QStringLiteral( 
"END_WIDTH" ), context );
 
   71  if ( mDynamicEndWidth )
 
   72    mEndWidthProperty = parameters.value( QStringLiteral( 
"END_WIDTH" ) ).value<
QgsProperty>();
 
   74  mSegments = parameterAsInt( parameters, QStringLiteral( 
"Segments" ), context );
 
   76  if ( mDynamicSegments )
 
   77    mSegmentsProperty = parameters.value( QStringLiteral( 
"Segments" ) ).value<
QgsProperty>();
 
   82QString QgsTaperedBufferAlgorithm::shortHelpString()
 const 
   84  return QObject::tr( 
"This algorithm creates tapered buffers along line geometries, using a specified start and " 
   85                      "end buffer diameter corresponding to the buffer diameter at the start and end of the linestrings." );
 
   88QString QgsTaperedBufferAlgorithm::shortDescription()
 const 
   90  return QObject::tr( 
"Creates tapered buffers along line geometries." );
 
   93QList<int> QgsTaperedBufferAlgorithm::inputLayerTypes()
 const 
   98QgsTaperedBufferAlgorithm *QgsTaperedBufferAlgorithm::createInstance()
 const 
  100  return new QgsTaperedBufferAlgorithm();
 
  103void QgsTaperedBufferAlgorithm::initParameters( 
const QVariantMap & )
 
  106  startWidth->setIsDynamic( 
true );
 
  108  startWidth->setDynamicLayerParameterName( QStringLiteral( 
"INPUT" ) );
 
  109  addParameter( startWidth.release() );
 
  112  endWidth->setIsDynamic( 
true );
 
  114  endWidth->setDynamicLayerParameterName( QStringLiteral( 
"INPUT" ) );
 
  115  addParameter( endWidth.release() );
 
  118  segments->setIsDynamic( 
true );
 
  120  segments->setDynamicLayerParameterName( QStringLiteral( 
"INPUT" ) );
 
  121  addParameter( segments.release() );
 
  130  int segments = mSegments;
 
  131  if ( mDynamicSegments )
 
  134  double startWidth = mStartWidth;
 
  135  if ( mDynamicStartWidth )
 
  136    startWidth = mStartWidthProperty.valueAsDouble( context.
expressionContext(), startWidth );
 
  138  double endWidth = mEndWidth;
 
  139  if ( mDynamicEndWidth )
 
  143  if ( outputGeometry.
isNull() )
 
  145    feedback->
reportError( QObject::tr( 
"Error buffering geometry %1: %2" ).arg( feature.
id() ).arg( outputGeometry.
lastError() ) );
 
  153QString QgsVariableWidthBufferByMAlgorithm::name()
 const 
  155  return QStringLiteral( 
"bufferbym" );
 
  158QString QgsVariableWidthBufferByMAlgorithm::displayName()
 const 
  160  return QObject::tr( 
"Variable width buffer (by M value)" );
 
  163QStringList QgsVariableWidthBufferByMAlgorithm::tags()
 const 
  165  return QObject::tr( 
"variable,distance,length,line,buffer" ).split( 
',' );
 
  168QString QgsVariableWidthBufferByMAlgorithm::group()
 const 
  170  return QObject::tr( 
"Vector geometry" );
 
  173QString QgsVariableWidthBufferByMAlgorithm::groupId()
 const 
  175  return QStringLiteral( 
"vectorgeometry" );
 
  178QString QgsVariableWidthBufferByMAlgorithm::outputName()
 const 
  180  return QObject::tr( 
"Buffered" );
 
  195  mSegments = parameterAsInt( parameters, QStringLiteral( 
"Segments" ), context );
 
  197  if ( mDynamicSegments )
 
  198    mSegmentsProperty = parameters.value( QStringLiteral( 
"Segments" ) ).value<
QgsProperty>();
 
  203QString QgsVariableWidthBufferByMAlgorithm::shortHelpString()
 const 
  205  return QObject::tr( 
"This algorithm creates variable width buffers along lines, using the M value of the line geometries " 
  206                      "as the diameter of the buffer at each vertex." );
 
  209QString QgsVariableWidthBufferByMAlgorithm::shortDescription()
 const 
  211  return QObject::tr( 
"Creates variable width buffers along lines, using the M value of the line geometries " 
  212                      "as the diameter of the buffer at each vertex." );
 
  215QList<int> QgsVariableWidthBufferByMAlgorithm::inputLayerTypes()
 const 
  220QgsVariableWidthBufferByMAlgorithm *QgsVariableWidthBufferByMAlgorithm::createInstance()
 const 
  222  return new QgsVariableWidthBufferByMAlgorithm();
 
  225void QgsVariableWidthBufferByMAlgorithm::initParameters( 
const QVariantMap & )
 
  228  segments->setIsDynamic( 
true );
 
  230  segments->setDynamicLayerParameterName( QStringLiteral( 
"INPUT" ) );
 
  231  addParameter( segments.release() );
 
  240  int segments = mSegments;
 
  241  if ( mDynamicSegments )
 
  245  if ( outputGeometry.
isNull() )
 
  247    feedback->
reportError( QObject::tr( 
"Error buffering geometry %1: %2" ).arg( feature.
id() ).arg( outputGeometry.
lastError() ) );
 
ProcessingSourceType
Processing data source types.
 
@ VectorPolygon
Vector polygon layers.
 
@ VectorLine
Vector line layers.
 
WkbType
The WKB type describes the number of dimensions a geometry has.
 
@ MultiPolygon
MultiPolygon.
 
@ Double
Double/float values.
 
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
 
bool hasGeometry() const
Returns true if the feature has an associated geometry.
 
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
 
A geometry is the spatial representation of a feature.
 
QString lastError() const
Returns an error string referring to the last error encountered either when this geometry was created...
 
QgsGeometry variableWidthBufferByM(int segments) const
Calculates a variable width buffer for a (multi)linestring geometry, where the width at each node is ...
 
QgsGeometry taperedBuffer(double startWidth, double endWidth, int segments) const
Calculates a variable width buffer ("tapered buffer") for a (multi)curve geometry.
 
Contains information about the context in which a processing algorithm is executed.
 
QgsExpressionContext & expressionContext()
Returns the expression context.
 
Base class for providing feedback from a processing algorithm.
 
virtual void reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.
 
static bool isDynamic(const QVariantMap ¶meters, const QString &name)
Returns true if the parameter with matching name is a dynamic parameter, and must be evaluated once f...
 
Definition for a property.
 
@ IntegerPositiveGreaterZero
Non-zero positive integer values.
 
@ DoublePositive
Positive double value (including 0)
 
A store for object properties.
 
double valueAsDouble(const QgsExpressionContext &context, double defaultValue=0.0, bool *ok=nullptr) const
Calculates the current value of the property and interprets it as a double.
 
int valueAsInt(const QgsExpressionContext &context, int defaultValue=0, bool *ok=nullptr) const
Calculates the current value of the property and interprets it as an integer.
 
QList< QgsFeature > QgsFeatureList