22 QString QgsSegmentizeByMaximumDistanceAlgorithm::name()
const 24 return QStringLiteral(
"segmentizebymaxdistance" );
27 QString QgsSegmentizeByMaximumDistanceAlgorithm::displayName()
const 29 return QObject::tr(
"Segmentize by maximum distance" );
32 QStringList QgsSegmentizeByMaximumDistanceAlgorithm::tags()
const 34 return QObject::tr(
"straighten,linearize,densify,curves,curved,circular" ).split(
',' );
37 QString QgsSegmentizeByMaximumDistanceAlgorithm::group()
const 39 return QObject::tr(
"Vector geometry" );
42 QString QgsSegmentizeByMaximumDistanceAlgorithm::groupId()
const 44 return QStringLiteral(
"vectorgeometry" );
47 QString QgsSegmentizeByMaximumDistanceAlgorithm::outputName()
const 49 return QObject::tr(
"Segmentized" );
52 QString QgsSegmentizeByMaximumDistanceAlgorithm::shortHelpString()
const 54 return QObject::tr(
"This algorithm segmentizes a geometry by converting curved sections to linear sections.\n\n" 55 "The segmentization is performed by specifying the maximum allowed offset distance between the original" 56 "curve and the segmentized representation.\n\n" 57 "Non-curved geometries will be retained without change." );
60 QgsSegmentizeByMaximumDistanceAlgorithm *QgsSegmentizeByMaximumDistanceAlgorithm::createInstance()
const 62 return new QgsSegmentizeByMaximumDistanceAlgorithm();
65 QList<int> QgsSegmentizeByMaximumDistanceAlgorithm::inputLayerTypes()
const 70 void QgsSegmentizeByMaximumDistanceAlgorithm::initParameters(
const QVariantMap & )
72 std::unique_ptr< QgsProcessingParameterDistance > tolerance = qgis::make_unique< QgsProcessingParameterDistance >( QStringLiteral(
"DISTANCE" ),
73 QObject::tr(
"Maximum offset distance" ),
74 1.0, QStringLiteral(
"INPUT" ),
false, 0, 10000000.0 );
75 tolerance->setIsDynamic(
true );
77 tolerance->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
78 addParameter( tolerance.release() );
83 mTolerance = parameterAsDouble( parameters, QStringLiteral(
"DISTANCE" ), context );
85 if ( mDynamicTolerance )
86 mToleranceProperty = parameters.value( QStringLiteral(
"DISTANCE" ) ).value<
QgsProperty >();
97 double tolerance = mTolerance;
98 if ( mDynamicTolerance )
99 tolerance = mToleranceProperty.valueAsDouble( context.
expressionContext(), tolerance );
110 QString QgsSegmentizeByMaximumAngleAlgorithm::name()
const 112 return QStringLiteral(
"segmentizebymaxangle" );
115 QString QgsSegmentizeByMaximumAngleAlgorithm::displayName()
const 117 return QObject::tr(
"Segmentize by maximum angle" );
120 QStringList QgsSegmentizeByMaximumAngleAlgorithm::tags()
const 122 return QObject::tr(
"straighten,linearize,densify,curves,curved,circular,angle" ).split(
',' );
125 QString QgsSegmentizeByMaximumAngleAlgorithm::group()
const 127 return QObject::tr(
"Vector geometry" );
130 QString QgsSegmentizeByMaximumAngleAlgorithm::groupId()
const 132 return QStringLiteral(
"vectorgeometry" );
135 QString QgsSegmentizeByMaximumAngleAlgorithm::outputName()
const 137 return QObject::tr(
"Segmentized" );
140 QString QgsSegmentizeByMaximumAngleAlgorithm::shortHelpString()
const 142 return QObject::tr(
"This algorithm segmentizes a geometry by converting curved sections to linear sections.\n\n" 143 "The segmentization is performed by specifying the maximum allowed radius angle between vertices " 144 "on the straightened geometry (e.g the angle of the arc created from the original arc center to consecutive " 145 "output vertices on the linearized geometry).\n\n" 146 "Non-curved geometries will be retained without change." );
149 QgsSegmentizeByMaximumAngleAlgorithm *QgsSegmentizeByMaximumAngleAlgorithm::createInstance()
const 151 return new QgsSegmentizeByMaximumAngleAlgorithm();
154 QList<int> QgsSegmentizeByMaximumAngleAlgorithm::inputLayerTypes()
const 159 void QgsSegmentizeByMaximumAngleAlgorithm::initParameters(
const QVariantMap & )
161 std::unique_ptr< QgsProcessingParameterNumber > tolerance = qgis::make_unique< QgsProcessingParameterNumber >( QStringLiteral(
"ANGLE" ),
163 5.0,
false, 0, 360.0 );
164 tolerance->setIsDynamic(
true );
166 tolerance->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
167 addParameter( tolerance.release() );
172 mTolerance = parameterAsDouble( parameters, QStringLiteral(
"ANGLE" ), context );
174 if ( mDynamicTolerance )
175 mToleranceProperty = parameters.value( QStringLiteral(
"ANGLE" ) ).value<
QgsProperty >();
186 double tolerance = mTolerance;
187 if ( mDynamicTolerance )
188 tolerance = mToleranceProperty.valueAsDouble( context.
expressionContext(), tolerance );
Maximum distance between an arbitrary point on the original curve and closest point on its approximat...
Base class for providing feedback from a processing algorithm.
Maximum angle between generating radii (lines from arc center to output vertices) ...
QList< QgsFeature > QgsFeatureList
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.
void convertToStraightSegment(double tolerance=M_PI/180., QgsAbstractGeometry::SegmentationToleranceType toleranceType=QgsAbstractGeometry::MaximumAngle)
Converts the geometry to straight line segments, if it is a curved geometry type. ...
QgsGeometry geometry() const
Returns the geometry associated with this feature.
A store for object properties.
QgsExpressionContext & expressionContext()
Returns the expression context.
Definition for a property.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
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...