22 QString QgsSimplifyAlgorithm::name()
const 24 return QStringLiteral(
"simplifygeometries" );
27 QString QgsSimplifyAlgorithm::displayName()
const 29 return QObject::tr(
"Simplify" );
32 QStringList QgsSimplifyAlgorithm::tags()
const 34 return QObject::tr(
"simplify,generalize,douglas,peucker,visvalingam" ).split(
',' );
37 QString QgsSimplifyAlgorithm::group()
const 39 return QObject::tr(
"Vector geometry" );
42 QString QgsSimplifyAlgorithm::groupId()
const 44 return QStringLiteral(
"vectorgeometry" );
47 QString QgsSimplifyAlgorithm::outputName()
const 49 return QObject::tr(
"Simplified" );
52 QString QgsSimplifyAlgorithm::shortHelpString()
const 54 return QObject::tr(
"This algorithm simplifies the geometries in a line or polygon layer. It creates a new layer " 55 "with the same features as the ones in the input layer, but with geometries containing a lower number of vertices.\n\n" 56 "The algorithm gives a choice of simplification methods, including distance based " 57 "(the \"Douglas-Peucker\" algorithm), area based (\"Visvalingam\" algorithm) and snapping geometries to a grid." );
60 QgsSimplifyAlgorithm *QgsSimplifyAlgorithm::createInstance()
const 62 return new QgsSimplifyAlgorithm();
65 QList<int> QgsSimplifyAlgorithm::inputLayerTypes()
const 70 void QgsSimplifyAlgorithm::initParameters(
const QVariantMap & )
73 methods << QObject::tr(
"Distance (Douglas-Peucker)" )
74 << QObject::tr(
"Snap to grid" )
75 << QObject::tr(
"Area (Visvalingam)" );
78 QStringLiteral(
"METHOD" ),
79 QObject::tr(
"Simplification method" ),
80 methods,
false, 0 ) );
83 1.0,
false, 0, 10000000.0 ) );
88 mTolerance = parameterAsDouble( parameters, QStringLiteral(
"TOLERANCE" ), context );
105 outputGeometry = inputGeometry.
simplify( mTolerance );
109 outputGeometry = mSimplifier->
simplify( inputGeometry );
Base class for providing feedback from a processing algorithm.
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...
SimplifyAlgorithm
Types of simplification algorithms that can be used.
bool hasGeometry() const
Returns true if the feature has an associated geometry.
An enum based parameter for processing algorithms, allowing for selection from predefined values...
QgsGeometry geometry() const
Returns the geometry associated with this feature.
Implementation of GeometrySimplifier using the "MapToPixel" algorithm.
A numeric parameter for processing algorithms.
QgsGeometry simplify(double tolerance) const
Returns a simplified version of this geometry using a specified tolerance value.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
The geometries can be simplified using the current map2pixel context state.
Contains information about the context in which a processing algorithm is executed.
The simplification uses the distance between points to remove duplicate points.