QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 
25 class CORE_EXPORT QgsVectorSimplifyMethod
26 {
27  public:
30 
33  {
34  NoSimplification = 0,
35  GeometrySimplification = 1,
36  AntialiasingSimplification = 2,
37  FullSimplification = 3,
38  };
39  Q_DECLARE_FLAGS( SimplifyHints, SimplifyHint )
40 
41 
42  void setSimplifyHints( const SimplifyHints& simplifyHints ) { mSimplifyHints = simplifyHints; }
44  inline SimplifyHints simplifyHints() const { return mSimplifyHints; }
45 
48  {
49  Distance = 0,
50  SnapToGrid = 1,
51  Visvalingam = 2,
52  };
53 
55  void setSimplifyAlgorithm( const SimplifyAlgorithm& simplifyAlgorithm ) { mSimplifyAlgorithm = simplifyAlgorithm; }
57  inline SimplifyAlgorithm simplifyAlgorithm() const { return mSimplifyAlgorithm; }
58 
60  void setTolerance( double tolerance ) { mTolerance = tolerance; }
62  inline double tolerance() const { return mTolerance; }
63 
65  void setThreshold( float threshold ) { mThreshold = threshold; }
67  inline float threshold() const { return mThreshold; }
68 
70  void setForceLocalOptimization( bool localOptimization ) { mLocalOptimization = localOptimization; }
72  inline bool forceLocalOptimization() const { return mLocalOptimization; }
73 
75  void setMaximumScale( float maximumScale ) { mMaximumScale = maximumScale; }
77  inline float maximumScale() const { return mMaximumScale; }
78 
79  private:
81  SimplifyHints mSimplifyHints;
83  SimplifyAlgorithm mSimplifyAlgorithm;
85  double mTolerance;
87  float mThreshold;
89  bool mLocalOptimization;
91  float mMaximumScale;
92 };
93 
94 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsVectorSimplifyMethod::SimplifyHints )
95 
96 #endif // QGSVECTORSIMPLIFYMETHOD_H
void setSimplifyAlgorithm(const SimplifyAlgorithm &simplifyAlgorithm)
Sets the local simplification algorithm of the vector layer managed.
SimplifyAlgorithm simplifyAlgorithm() const
Gets the local simplification algorithm of the vector layer managed.
void setForceLocalOptimization(bool localOptimization)
Sets where the simplification executes, after fetch the geometries from provider, or when supported...
SimplifyHint
Simplification flags for fast rendering of features.
float maximumScale() const
Gets the maximum scale at which the layer should be simplified.
double tolerance() const
Gets the tolerance of simplification in map units.
void setTolerance(double tolerance)
Sets the tolerance of simplification in map units.
float threshold() const
Gets the simplification threshold of the vector layer managed.
void setMaximumScale(float maximumScale)
Sets the maximum scale at which the layer should be simplified.
This class contains information how to simplify geometries fetched from a vector layer.
bool forceLocalOptimization() const
Gets where the simplification executes, after fetch the geometries from provider, or when supported...
SimplifyAlgorithm
Types of local simplification algorithms that can be used.
SimplifyHints simplifyHints() const
Gets the simplification hints of the vector layer managed.
void setThreshold(float threshold)
Sets the simplification threshold of the vector layer managed.