Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
New members in QgsVectorSimplifyMethod for QPaint simplification
  • Loading branch information
ahuarte47 committed May 25, 2016
1 parent 89597f3 commit c4d7981
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion python/core/qgssimplifymethod.sip
Expand Up @@ -26,7 +26,7 @@ class QgsSimplifyMethod

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

//! Sets the simplification threshold in pixels. Represents the maximum distance in pixels between two coordinates which can be considered equal.
Expand Down
5 changes: 5 additions & 0 deletions python/core/qgsvectorsimplifymethod.sip
Expand Up @@ -29,6 +29,11 @@ class QgsVectorSimplifyMethod
/** Gets the simplification hints of the vector layer managed */
QFlags<QgsVectorSimplifyMethod::SimplifyHint> simplifyHints() const;

/** Sets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal */
void setTolerance( double tolerance );
/** Gets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal */
double tolerance() const;

/** Sets the simplification threshold of the vector layer managed */
void setThreshold( float threshold );
/** Gets the simplification threshold of the vector layer managed */
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgssimplifymethod.h
Expand Up @@ -42,7 +42,7 @@ class CORE_EXPORT QgsSimplifyMethod

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

//! Sets the simplification threshold in pixels. Represents the maximum distance in pixels between two coordinates which can be considered equal.
Expand All @@ -61,9 +61,9 @@ class CORE_EXPORT QgsSimplifyMethod
protected:
//! Simplification method
MethodType mMethodType;
//! Tolerance of simplification, it represents the maximum distance between two coordinates which can be considered equal
//! Simplification tolerance, it represents the maximum distance between two coordinates which can be considered equal
double mTolerance;
/** Simplification threshold */
//! Simplification threshold
float mThreshold;
//! Simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries
bool mForceLocalOptimization;
Expand Down
3 changes: 1 addition & 2 deletions src/core/qgsvectorlayerrenderer.cpp
Expand Up @@ -224,12 +224,11 @@ bool QgsVectorLayerRenderer::render()
simplifyMethod.setMethodType( QgsSimplifyMethod::OptimizeForRendering );
simplifyMethod.setTolerance( map2pixelTol );
simplifyMethod.setThreshold( mSimplifyMethod.threshold() );

simplifyMethod.setForceLocalOptimization( mSimplifyMethod.forceLocalOptimization() );

featureRequest.setSimplifyMethod( simplifyMethod );

QgsVectorSimplifyMethod vectorMethod = mSimplifyMethod;
vectorMethod.setTolerance( map2pixelTol );
mContext.setVectorSimplifyMethod( vectorMethod );
}
else
Expand Down
1 change: 1 addition & 0 deletions src/core/qgsvectorsimplifymethod.cpp
Expand Up @@ -20,6 +20,7 @@
QgsVectorSimplifyMethod::QgsVectorSimplifyMethod()
: mSimplifyHints( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD > 1 ? QgsVectorSimplifyMethod::FullSimplification : QgsVectorSimplifyMethod::GeometrySimplification )
, mThreshold( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD )
, mTolerance( 1 )
, mLocalOptimization( true )
, mMaximumScale( 1 )
{
Expand Down
7 changes: 7 additions & 0 deletions src/core/qgsvectorsimplifymethod.h
Expand Up @@ -42,6 +42,11 @@ class CORE_EXPORT QgsVectorSimplifyMethod
/** Gets the simplification hints of the vector layer managed */
inline SimplifyHints simplifyHints() const { return mSimplifyHints; }

/** Sets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal */
void setTolerance( double tolerance ) { mTolerance = tolerance; }
/** Gets the tolerance of simplification in map units. Represents the maximum distance in map units between two coordinates which can be considered equal */
inline double tolerance() const { return mTolerance; }

/** Sets the simplification threshold of the vector layer managed */
void setThreshold( float threshold ) { mThreshold = threshold; }
/** Gets the simplification threshold of the vector layer managed */
Expand All @@ -60,6 +65,8 @@ class CORE_EXPORT QgsVectorSimplifyMethod
private:
/** Simplification hints for fast rendering of features of the vector layer managed */
SimplifyHints mSimplifyHints;
/** Simplification tolerance, it represents the maximum distance between two coordinates which can be considered equal */
double mTolerance;
/** Simplification threshold */
float mThreshold;
/** Simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries */
Expand Down

0 comments on commit c4d7981

Please sign in to comment.