QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
|
Implementation of GeometrySimplifier using the "MapToPixel" algorithm. More...
#include <qgsmaptopixelgeometrysimplifier.h>
Public Types | |
enum | SimplifyAlgorithm { Distance = 0 , SnapToGrid = 1 , Visvalingam = 2 , SnappedToGridGlobal = 3 } |
Types of simplification algorithms that can be used. More... | |
enum | SimplifyFlag { NoFlags = 0 , SimplifyGeometry = 1 , SimplifyEnvelope = 2 } |
Applicable simplification flags. More... | |
Public Member Functions | |
QgsMapToPixelSimplifier (int simplifyFlags, double tolerance, SimplifyAlgorithm simplifyAlgorithm=Distance) | |
Constructor. | |
bool | isGeneralizableByMapBoundingBox (const QgsRectangle &envelope) const |
Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context. | |
void | setSimplifyAlgorithm (SimplifyAlgorithm simplifyAlgorithm) |
Sets the local simplification algorithm of the vector layer managed. | |
void | setSimplifyFlags (int simplifyFlags) |
Sets the simplification hints of the vector layer managed. | |
void | setTolerance (double value) |
Sets the tolerance of the vector layer managed. | |
QgsAbstractGeometry * | simplify (const QgsAbstractGeometry *geometry) const override |
Returns a simplified version the specified geometry. | |
QgsGeometry | simplify (const QgsGeometry &geometry) const override |
Returns a simplified version the specified geometry. | |
SimplifyAlgorithm | simplifyAlgorithm () const |
Gets the local simplification algorithm of the vector layer managed. | |
int | simplifyFlags () const |
Gets the simplification hints of the vector layer managed. | |
Public Member Functions inherited from QgsAbstractGeometrySimplifier | |
virtual | ~QgsAbstractGeometrySimplifier ()=default |
Static Public Member Functions | |
static bool | isGeneralizableByMapBoundingBox (const QgsRectangle &envelope, double map2pixelTol) |
Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context. | |
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. | |
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. | |
Static Protected Member Functions | |
static float | calculateLengthSquared2D (double x1, double y1, double x2, double y2) |
Returns the squared 2D-distance of the vector defined by the two points specified. | |
static bool | equalSnapToGrid (double x1, double y1, double x2, double y2, double gridOriginX, double gridOriginY, float gridInverseSizeXY) |
Returns whether the points belong to the same grid. | |
Protected Attributes | |
SimplifyAlgorithm | mSimplifyAlgorithm |
Current algorithm. | |
int | mSimplifyFlags |
Current simplification flags. | |
double | mTolerance |
Distance tolerance for the simplification. | |
Implementation of GeometrySimplifier using the "MapToPixel" algorithm.
Simplifies a geometry removing points within of the maximum distance difference that defines the MapToPixel info of a RenderContext request. This class enables simplify the geometries to be rendered in a MapCanvas target to speed up the vector drawing.
Definition at line 38 of file qgsmaptopixelgeometrysimplifier.h.
Types of simplification algorithms that can be used.
Definition at line 42 of file qgsmaptopixelgeometrysimplifier.h.
Applicable simplification flags.
Definition at line 54 of file qgsmaptopixelgeometrysimplifier.h.
QgsMapToPixelSimplifier::QgsMapToPixelSimplifier | ( | int | simplifyFlags, |
double | tolerance, | ||
SimplifyAlgorithm | simplifyAlgorithm = Distance |
||
) |
Constructor.
Definition at line 31 of file qgsmaptopixelgeometrysimplifier.cpp.
|
staticprotected |
Returns the squared 2D-distance of the vector defined by the two points specified.
Definition at line 41 of file qgsmaptopixelgeometrysimplifier.cpp.
|
staticprotected |
Returns whether the points belong to the same grid.
Definition at line 49 of file qgsmaptopixelgeometrysimplifier.cpp.
|
inline |
Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context.
Definition at line 105 of file qgsmaptopixelgeometrysimplifier.h.
|
static |
Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context.
Definition at line 412 of file qgsmaptopixelgeometrysimplifier.cpp.
|
inline |
Sets the local simplification algorithm of the vector layer managed.
Definition at line 90 of file qgsmaptopixelgeometrysimplifier.h.
|
inline |
Sets the simplification hints of the vector layer managed.
Definition at line 85 of file qgsmaptopixelgeometrysimplifier.h.
|
inline |
Sets the tolerance of the vector layer managed.
Definition at line 96 of file qgsmaptopixelgeometrysimplifier.h.
|
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.
Implements QgsAbstractGeometrySimplifier.
Definition at line 456 of file qgsmaptopixelgeometrysimplifier.cpp.
|
overridevirtual |
Returns a simplified version the specified geometry.
Implements QgsAbstractGeometrySimplifier.
Definition at line 418 of file qgsmaptopixelgeometrysimplifier.cpp.
|
inline |
Gets the local simplification algorithm of the vector layer managed.
Definition at line 88 of file qgsmaptopixelgeometrysimplifier.h.
|
inline |
Gets the simplification hints of the vector layer managed.
Definition at line 83 of file qgsmaptopixelgeometrysimplifier.h.
|
protected |
Current algorithm.
Definition at line 70 of file qgsmaptopixelgeometrysimplifier.h.
|
protected |
Current simplification flags.
Definition at line 67 of file qgsmaptopixelgeometrysimplifier.h.
|
protected |
Distance tolerance for the simplification.
Definition at line 73 of file qgsmaptopixelgeometrysimplifier.h.