Skip to content

Commit

Permalink
#8725-R: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuarte47 authored and m-kuhn committed Jan 15, 2014
1 parent 22c0c79 commit 8fb87f1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions python/core/qgssimplifymethod.sip
Expand Up @@ -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 */
Expand Down
6 changes: 6 additions & 0 deletions src/core/qgssimplifymethod.cpp
Expand Up @@ -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 )
{
Expand Down
3 changes: 3 additions & 0 deletions src/core/qgssimplifymethod.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/providers/postgres/qgspostgresfeatureiterator.cpp
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgsoptionsbase.ui
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgsvectorlayerpropertiesbase.ui
Expand Up @@ -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>
Expand Down

0 comments on commit 8fb87f1

Please sign in to comment.