Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
#8725-R: define QgsSimplifyMethod
Define QgsSimplifyMethod to use as optional parameter in QgsFeatureRequest
- Loading branch information
Showing
5 changed files
with
130 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/*************************************************************************** | ||
qgssimplifymethod.cpp | ||
--------------------- | ||
begin : December 2013 | ||
copyright : (C) 2013 by Matthias Kuhn / Alvaro Huarte | ||
email : | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgssimplifymethod.h" | ||
|
||
QgsSimplifyMethod::QgsSimplifyMethod() | ||
: mMethodType( QgsSimplifyMethod::NoSimplification ) | ||
, mTolerance( 1 ) | ||
, mForceLocalOptimization( true ) | ||
{ | ||
} | ||
|
||
QgsSimplifyMethod::QgsSimplifyMethod( const QgsSimplifyMethod &rh ) | ||
{ | ||
operator=( rh ); | ||
} | ||
|
||
QgsSimplifyMethod& QgsSimplifyMethod::operator=( const QgsSimplifyMethod &rh ) | ||
{ | ||
mMethodType = rh.mMethodType; | ||
mTolerance = rh.mTolerance; | ||
mForceLocalOptimization = rh.mForceLocalOptimization; | ||
|
||
return *this; | ||
} | ||
|
||
void QgsSimplifyMethod::setMethodType( MethodType methodType ) | ||
{ | ||
mMethodType = methodType; | ||
} | ||
|
||
void QgsSimplifyMethod::setTolerance( double tolerance ) | ||
{ | ||
mTolerance = tolerance; | ||
} | ||
|
||
void QgsSimplifyMethod::setForceLocalOptimization( bool localOptimization ) | ||
{ | ||
mForceLocalOptimization = localOptimization; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/*************************************************************************** | ||
qgssimplifymethod.h | ||
--------------------- | ||
begin : December 2013 | ||
copyright : (C) 2013 by Matthias Kuhn / Alvaro Huarte | ||
email : | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSSIMPLIFYMETHOD_H | ||
#define QGSSIMPLIFYMETHOD_H | ||
|
||
/** | ||
* This class contains information about how to simplify geometries fetched from a QgsFeatureIterator | ||
*/ | ||
class CORE_EXPORT QgsSimplifyMethod | ||
{ | ||
public: | ||
enum MethodType | ||
{ | ||
NoSimplification, //!< No simplification is applied | ||
OptimizeForRendering, //!< Simplify using the map2pixel data to optimize the rendering of geometries | ||
PreserveTopology //!< Simplify using the Douglas-Peucker algorithm ensuring that the result is a valid geometry | ||
}; | ||
|
||
//! construct a default method | ||
QgsSimplifyMethod(); | ||
//! copy constructor | ||
QgsSimplifyMethod( const QgsSimplifyMethod& rh ); | ||
//! assignment operator | ||
QgsSimplifyMethod& operator=( const QgsSimplifyMethod& rh ); | ||
|
||
//! Sets the simplification type | ||
void setMethodType( MethodType methodType ); | ||
//! Gets the simplification type | ||
inline MethodType methodType() const { return mMethodType; } | ||
|
||
//! Sets the tolerance of simplification. Represents the maximum distance between two coordinates which can be considered equal | ||
void setTolerance( double tolerance ); | ||
//! Gets the tolerance of simplification | ||
inline double tolerance() const { return mTolerance; } | ||
|
||
//! 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 | ||
inline bool forceLocalOptimization() const { return mForceLocalOptimization; } | ||
|
||
protected: | ||
//! Simplification method | ||
MethodType mMethodType; | ||
//! Tolerance of simplification, it represents the maximum distance between two coordinates which can be considered equal | ||
double mTolerance; | ||
//! Simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries | ||
bool mForceLocalOptimization; | ||
}; | ||
|
||
#endif // QGSSIMPLIFYMETHOD_H |