|
| 1 | +/*************************************************************************** |
| 2 | + qgssimplifymethod.h |
| 3 | + --------------------- |
| 4 | + begin : December 2013 |
| 5 | + copyright : (C) 2013 by Matthias Kuhn / Alvaro Huarte |
| 6 | + email : |
| 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 QGSSIMPLIFYMETHOD_H |
| 17 | +#define QGSSIMPLIFYMETHOD_H |
| 18 | + |
| 19 | +/** |
| 20 | + * This class contains information about how to simplify geometries fetched from a QgsFeatureIterator |
| 21 | + */ |
| 22 | +class CORE_EXPORT QgsSimplifyMethod |
| 23 | +{ |
| 24 | + public: |
| 25 | + enum MethodType |
| 26 | + { |
| 27 | + NoSimplification, //!< No simplification is applied |
| 28 | + OptimizeForRendering, //!< Simplify using the map2pixel data to optimize the rendering of geometries |
| 29 | + PreserveTopology //!< Simplify using the Douglas-Peucker algorithm ensuring that the result is a valid geometry |
| 30 | + }; |
| 31 | + |
| 32 | + //! construct a default method |
| 33 | + QgsSimplifyMethod(); |
| 34 | + //! copy constructor |
| 35 | + QgsSimplifyMethod( const QgsSimplifyMethod& rh ); |
| 36 | + //! assignment operator |
| 37 | + QgsSimplifyMethod& operator=( const QgsSimplifyMethod& rh ); |
| 38 | + |
| 39 | + //! Sets the simplification type |
| 40 | + void setMethodType( MethodType methodType ); |
| 41 | + //! Gets the simplification type |
| 42 | + inline MethodType methodType() const { return mMethodType; } |
| 43 | + |
| 44 | + //! Sets the tolerance of simplification. Represents the maximum distance between two coordinates which can be considered equal |
| 45 | + void setTolerance( double tolerance ); |
| 46 | + //! Gets the tolerance of simplification |
| 47 | + inline double tolerance() const { return mTolerance; } |
| 48 | + |
| 49 | + //! Sets whether the simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries |
| 50 | + void setForceLocalOptimization( bool localOptimization ); |
| 51 | + //! Gets whether the simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries |
| 52 | + inline bool forceLocalOptimization() const { return mForceLocalOptimization; } |
| 53 | + |
| 54 | + protected: |
| 55 | + //! Simplification method |
| 56 | + MethodType mMethodType; |
| 57 | + //! Tolerance of simplification, it represents the maximum distance between two coordinates which can be considered equal |
| 58 | + double mTolerance; |
| 59 | + //! Simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries |
| 60 | + bool mForceLocalOptimization; |
| 61 | +}; |
| 62 | + |
| 63 | +#endif // QGSSIMPLIFYMETHOD_H |
0 commit comments