Skip to content
Permalink
Browse files

#8725-R: minor changes

  • Loading branch information
ahuarte47 authored and m-kuhn committed Jan 15, 2014
1 parent 22c0c79 commit 8fb87f182872c2db99d55198d5eef6048f26fad4
@@ -29,6 +29,9 @@ class QgsSimplifyMethod
/** Gets the tolerance of simplification */
double tolerance() const;

/** Returns the optimal tolerance for Douglas-Peucker simplification algorithms */
double toleranceForDouglasPeuckerAlgorithms() const;

/** Sets whether the simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries */
void setForceLocalOptimization( bool localOptimization );
/** Gets whether the simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries */
@@ -53,6 +53,12 @@ void QgsSimplifyMethod::setForceLocalOptimization( bool localOptimization )
{
mForceLocalOptimization = localOptimization;
}

double QgsSimplifyMethod::toleranceForDouglasPeuckerAlgorithms() const
{
//TODO: define more precise value, now, it is experimental but conservative
return mTolerance / 5.0;
}

QgsAbstractGeometrySimplifier* QgsSimplifyMethod::createGeometrySimplifier( const QgsSimplifyMethod& simplifyMethod )
{
@@ -48,6 +48,9 @@ class CORE_EXPORT QgsSimplifyMethod
//! Gets the tolerance of simplification
inline double tolerance() const { return mTolerance; }

//! Returns the optimal tolerance for Douglas-Peucker simplification algorithms
double toleranceForDouglasPeuckerAlgorithms() const;

//! Sets whether the simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries
void setForceLocalOptimization( bool localOptimization );
//! Gets whether the simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries
@@ -309,7 +309,7 @@ bool QgsPostgresFeatureIterator::declareCursor( const QString& whereClause )

double tolerance = simplifyMethod.methodType() == QgsSimplifyMethod::OptimizeForRendering
?
simplifyMethod.tolerance() / 5.0f /* experimental */
simplifyMethod.toleranceForDouglasPeuckerAlgorithms()
:
simplifyMethod.tolerance();

@@ -1755,7 +1755,7 @@
<item row="2" column="1" colspan="4">
<widget class="QCheckBox" name="mSimplifyDrawingAtProvider">
<property name="text">
<string>Runs on provider side, otherwise it will execute once obtained the geometry from data source</string>
<string>Simplify on provider side if possible</string>
</property>
</widget>
</item>
@@ -1014,7 +1014,7 @@
<item row="2" column="1" colspan="4">
<widget class="QCheckBox" name="mSimplifyDrawingAtProvider">
<property name="text">
<string>Runs on provider side, otherwise it will execute once obtained the geometry from data source</string>
<string>Simplify on provider side if possible</string>
</property>
</widget>
</item>

0 comments on commit 8fb87f1

Please sign in to comment.
You can’t perform that action at this time.