2014-01-06 22:54:07 +01:00
2014-02-21 11:40:09 +07:00
/** This class contains information how to simplify geometries fetched from a vector layer
* @note added in 2.2
*/
2014-01-06 22:54:07 +01:00
class QgsVectorSimplifyMethod
{
%TypeHeaderCode
#include "qgsvectorsimplifymethod.h"
%End
public:
//! construct a default object
QgsVectorSimplifyMethod();
//! copy constructor
2017-05-01 16:42:33 +02:00
QgsVectorSimplifyMethod( const QgsVectorSimplifyMethod &rh );
2014-01-06 22:54:07 +01:00
2014-02-21 11:40:09 +07:00
/** Simplification flags for fast rendering of features */
enum SimplifyHint
{
2014-06-02 21:00:51 +02:00
NoSimplification, //!< No simplification can be applied
GeometrySimplification, //!< The geometries can be simplified using the current map2pixel context state
AntialiasingSimplification, //!< The geometries can be rendered with 'AntiAliasing' disabled because of it is '1-pixel size'
FullSimplification, //!< All simplification hints can be applied ( Geometry + AA-disabling )
2014-02-21 11:40:09 +07:00
};
typedef QFlags<QgsVectorSimplifyMethod::SimplifyHint> SimplifyHints;
2014-01-06 22:54:07 +01:00
/** Sets the simplification hints of the vector layer managed */
2016-10-24 09:34:13 +10:00
void setSimplifyHints( QFlags<QgsVectorSimplifyMethod::SimplifyHint> simplifyHints );
2014-01-06 22:54:07 +01:00
/** Gets the simplification hints of the vector layer managed */
2014-02-21 11:40:09 +07:00
QFlags<QgsVectorSimplifyMethod::SimplifyHint> simplifyHints() const;
2014-01-06 22:54:07 +01:00
2016-03-23 09:28:20 +01:00
/** Types of local simplification algorithms that can be used */
enum SimplifyAlgorithm
{
Distance = 0, //!< The simplification uses the distance between points to remove duplicate points
SnapToGrid = 1, //!< The simplification uses a grid (similar to ST_SnapToGrid) to remove duplicate points
2016-03-29 13:15:06 +02:00
Visvalingam = 2, //!< The simplification gives each point in a line an importance weighting, so that least important points are removed first
2016-03-23 09:28:20 +01:00
};
/** Sets the local simplification algorithm of the vector layer managed */
2016-10-24 09:34:13 +10:00
void setSimplifyAlgorithm( SimplifyAlgorithm simplifyAlgorithm );
2016-03-23 09:28:20 +01:00
/** Gets the local simplification algorithm of the vector layer managed */
SimplifyAlgorithm simplifyAlgorithm() const;
2016-02-23 08:07:30 +01:00
/** Sets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal */
void setTolerance( double tolerance );
/** Gets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal */
double tolerance() const;
2014-01-06 22:54:07 +01:00
/** Sets the simplification threshold of the vector layer managed */
void setThreshold( float threshold );
/** Gets the simplification threshold of the vector layer managed */
float threshold() const;
/** Sets where the simplification executes, after fetch the geometries from provider, or when supported, in provider before fetch the geometries */
void setForceLocalOptimization( bool localOptimization );
/** Gets where the simplification executes, after fetch the geometries from provider, or when supported, in provider before fetch the geometries */
2014-05-27 23:22:50 +02:00
bool forceLocalOptimization() const;
2014-01-21 01:39:16 +01:00
/** Sets the maximum scale at which the layer should be simplified */
void setMaximumScale( float maximumScale );
/** Gets the maximum scale at which the layer should be simplified */
float maximumScale() const;
2014-01-06 22:54:07 +01:00
};
2014-02-21 11:40:09 +07:00
QFlags<QgsVectorSimplifyMethod::SimplifyHint> operator|( QgsVectorSimplifyMethod::SimplifyHint f1, QFlags<QgsVectorSimplifyMethod::SimplifyHint> f2 );