24 QString QgsWedgeBuffersAlgorithm::name()
const 26 return QStringLiteral(
"wedgebuffers" );
29 QString QgsWedgeBuffersAlgorithm::displayName()
const 31 return QObject::tr(
"Create wedge buffers" );
34 QStringList QgsWedgeBuffersAlgorithm::tags()
const 36 return QObject::tr(
"arc,segment,circular,circle,slice" ).split(
',' );
39 QString QgsWedgeBuffersAlgorithm::group()
const 41 return QObject::tr(
"Vector geometry" );
44 QString QgsWedgeBuffersAlgorithm::groupId()
const 46 return QStringLiteral(
"vectorgeometry" );
49 QString QgsWedgeBuffersAlgorithm::outputName()
const 51 return QObject::tr(
"Buffers" );
66 QString QgsWedgeBuffersAlgorithm::shortHelpString()
const 68 return QObject::tr(
"This algorithm creates wedge shaped buffers from input points.\n\n" 69 "The azimuth parameter gives the angle (in degrees) for the middle of the wedge to point. " 70 "The buffer width (in degrees) is specified by the width parameter. Note that the " 71 "wedge will extend to half of the angular width either side of the azimuth direction.\n\n" 72 "The outer radius of the buffer is specified via outer radius, and optionally an " 73 "inner radius can also be specified.\n\n" 74 "The native output from this algorithm are CurvePolygon geometries, but these may " 75 "be automatically segmentized to Polygons depending on the output format." );
78 QList<int> QgsWedgeBuffersAlgorithm::inputLayerTypes()
const 88 QgsWedgeBuffersAlgorithm *QgsWedgeBuffersAlgorithm::createInstance()
const 90 return new QgsWedgeBuffersAlgorithm();
93 void QgsWedgeBuffersAlgorithm::initParameters(
const QVariantMap & )
95 std::unique_ptr< QgsProcessingParameterNumber > azimuth = qgis::make_unique< QgsProcessingParameterNumber >( QStringLiteral(
"AZIMUTH" ), QObject::tr(
"Azimuth (degrees from North)" ),
QgsProcessingParameterNumber::Double, 0, false );
96 azimuth->setIsDynamic(
true );
98 azimuth->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
99 addParameter( azimuth.release() );
101 std::unique_ptr< QgsProcessingParameterNumber > width = qgis::make_unique< QgsProcessingParameterNumber >( QStringLiteral(
"WIDTH" ), QObject::tr(
"Wedge width (in degrees)" ),
QgsProcessingParameterNumber::Double, 45,
false, 0, 360.0 );
102 width->setIsDynamic(
true );
104 width->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
105 addParameter( width.release() );
107 std::unique_ptr< QgsProcessingParameterNumber > outerRadius = qgis::make_unique< QgsProcessingParameterNumber >( QStringLiteral(
"OUTER_RADIUS" ), QObject::tr(
"Outer radius" ),
QgsProcessingParameterNumber::Double, 1,
false, 0 );
108 outerRadius->setIsDynamic(
true );
110 outerRadius->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
111 addParameter( outerRadius.release() );
113 std::unique_ptr< QgsProcessingParameterNumber > innerRadius = qgis::make_unique< QgsProcessingParameterNumber >( QStringLiteral(
"INNER_RADIUS" ), QObject::tr(
"Inner radius" ),
QgsProcessingParameterNumber::Double, 0,
true, 0 );
114 innerRadius->setIsDynamic(
true );
116 innerRadius->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
117 addParameter( innerRadius.release() );
127 mAzimuth = parameterAsDouble( parameters, QStringLiteral(
"AZIMUTH" ), context );
129 if ( mDynamicAzimuth )
130 mAzimuthProperty = parameters.value( QStringLiteral(
"AZIMUTH" ) ).value<
QgsProperty >();
132 mWidth = parameterAsDouble( parameters, QStringLiteral(
"WIDTH" ), context );
135 mWidthProperty = parameters.value( QStringLiteral(
"WIDTH" ) ).value<
QgsProperty >();
137 mOuterRadius = parameterAsDouble( parameters, QStringLiteral(
"OUTER_RADIUS" ), context );
139 if ( mDynamicOuterRadius )
140 mOuterRadiusProperty = parameters.value( QStringLiteral(
"OUTER_RADIUS" ) ).value<
QgsProperty >();
142 mInnerRadius = parameterAsDouble( parameters, QStringLiteral(
"INNER_RADIUS" ), context );
144 if ( mDynamicInnerRadius )
145 mInnerRadiusProperty = parameters.value( QStringLiteral(
"INNER_RADIUS" ) ).value<
QgsProperty >();
155 double azimuth = mAzimuth;
156 if ( mDynamicAzimuth )
157 azimuth = mAzimuthProperty.valueAsDouble( context.
expressionContext(), azimuth );
159 double width = mWidth;
163 double outerRadius = mOuterRadius;
164 if ( mDynamicOuterRadius )
167 double innerRadius = mInnerRadius;
168 if ( mDynamicInnerRadius )
175 std::unique_ptr< QgsMultiSurface > result = qgis::make_unique< QgsMultiSurface >();
static Type multiType(Type type)
Returns the multi type for a WKB type.
Base class for providing feedback from a processing algorithm.
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
Multi point geometry collection.
static bool isMultiType(Type type)
Returns true if the WKB type is a multi type.
QList< QgsFeature > QgsFeatureList
QgsWkbTypes::Type wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
A geometry is the spatial representation of a feature.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Positive double value (including 0)
bool hasGeometry() const
Returns true if the feature has an associated geometry.
static bool hasZ(Type type)
Tests whether a WKB type contains the z-dimension.
Type
The WKB type describes the number of dimensions a geometry has.
static Type addM(Type type)
Adds the m dimension to a WKB type and returns the new type.
static GeometryType geometryType(Type type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
static Type addZ(Type type)
Adds the z dimension to a WKB type and returns the new type.
QgsGeometry geometry() const
Returns the geometry associated with this feature.
A store for object properties.
Point geometry type, with support for z-dimension and m-values.
Double value (including negative values)
QgsExpressionContext & expressionContext()
Returns the expression context.
Definition for a property.
int numGeometries() const
Returns the number of geometries within the collection.
Flag
Flags controlling how QgsProcessingFeatureSource fetches features.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
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.
static QgsGeometry createWedgeBuffer(const QgsPoint ¢er, double azimuth, double angularWidth, double outerRadius, double innerRadius=0)
Creates a wedge shaped buffer from a center point.
const QgsAbstractGeometry * geometryN(int n) const
Returns a const reference to a geometry from within the collection.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
SourceType
Data source types enum.
static bool hasM(Type type)
Tests whether a WKB type contains m values.
Contains information about the context in which a processing algorithm is executed.
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...