Skip to content

Commit c4d7981

Browse files
committed
New members in QgsVectorSimplifyMethod for QPaint simplification
1 parent 89597f3 commit c4d7981

6 files changed

+18
-6
lines changed

python/core/qgssimplifymethod.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class QgsSimplifyMethod
2626

2727
//! Sets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal.
2828
void setTolerance( double tolerance );
29-
//! Gets the tolerance of simplification in map units . Represents the maximum distance in map units between two coordinates which can be considered equal.
29+
//! Gets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal.
3030
double tolerance() const;
3131

3232
//! Sets the simplification threshold in pixels. Represents the maximum distance in pixels between two coordinates which can be considered equal.

python/core/qgsvectorsimplifymethod.sip

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ class QgsVectorSimplifyMethod
2929
/** Gets the simplification hints of the vector layer managed */
3030
QFlags<QgsVectorSimplifyMethod::SimplifyHint> simplifyHints() const;
3131

32+
/** Sets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal */
33+
void setTolerance( double tolerance );
34+
/** Gets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal */
35+
double tolerance() const;
36+
3237
/** Sets the simplification threshold of the vector layer managed */
3338
void setThreshold( float threshold );
3439
/** Gets the simplification threshold of the vector layer managed */

src/core/qgssimplifymethod.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CORE_EXPORT QgsSimplifyMethod
4242

4343
//! Sets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal.
4444
void setTolerance( double tolerance );
45-
//! Gets the tolerance of simplification in map units . Represents the maximum distance in map units between two coordinates which can be considered equal.
45+
//! Gets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal.
4646
inline double tolerance() const { return mTolerance; }
4747

4848
//! Sets the simplification threshold in pixels. Represents the maximum distance in pixels between two coordinates which can be considered equal.
@@ -61,9 +61,9 @@ class CORE_EXPORT QgsSimplifyMethod
6161
protected:
6262
//! Simplification method
6363
MethodType mMethodType;
64-
//! Tolerance of simplification, it represents the maximum distance between two coordinates which can be considered equal
64+
//! Simplification tolerance, it represents the maximum distance between two coordinates which can be considered equal
6565
double mTolerance;
66-
/** Simplification threshold */
66+
//! Simplification threshold
6767
float mThreshold;
6868
//! Simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries
6969
bool mForceLocalOptimization;

src/core/qgsvectorlayerrenderer.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,11 @@ bool QgsVectorLayerRenderer::render()
224224
simplifyMethod.setMethodType( QgsSimplifyMethod::OptimizeForRendering );
225225
simplifyMethod.setTolerance( map2pixelTol );
226226
simplifyMethod.setThreshold( mSimplifyMethod.threshold() );
227-
228227
simplifyMethod.setForceLocalOptimization( mSimplifyMethod.forceLocalOptimization() );
229-
230228
featureRequest.setSimplifyMethod( simplifyMethod );
231229

232230
QgsVectorSimplifyMethod vectorMethod = mSimplifyMethod;
231+
vectorMethod.setTolerance( map2pixelTol );
233232
mContext.setVectorSimplifyMethod( vectorMethod );
234233
}
235234
else

src/core/qgsvectorsimplifymethod.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
QgsVectorSimplifyMethod::QgsVectorSimplifyMethod()
2121
: mSimplifyHints( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD > 1 ? QgsVectorSimplifyMethod::FullSimplification : QgsVectorSimplifyMethod::GeometrySimplification )
2222
, mThreshold( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD )
23+
, mTolerance( 1 )
2324
, mLocalOptimization( true )
2425
, mMaximumScale( 1 )
2526
{

src/core/qgsvectorsimplifymethod.h

+7
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ class CORE_EXPORT QgsVectorSimplifyMethod
4242
/** Gets the simplification hints of the vector layer managed */
4343
inline SimplifyHints simplifyHints() const { return mSimplifyHints; }
4444

45+
/** Sets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal */
46+
void setTolerance( double tolerance ) { mTolerance = tolerance; }
47+
/** Gets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal */
48+
inline double tolerance() const { return mTolerance; }
49+
4550
/** Sets the simplification threshold of the vector layer managed */
4651
void setThreshold( float threshold ) { mThreshold = threshold; }
4752
/** Gets the simplification threshold of the vector layer managed */
@@ -60,6 +65,8 @@ class CORE_EXPORT QgsVectorSimplifyMethod
6065
private:
6166
/** Simplification hints for fast rendering of features of the vector layer managed */
6267
SimplifyHints mSimplifyHints;
68+
/** Simplification tolerance, it represents the maximum distance between two coordinates which can be considered equal */
69+
double mTolerance;
6370
/** Simplification threshold */
6471
float mThreshold;
6572
/** Simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries */

0 commit comments

Comments
 (0)