Skip to content
Permalink
Browse files

Merge pull request #1249 from Oslandia/expose_simplifier

Expose QgsMapToPixelSimplifier to Python
  • Loading branch information
jef-n committed May 7, 2014
2 parents 0c6056b + 3f48ec9 commit f628b7727b24203537e800c4291c3f71c5a52f2f
Showing with 40 additions and 0 deletions.
  1. +1 −0 python/core/core.sip
  2. +39 −0 python/core/qgsmaptopixelgeometrysimplifier.sip
@@ -37,6 +37,7 @@
%Include qgsgeometry.sip
%Include qgsgeometryvalidator.sip
%Include qgsgeometrysimplifier.sip
%Include qgsmaptopixelgeometrysimplifier.sip
%Include qgsgml.sip
%Include qgsgmlschema.sip
%Include qgshttptransaction.sip
@@ -0,0 +1,39 @@
class QgsMapToPixelSimplifier : public QgsAbstractGeometrySimplifier
{
%TypeHeaderCode
#include "qgsmaptopixelgeometrysimplifier.h"
%End
public:
QgsMapToPixelSimplifier( int simplifyFlags, double tolerance );
virtual ~QgsMapToPixelSimplifier();

//! Applicable simplification flags
enum SimplifyFlag
{
NoFlags = 0, //!< No simplification can be applied
SimplifyGeometry = 1, //!< The geometries can be simplified using the current map2pixel context state
SimplifyEnvelope = 2, //!< The geometries can be fully simplified by its BoundingBox
};

public:
int simplifyFlags() const;
void setSimplifyFlags( int simplifyFlags );

//! Returns a simplified version the specified geometry
virtual QgsGeometry* simplify( QgsGeometry* geometry ) const;
//! Simplifies the specified geometry
virtual bool simplifyGeometry( QgsGeometry* geometry ) const;

// MapToPixel simplification helper methods
public:

//! Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context
static bool canbeGeneralizedByMapBoundingBox( const QgsRectangle& envelope, double map2pixelTol );

//! Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context
bool canbeGeneralizedByMapBoundingBox( const QgsRectangle& envelope ) const;

//! Simplifies the geometry when is applied the specified map2pixel context
static bool simplifyGeometry( QgsGeometry* geometry, int simplifyFlags, double tolerance );

};

0 comments on commit f628b77

Please sign in to comment.
You can’t perform that action at this time.