QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | Protected Attributes | List of all members
QgsTopologyPreservingSimplifier Class Reference

Implementation of GeometrySimplifier using the Douglas-Peucker algorithm. More...

#include <qgsgeometrysimplifier.h>

Inheritance diagram for QgsTopologyPreservingSimplifier:
Inheritance graph
[legend]

Public Member Functions

 QgsTopologyPreservingSimplifier (double tolerance)
 Constructor for QgsTopologyPreservingSimplifier. More...
 
QgsAbstractGeometrysimplify (const QgsAbstractGeometry *geometry) const override
 Returns a simplified version the specified geometry. More...
 
QgsGeometry simplify (const QgsGeometry &geometry) const override
 Returns a simplified version the specified geometry. More...
 
- Public Member Functions inherited from QgsAbstractGeometrySimplifier
virtual ~QgsAbstractGeometrySimplifier ()=default
 
virtual QgsAbstractGeometrysimplify (const QgsAbstractGeometry *geometry) const =0
 Returns a simplified version the specified geometry. More...
 
virtual QgsGeometry simplify (const QgsGeometry &geometry) const =0
 Returns a simplified version the specified geometry. More...
 

Protected Attributes

double mTolerance
 Distance tolerance for the simplification. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from QgsAbstractGeometrySimplifier
static bool isGeneralizableByDeviceBoundingBox (const QgsRectangle &envelope, float mapToPixelTol=1.0f)
 Returns whether the device-envelope can be replaced by its BBOX when is applied the specified tolerance. More...
 
static bool isGeneralizableByDeviceBoundingBox (const QVector< QPointF > &points, float mapToPixelTol=1.0f)
 Returns whether the device-geometry can be replaced by its BBOX when is applied the specified tolerance. More...
 

Detailed Description

Implementation of GeometrySimplifier using the Douglas-Peucker algorithm.

Simplifies a geometry, ensuring that the result is a valid geometry having the same dimension and number of components as the input. The simplification uses a maximum distance difference algorithm similar to the one used in the Douglas-Peucker algorithm.

Definition at line 70 of file qgsgeometrysimplifier.h.

Constructor & Destructor Documentation

◆ QgsTopologyPreservingSimplifier()

QgsTopologyPreservingSimplifier::QgsTopologyPreservingSimplifier ( double  tolerance)

Constructor for QgsTopologyPreservingSimplifier.

The tolerance parameter is specified in layer units.

Definition at line 42 of file qgsgeometrysimplifier.cpp.

Member Function Documentation

◆ simplify() [1/2]

QgsAbstractGeometry * QgsTopologyPreservingSimplifier::simplify ( const QgsAbstractGeometry geometry) const
overridevirtual

Returns a simplified version the specified geometry.

Will return nullptr if no simplification is to be performed to the geometry.

Caller takes ownership of the returned geometry.

Since
QGIS 3.18

Implements QgsAbstractGeometrySimplifier.

Definition at line 51 of file qgsgeometrysimplifier.cpp.

◆ simplify() [2/2]

QgsGeometry QgsTopologyPreservingSimplifier::simplify ( const QgsGeometry geometry) const
overridevirtual

Returns a simplified version the specified geometry.

Implements QgsAbstractGeometrySimplifier.

Definition at line 46 of file qgsgeometrysimplifier.cpp.

Member Data Documentation

◆ mTolerance

double QgsTopologyPreservingSimplifier::mTolerance
protected

Distance tolerance for the simplification.

Definition at line 85 of file qgsgeometrysimplifier.h.


The documentation for this class was generated from the following files: