QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgsvectorsimplifymethod.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectorsimplifymethod.h
3 ---------------------
4 begin : December 2013
5 copyright : (C) 2013 by Alvaro Huarte
6 email : http://wiki.osgeo.org/wiki/Alvaro_Huarte
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSVECTORSIMPLIFYMETHOD_H
17#define QGSVECTORSIMPLIFYMETHOD_H
18
19#include <QFlags>
20#include <QObject>
21
22#include "qgis_core.h"
23
29class CORE_EXPORT QgsVectorSimplifyMethod
30{
31 Q_GADGET
32 public:
35
38 {
39 NoSimplification = 0,
40 GeometrySimplification = 1,
41 AntialiasingSimplification = 2,
42 FullSimplification = 3,
43 };
44 Q_ENUM( SimplifyHint )
45 Q_DECLARE_FLAGS( SimplifyHints, SimplifyHint )
46 Q_FLAG( SimplifyHints )
47
48
49 void setSimplifyHints( SimplifyHints simplifyHints ) { mSimplifyHints = simplifyHints; }
51 inline SimplifyHints simplifyHints() const { return mSimplifyHints; }
52
55 {
56 Distance = 0,
57 SnapToGrid = 1,
58 Visvalingam = 2,
59 SnappedToGridGlobal = 3,
60 };
61 Q_ENUM( SimplifyAlgorithm )
62
63
64 void setSimplifyAlgorithm( SimplifyAlgorithm simplifyAlgorithm ) { mSimplifyAlgorithm = simplifyAlgorithm; }
66 inline SimplifyAlgorithm simplifyAlgorithm() const { return mSimplifyAlgorithm; }
67
69 void setTolerance( double tolerance ) { mTolerance = tolerance; }
71 inline double tolerance() const { return mTolerance; }
72
74 void setThreshold( float threshold ) { mThreshold = threshold; }
76 inline float threshold() const { return mThreshold; }
77
79 void setForceLocalOptimization( bool localOptimization ) { mLocalOptimization = localOptimization; }
81 inline bool forceLocalOptimization() const { return mLocalOptimization; }
82
84 void setMaximumScale( float maximumScale ) { mMaximumScale = maximumScale; }
86 inline float maximumScale() const { return mMaximumScale; }
87
88 private:
90 SimplifyHints mSimplifyHints;
92 SimplifyAlgorithm mSimplifyAlgorithm = QgsVectorSimplifyMethod::Distance;
94 double mTolerance = 1;
96 float mThreshold;
98 bool mLocalOptimization = true;
100 float mMaximumScale = 1;
101};
102
103Q_DECLARE_OPERATORS_FOR_FLAGS( QgsVectorSimplifyMethod::SimplifyHints )
104
105#endif // QGSVECTORSIMPLIFYMETHOD_H
This class contains information how to simplify geometries fetched from a vector layer.
double tolerance() const
Gets the tolerance of simplification in map units. Represents the maximum distance in map units betwe...
bool forceLocalOptimization() const
Gets where the simplification executes, after fetch the geometries from provider, or when supported,...
float maximumScale() const
Gets the maximum scale at which the layer should be simplified.
void setThreshold(float threshold)
Sets the simplification threshold of the vector layer managed.
void setForceLocalOptimization(bool localOptimization)
Sets where the simplification executes, after fetch the geometries from provider, or when supported,...
SimplifyHints simplifyHints() const
Gets the simplification hints of the vector layer managed.
void setTolerance(double tolerance)
Sets the tolerance of simplification in map units. Represents the maximum distance in map units betwe...
SimplifyAlgorithm simplifyAlgorithm() const
Gets the local simplification algorithm of the vector layer managed.
float threshold() const
Gets the simplification threshold of the vector layer managed.
SimplifyHint
Simplification flags for fast rendering of features.
SimplifyAlgorithm
Types of local simplification algorithms that can be used.
@ Distance
The simplification uses the distance between points to remove duplicate points.
void setMaximumScale(float maximumScale)
Sets the maximum scale at which the layer should be simplified.
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.