25using namespace Qt::StringLiterals;
29QString QgsWedgeBuffersAlgorithm::name()
const
31 return u
"wedgebuffers"_s;
34QString QgsWedgeBuffersAlgorithm::displayName()
const
36 return QObject::tr(
"Create wedge buffers" );
39QStringList QgsWedgeBuffersAlgorithm::tags()
const
41 return QObject::tr(
"arc,segment,circular,circle,slice" ).split(
',' );
44QString QgsWedgeBuffersAlgorithm::group()
const
46 return QObject::tr(
"Vector geometry" );
49QString QgsWedgeBuffersAlgorithm::groupId()
const
51 return u
"vectorgeometry"_s;
54QString QgsWedgeBuffersAlgorithm::outputName()
const
56 return QObject::tr(
"Buffers" );
71QString QgsWedgeBuffersAlgorithm::shortHelpString()
const
73 return QObject::tr(
"This algorithm creates wedge shaped buffers from input points.\n\n"
74 "The azimuth parameter gives the angle (in degrees) for the middle of the wedge to point. "
75 "The buffer width (in degrees) is specified by the width parameter. Note that the "
76 "wedge will extend to half of the angular width either side of the azimuth direction.\n\n"
77 "The outer radius of the buffer is specified via outer radius, and optionally an "
78 "inner radius can also be specified.\n\n"
79 "The native output from this algorithm are CurvePolygon geometries, but these may "
80 "be automatically segmentized to Polygons depending on the output format." );
83QString QgsWedgeBuffersAlgorithm::shortDescription()
const
85 return QObject::tr(
"Creates wedge shaped buffers from input points." );
88QList<int> QgsWedgeBuffersAlgorithm::inputLayerTypes()
const
98QgsWedgeBuffersAlgorithm *QgsWedgeBuffersAlgorithm::createInstance()
const
100 return new QgsWedgeBuffersAlgorithm();
103void QgsWedgeBuffersAlgorithm::initParameters(
const QVariantMap & )
106 azimuth->setIsDynamic(
true );
108 azimuth->setDynamicLayerParameterName( u
"INPUT"_s );
109 addParameter( azimuth.release() );
112 width->setIsDynamic(
true );
114 width->setDynamicLayerParameterName( u
"INPUT"_s );
115 addParameter( width.release() );
118 outerRadius->setIsDynamic(
true );
120 outerRadius->setDynamicLayerParameterName( u
"INPUT"_s );
121 addParameter( outerRadius.release() );
124 innerRadius->setIsDynamic(
true );
126 innerRadius->setDynamicLayerParameterName( u
"INPUT"_s );
127 addParameter( innerRadius.release() );
137 mAzimuth = parameterAsDouble( parameters, u
"AZIMUTH"_s, context );
139 if ( mDynamicAzimuth )
140 mAzimuthProperty = parameters.value( u
"AZIMUTH"_s ).value<
QgsProperty>();
142 mWidth = parameterAsDouble( parameters, u
"WIDTH"_s, context );
145 mWidthProperty = parameters.value( u
"WIDTH"_s ).value<
QgsProperty>();
147 mOuterRadius = parameterAsDouble( parameters, u
"OUTER_RADIUS"_s, context );
149 if ( mDynamicOuterRadius )
150 mOuterRadiusProperty = parameters.value( u
"OUTER_RADIUS"_s ).value<
QgsProperty>();
152 mInnerRadius = parameterAsDouble( parameters, u
"INNER_RADIUS"_s, context );
154 if ( mDynamicInnerRadius )
155 mInnerRadiusProperty = parameters.value( u
"INNER_RADIUS"_s ).value<
QgsProperty>();
165 double azimuth = mAzimuth;
166 if ( mDynamicAzimuth )
167 azimuth = mAzimuthProperty.valueAsDouble( context.
expressionContext(), azimuth );
169 double width = mWidth;
173 double outerRadius = mOuterRadius;
174 if ( mDynamicOuterRadius )
177 double innerRadius = mInnerRadius;
178 if ( mDynamicInnerRadius )
185 auto result = std::make_unique<QgsMultiSurface>();
ProcessingSourceType
Processing data source types.
@ VectorPoint
Vector point layers.
@ VectorPolygon
Vector polygon layers.
@ SkipGeometryValidityChecks
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
WkbType
The WKB type describes the number of dimensions a geometry has.
@ CurvePolygon
CurvePolygon.
QFlags< ProcessingFeatureSourceFlag > ProcessingFeatureSourceFlags
Flags which control how QgsProcessingFeatureSource fetches features.
@ 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.
int numGeometries() const
Returns the number of geometries within the collection.
A geometry is the spatial representation of a feature.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
static QgsGeometry createWedgeBuffer(const QgsPoint ¢er, double azimuth, double angularWidth, double outerRadius, double innerRadius=0)
Creates a wedge shaped buffer from a center point.
Qgis::WkbType wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.).
Multi point geometry collection.
QgsPoint * pointN(int index)
Returns the point with the specified index.
Point geometry type, with support for z-dimension and m-values.
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.
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).
@ 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.
static Qgis::GeometryType geometryType(Qgis::WkbType type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
static Qgis::WkbType addM(Qgis::WkbType type)
Adds the m dimension to a WKB type and returns the new type.
static Qgis::WkbType addZ(Qgis::WkbType type)
Adds the z dimension to a WKB type and returns the new type.
static Q_INVOKABLE bool hasZ(Qgis::WkbType type)
Tests whether a WKB type contains the z-dimension.
static Q_INVOKABLE bool hasM(Qgis::WkbType type)
Tests whether a WKB type contains m values.
static Qgis::WkbType multiType(Qgis::WkbType type)
Returns the multi type for a WKB type.
static Q_INVOKABLE bool isMultiType(Qgis::WkbType type)
Returns true if the WKB type is a multi type.
QList< QgsFeature > QgsFeatureList