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() );
81 bool QgsSegmentizeByMaximumDistanceAlgorithm::supportInPlaceEdit(
const QgsMapLayer *layer )
const 89 mTolerance = parameterAsDouble( parameters, QStringLiteral(
"DISTANCE" ), context );
91 if ( mDynamicTolerance )
92 mToleranceProperty = parameters.value( QStringLiteral(
"DISTANCE" ) ).value<
QgsProperty >();
103 double tolerance = mTolerance;
104 if ( mDynamicTolerance )
105 tolerance = mToleranceProperty.valueAsDouble( context.
expressionContext(), tolerance );
116 QString QgsSegmentizeByMaximumAngleAlgorithm::name()
const 118 return QStringLiteral(
"segmentizebymaxangle" );
121 QString QgsSegmentizeByMaximumAngleAlgorithm::displayName()
const 123 return QObject::tr(
"Segmentize by maximum angle" );
126 QStringList QgsSegmentizeByMaximumAngleAlgorithm::tags()
const 128 return QObject::tr(
"straighten,linearize,densify,curves,curved,circular,angle" ).split(
',' );
131 QString QgsSegmentizeByMaximumAngleAlgorithm::group()
const 133 return QObject::tr(
"Vector geometry" );
136 QString QgsSegmentizeByMaximumAngleAlgorithm::groupId()
const 138 return QStringLiteral(
"vectorgeometry" );
141 QString QgsSegmentizeByMaximumAngleAlgorithm::outputName()
const 143 return QObject::tr(
"Segmentized" );
146 QString QgsSegmentizeByMaximumAngleAlgorithm::shortHelpString()
const 148 return QObject::tr(
"This algorithm segmentizes a geometry by converting curved sections to linear sections.\n\n" 149 "The segmentization is performed by specifying the maximum allowed radius angle between vertices " 150 "on the straightened geometry (e.g the angle of the arc created from the original arc center to consecutive " 151 "output vertices on the linearized geometry).\n\n" 152 "Non-curved geometries will be retained without change." );
155 QgsSegmentizeByMaximumAngleAlgorithm *QgsSegmentizeByMaximumAngleAlgorithm::createInstance()
const 157 return new QgsSegmentizeByMaximumAngleAlgorithm();
160 QList<int> QgsSegmentizeByMaximumAngleAlgorithm::inputLayerTypes()
const 165 void QgsSegmentizeByMaximumAngleAlgorithm::initParameters(
const QVariantMap & )
167 std::unique_ptr< QgsProcessingParameterNumber > tolerance = qgis::make_unique< QgsProcessingParameterNumber >( QStringLiteral(
"ANGLE" ),
169 5.0,
false, 0, 360.0 );
170 tolerance->setIsDynamic(
true );
172 tolerance->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
173 addParameter( tolerance.release() );
176 bool QgsSegmentizeByMaximumAngleAlgorithm::supportInPlaceEdit(
const QgsMapLayer *layer )
const 184 mTolerance = parameterAsDouble( parameters, QStringLiteral(
"ANGLE" ), context );
186 if ( mDynamicTolerance )
187 mToleranceProperty = parameters.value( QStringLiteral(
"ANGLE" ) ).value<
QgsProperty >();
198 double tolerance = mTolerance;
199 if ( mDynamicTolerance )
200 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 all map layer types.
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. ...
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...