Skip to content

Commit 8fb87f1

Browse files
ahuarte47m-kuhn
authored andcommitted
#8725-R: minor changes
1 parent 22c0c79 commit 8fb87f1

6 files changed

+15
-3
lines changed

python/core/qgssimplifymethod.sip

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ class QgsSimplifyMethod
2929
/** Gets the tolerance of simplification */
3030
double tolerance() const;
3131

32+
/** Returns the optimal tolerance for Douglas-Peucker simplification algorithms */
33+
double toleranceForDouglasPeuckerAlgorithms() const;
34+
3235
/** Sets whether the simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries */
3336
void setForceLocalOptimization( bool localOptimization );
3437
/** Gets whether the simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries */

src/core/qgssimplifymethod.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ void QgsSimplifyMethod::setForceLocalOptimization( bool localOptimization )
5353
{
5454
mForceLocalOptimization = localOptimization;
5555
}
56+
57+
double QgsSimplifyMethod::toleranceForDouglasPeuckerAlgorithms() const
58+
{
59+
//TODO: define more precise value, now, it is experimental but conservative
60+
return mTolerance / 5.0;
61+
}
5662

5763
QgsAbstractGeometrySimplifier* QgsSimplifyMethod::createGeometrySimplifier( const QgsSimplifyMethod& simplifyMethod )
5864
{

src/core/qgssimplifymethod.h

+3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ class CORE_EXPORT QgsSimplifyMethod
4848
//! Gets the tolerance of simplification
4949
inline double tolerance() const { return mTolerance; }
5050

51+
//! Returns the optimal tolerance for Douglas-Peucker simplification algorithms
52+
double toleranceForDouglasPeuckerAlgorithms() const;
53+
5154
//! Sets whether the simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries
5255
void setForceLocalOptimization( bool localOptimization );
5356
//! Gets whether the simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries

src/providers/postgres/qgspostgresfeatureiterator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ bool QgsPostgresFeatureIterator::declareCursor( const QString& whereClause )
309309

310310
double tolerance = simplifyMethod.methodType() == QgsSimplifyMethod::OptimizeForRendering
311311
?
312-
simplifyMethod.tolerance() / 5.0f /* experimental */
312+
simplifyMethod.toleranceForDouglasPeuckerAlgorithms()
313313
:
314314
simplifyMethod.tolerance();
315315

src/ui/qgsoptionsbase.ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,7 @@
17551755
<item row="2" column="1" colspan="4">
17561756
<widget class="QCheckBox" name="mSimplifyDrawingAtProvider">
17571757
<property name="text">
1758-
<string>Runs on provider side, otherwise it will execute once obtained the geometry from data source</string>
1758+
<string>Simplify on provider side if possible</string>
17591759
</property>
17601760
</widget>
17611761
</item>

src/ui/qgsvectorlayerpropertiesbase.ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@
10141014
<item row="2" column="1" colspan="4">
10151015
<widget class="QCheckBox" name="mSimplifyDrawingAtProvider">
10161016
<property name="text">
1017-
<string>Runs on provider side, otherwise it will execute once obtained the geometry from data source</string>
1017+
<string>Simplify on provider side if possible</string>
10181018
</property>
10191019
</widget>
10201020
</item>

0 commit comments

Comments
 (0)