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.
Showing
5 changed files
with
94 additions
and
56 deletions.
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,38 @@ | ||
/*************************************************************************** | ||
qgsvectorsimplifymethod.cpp | ||
--------------------- | ||
begin : December 2013 | ||
copyright : (C) 2013 by Alvaro Huarte | ||
email : http://wiki.osgeo.org/wiki/Alvaro_Huarte | ||
*************************************************************************** | ||
* * | ||
* 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 "qgis.h" | ||
#include "qgsvectorsimplifymethod.h" | ||
#include "qgsvectorlayer.h" | ||
|
||
QgsVectorSimplifyMethod::QgsVectorSimplifyMethod() | ||
: mSimplifyHints( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD > 1 ? QgsVectorLayer::FullSimplification : QgsVectorLayer::GeometrySimplification ) | ||
, mThreshold( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD ) | ||
, mLocalOptimization( true ) | ||
{ | ||
} | ||
|
||
QgsVectorSimplifyMethod::QgsVectorSimplifyMethod( const QgsVectorSimplifyMethod &rh ) | ||
{ | ||
operator=( rh ); | ||
} | ||
|
||
QgsVectorSimplifyMethod& QgsVectorSimplifyMethod::operator=( const QgsVectorSimplifyMethod &rh ) | ||
{ | ||
mSimplifyHints = rh.mSimplifyHints; | ||
mThreshold = rh.mThreshold; | ||
mLocalOptimization = rh.mLocalOptimization; | ||
return *this; | ||
} |
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,54 @@ | ||
/*************************************************************************** | ||
qgsvectorsimplifymethod.h | ||
--------------------- | ||
begin : December 2013 | ||
copyright : (C) 2013 by Alvaro Huarte | ||
email : http://wiki.osgeo.org/wiki/Alvaro_Huarte | ||
*************************************************************************** | ||
* * | ||
* 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 QGSVECTORSIMPLIFYMETHOD_H | ||
#define QGSVECTORSIMPLIFYMETHOD_H | ||
|
||
/** This class contains information how to simplify geometries fetched from a vector layer */ | ||
class CORE_EXPORT QgsVectorSimplifyMethod | ||
{ | ||
public: | ||
//! construct a default object | ||
QgsVectorSimplifyMethod(); | ||
//! copy constructor | ||
QgsVectorSimplifyMethod( const QgsVectorSimplifyMethod& rh ); | ||
//! assignment operator | ||
QgsVectorSimplifyMethod& operator=( const QgsVectorSimplifyMethod& rh ); | ||
|
||
/** Sets the simplification hints of the vector layer managed */ | ||
void setSimplifyHints( int simplifyHints ) { mSimplifyHints = simplifyHints; } | ||
/** Gets the simplification hints of the vector layer managed */ | ||
inline int simplifyHints() const { return mSimplifyHints; } | ||
|
||
/** Sets the simplification threshold of the vector layer managed */ | ||
void setThreshold( float threshold ) { mThreshold = threshold; } | ||
/** Gets the simplification threshold of the vector layer managed */ | ||
inline float threshold() const { return mThreshold; } | ||
|
||
/** Sets where the simplification executes, after fetch the geometries from provider, or when supported, in provider before fetch the geometries */ | ||
void setForceLocalOptimization( bool localOptimization ) { mLocalOptimization = localOptimization; } | ||
/** Gets where the simplification executes, after fetch the geometries from provider, or when supported, in provider before fetch the geometries */ | ||
inline bool forceLocalOptimization() const { return mLocalOptimization; } | ||
|
||
private: | ||
/** Simplification hints for fast rendering of features of the vector layer managed */ | ||
int mSimplifyHints; | ||
/** Simplification threshold */ | ||
float mThreshold; | ||
/** Simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries */ | ||
bool mLocalOptimization; | ||
}; | ||
|
||
#endif // QGSVECTORSIMPLIFYMETHOD_H |