23QString QgsSingleSidedBufferAlgorithm::name()
 const 
   25  return QStringLiteral( 
"singlesidedbuffer" );
 
   28QString QgsSingleSidedBufferAlgorithm::displayName()
 const 
   30  return QObject::tr( 
"Single sided buffer" );
 
   33QStringList QgsSingleSidedBufferAlgorithm::tags()
 const 
   35  return QObject::tr( 
"rectangle,perpendicular,right,angles,square,quadrilateralise" ).split( 
',' );
 
   38QString QgsSingleSidedBufferAlgorithm::group()
 const 
   40  return QObject::tr( 
"Vector geometry" );
 
   43QString QgsSingleSidedBufferAlgorithm::groupId()
 const 
   45  return QStringLiteral( 
"vectorgeometry" );
 
   48QString QgsSingleSidedBufferAlgorithm::shortHelpString()
 const 
   50  return QObject::tr( 
"This algorithm buffers lines by a specified distance on one " 
   51                      "side of the line only.\n\nThe segments parameter controls " 
   52                      "the number of line segments to use to approximate a quarter " 
   53                      "circle when creating rounded buffers. The join style parameter " 
   54                      "specifies whether round, miter or beveled joins should be used " 
   55                      "when buffering corners in a line. The miter limit parameter is " 
   56                      "only applicable for miter join styles, and controls the maximum " 
   57                      "distance from the buffer to use when creating a mitered join." );
 
   60QString QgsSingleSidedBufferAlgorithm::shortDescription()
 const 
   62  return QObject::tr( 
"Buffers lines by a specified distance on one side of the line only." );
 
   65QString QgsSingleSidedBufferAlgorithm::outputName()
 const 
   67  return QObject::tr( 
"Buffered" );
 
   70QList<int> QgsSingleSidedBufferAlgorithm::inputLayerTypes()
 const 
   86QgsSingleSidedBufferAlgorithm *QgsSingleSidedBufferAlgorithm::createInstance()
 const 
   88  return new QgsSingleSidedBufferAlgorithm();
 
   91void QgsSingleSidedBufferAlgorithm::initParameters( 
const QVariantMap & )
 
   93  auto bufferParam = std::make_unique<QgsProcessingParameterDistance>( QStringLiteral( 
"DISTANCE" ), QObject::tr( 
"Distance" ), 10, QStringLiteral( 
"INPUT" ) );
 
   94  bufferParam->setIsDynamic( 
true );
 
   96  bufferParam->setDynamicLayerParameterName( QStringLiteral( 
"INPUT" ) );
 
   97  addParameter( bufferParam.release() );
 
   99  addParameter( 
new QgsProcessingParameterEnum( QStringLiteral( 
"SIDE" ), QObject::tr( 
"Side" ), QStringList() << QObject::tr( 
"Left" ) << QObject::tr( 
"Right" ), 
false, 0 ) );
 
  101  addParameter( 
new QgsProcessingParameterEnum( QStringLiteral( 
"JOIN_STYLE" ), QObject::tr( 
"Join style" ), QStringList() << QObject::tr( 
"Round" ) << QObject::tr( 
"Miter" ) << QObject::tr( 
"Bevel" ), 
false, 0 ) );
 
  107  mDistance = parameterAsDouble( parameters, QStringLiteral( 
"DISTANCE" ), context );
 
  109  if ( mDynamicDistance )
 
  110    mDistanceProperty = parameters.value( QStringLiteral( 
"DISTANCE" ) ).value<
QgsProperty>();
 
  112  mSide = 
static_cast<Qgis::BufferSide>( parameterAsInt( parameters, QStringLiteral( 
"SIDE" ), context ) );
 
  113  mSegments = parameterAsInt( parameters, QStringLiteral( 
"SEGMENTS" ), context );
 
  114  mJoinStyle = 
static_cast<Qgis::JoinStyle>( 1 + parameterAsInt( parameters, QStringLiteral( 
"JOIN_STYLE" ), context ) );
 
  115  mMiterLimit = parameterAsDouble( parameters, QStringLiteral( 
"MITER_LIMIT" ), context );
 
  126    double distance = mDistance;
 
  127    if ( mDynamicDistance )
 
  128      distance = mDistanceProperty.valueAsDouble( context.
expressionContext(), distance );
 
  131    if ( outputGeometry.
isNull() )
 
ProcessingSourceType
Processing data source types.
 
@ VectorPolygon
Vector polygon layers.
 
@ VectorLine
Vector line layers.
 
BufferSide
Side of line to buffer.
 
JoinStyle
Join styles for buffers.
 
WkbType
The WKB type describes the number of dimensions a geometry has.
 
@ 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.
 
QgsGeometry singleSidedBuffer(double distance, int segments, Qgis::BufferSide side, Qgis::JoinStyle joinStyle=Qgis::JoinStyle::Round, double miterLimit=2.0) const
Returns a single sided buffer for a (multi)line geometry.
 
Contains information about the context in which a processing algorithm is executed.
 
QgsExpressionContext & expressionContext()
Returns the expression context.
 
Custom exception class for processing related exceptions.
 
Base class for providing feedback from a processing algorithm.
 
An enum based parameter for processing algorithms, allowing for selection from predefined values.
 
A numeric parameter for processing algorithms.
 
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.
 
@ Double
Double value (including negative values)
 
A store for object properties.
 
QList< QgsFeature > QgsFeatureList