22QString QgsConvertToCurvesAlgorithm::name()
const
24 return QStringLiteral(
"converttocurves" );
27QString QgsConvertToCurvesAlgorithm::displayName()
const
29 return QObject::tr(
"Convert to curved geometries" );
32QStringList QgsConvertToCurvesAlgorithm::tags()
const
34 return QObject::tr(
"straight,segmentize,curves,curved,circular" ).split(
',' );
37QString QgsConvertToCurvesAlgorithm::group()
const
39 return QObject::tr(
"Vector geometry" );
42QString QgsConvertToCurvesAlgorithm::groupId()
const
44 return QStringLiteral(
"vectorgeometry" );
47QString QgsConvertToCurvesAlgorithm::outputName()
const
49 return QObject::tr(
"Curves" );
52QString QgsConvertToCurvesAlgorithm::shortHelpString()
const
54 return QObject::tr(
"This algorithm converts a geometry into its curved geometry equivalent.\n\n"
55 "Already curved geometries will be retained without change." );
58QgsConvertToCurvesAlgorithm *QgsConvertToCurvesAlgorithm::createInstance()
const
60 return new QgsConvertToCurvesAlgorithm();
63QList<int> QgsConvertToCurvesAlgorithm::inputLayerTypes()
const
68void QgsConvertToCurvesAlgorithm::initParameters(
const QVariantMap & )
70 std::unique_ptr< QgsProcessingParameterNumber > tolerance = std::make_unique< QgsProcessingParameterNumber >( QStringLiteral(
"DISTANCE" ),
72 0.000001,
false, 0, 10000000.0 );
73 tolerance->setIsDynamic(
true );
75 tolerance->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
76 addParameter( tolerance.release() );
78 std::unique_ptr< QgsProcessingParameterNumber > angleTolerance = std::make_unique< QgsProcessingParameterNumber >( QStringLiteral(
"ANGLE" ),
80 0.000001,
false, 0, 45.0 );
81 angleTolerance->setIsDynamic(
true );
83 angleTolerance->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
84 addParameter( angleTolerance.release() );
89 mTolerance = parameterAsDouble( parameters, QStringLiteral(
"DISTANCE" ), context );
91 if ( mDynamicTolerance )
92 mToleranceProperty = parameters.value( QStringLiteral(
"DISTANCE" ) ).value<
QgsProperty >();
94 mAngleTolerance = parameterAsDouble( parameters, QStringLiteral(
"ANGLE" ), context );
96 if ( mDynamicAngleTolerance )
97 mAngleToleranceProperty = parameters.value( QStringLiteral(
"ANGLE" ) ).value<
QgsProperty >();
108 double tolerance = mTolerance;
109 if ( mDynamicTolerance )
110 tolerance = mToleranceProperty.valueAsDouble( context.
expressionContext(), tolerance );
111 double angleTolerance = mAngleTolerance;
112 if ( mDynamicAngleTolerance )
@ VectorPolygon
Vector polygon layers.
@ VectorLine
Vector line layers.
WkbType
The WKB type describes the number of dimensions a geometry has.
@ CompoundCurve
CompoundCurve.
@ CurvePolygon
CurvePolygon.
@ 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 convertToCurves(double distanceTolerance=1e-8, double angleTolerance=1e-8) const
Attempts to convert a non-curved geometry into a curved geometry type (e.g.
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.
@ 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 bool isMultiType(Qgis::WkbType type)
Returns true if the WKB type is a multi type.
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 bool hasZ(Qgis::WkbType type)
Tests whether a WKB type contains the z-dimension.
static 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 bool isCurvedType(Qgis::WkbType type)
Returns true if the WKB type is a curved type or can contain curved geometries.
QList< QgsFeature > QgsFeatureList