Skip to content

Commit 3f48ec9

Browse files
author
Hugo Mercier
committedMar 18, 2014
Expose QgsMapToPixelSimplifier to Python
1 parent 0a78102 commit 3f48ec9

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
 

‎python/core/core.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
%Include qgsgeometry.sip
3838
%Include qgsgeometryvalidator.sip
3939
%Include qgsgeometrysimplifier.sip
40+
%Include qgsmaptopixelgeometrysimplifier.sip
4041
%Include qgsgml.sip
4142
%Include qgsgmlschema.sip
4243
%Include qgshttptransaction.sip
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
class QgsMapToPixelSimplifier : public QgsAbstractGeometrySimplifier
2+
{
3+
%TypeHeaderCode
4+
#include "qgsmaptopixelgeometrysimplifier.h"
5+
%End
6+
public:
7+
QgsMapToPixelSimplifier( int simplifyFlags, double tolerance );
8+
virtual ~QgsMapToPixelSimplifier();
9+
10+
//! Applicable simplification flags
11+
enum SimplifyFlag
12+
{
13+
NoFlags = 0, //!< No simplification can be applied
14+
SimplifyGeometry = 1, //!< The geometries can be simplified using the current map2pixel context state
15+
SimplifyEnvelope = 2, //!< The geometries can be fully simplified by its BoundingBox
16+
};
17+
18+
public:
19+
int simplifyFlags() const;
20+
void setSimplifyFlags( int simplifyFlags );
21+
22+
//! Returns a simplified version the specified geometry
23+
virtual QgsGeometry* simplify( QgsGeometry* geometry ) const;
24+
//! Simplifies the specified geometry
25+
virtual bool simplifyGeometry( QgsGeometry* geometry ) const;
26+
27+
// MapToPixel simplification helper methods
28+
public:
29+
30+
//! Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context
31+
static bool canbeGeneralizedByMapBoundingBox( const QgsRectangle& envelope, double map2pixelTol );
32+
33+
//! Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context
34+
bool canbeGeneralizedByMapBoundingBox( const QgsRectangle& envelope ) const;
35+
36+
//! Simplifies the geometry when is applied the specified map2pixel context
37+
static bool simplifyGeometry( QgsGeometry* geometry, int simplifyFlags, double tolerance );
38+
39+
};

0 commit comments

Comments
 (0)
Please sign in to comment.