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: simplify edited geometries in QgsVectorLayerFeatureIterator
- Loading branch information
Showing
9 changed files
with
153 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
/** Abstract base class for simplify geometries using a specific algorithm */ | ||
class QgsAbstractGeometrySimplifier | ||
{ | ||
%TypeHeaderCode | ||
#include "qgsgeometrysimplifier.h" | ||
%End | ||
|
||
public: | ||
virtual ~QgsAbstractGeometrySimplifier(); | ||
|
||
/** Returns a simplified version the specified geometry */ | ||
virtual QgsGeometry* simplify( QgsGeometry* geometry ) const = 0; | ||
/** Simplifies the specified geometry */ | ||
virtual bool simplifyGeometry( QgsGeometry* geometry ) const = 0; | ||
|
||
// MapToPixel simplification helper methods | ||
public: | ||
/** Returns whether the device-envelope can be replaced by its BBOX when is applied the specified tolerance */ | ||
static bool canbeGeneralizedByDeviceBoundingBox( const QgsRectangle& envelope, float mapToPixelTol = 1.0f ); | ||
/** Returns whether the device-geometry can be replaced by its BBOX when is applied the specified tolerance */ | ||
static bool canbeGeneralizedByDeviceBoundingBox( const QVector<QPointF>& points, float mapToPixelTol = 1.0f ); | ||
}; |
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,39 @@ | ||
|
||
/** This class contains information about how to simplify geometries fetched from a QgsFeatureIterator */ | ||
class QgsSimplifyMethod | ||
{ | ||
%TypeHeaderCode | ||
#include "qgssimplifymethod.h" | ||
%End | ||
|
||
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 ); | ||
|
||
/** Sets the simplification type */ | ||
void setMethodType( MethodType methodType ); | ||
/** Gets the simplification type */ | ||
MethodType methodType() const; | ||
|
||
/** 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 */ | ||
double tolerance() 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 */ | ||
bool forceLocalOptimization() const; | ||
|
||
/** Creates a geometry simplifier according to specified method */ | ||
static QgsAbstractGeometrySimplifier* createGeometrySimplifier( const QgsSimplifyMethod& simplifyMethod ); | ||
}; |
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
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