QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | Static Private Member Functions | List of all members
QgsMapToPixelSimplifier Class Reference

Implementation of GeometrySimplifier using the "MapToPixel" algorithm. More...

#include <qgsmaptopixelgeometrysimplifier.h>

Inheritance diagram for QgsMapToPixelSimplifier:
Inheritance graph
[legend]
Collaboration diagram for QgsMapToPixelSimplifier:
Collaboration graph
[legend]

Public Types

enum  SimplifyFlag { NoFlags = 0, SimplifyGeometry = 1, SimplifyEnvelope = 2 }
 Applicable simplification flags. More...

Public Member Functions

 QgsMapToPixelSimplifier (int simplifyFlags, double tolerance)
virtual ~QgsMapToPixelSimplifier ()
int simplifyFlags () const
void setSimplifyFlags (int simplifyFlags)
virtual QgsGeometrysimplify (QgsGeometry *geometry) const
 Returns a simplified version the specified geometry.
virtual bool simplifyGeometry (QgsGeometry *geometry) const
 Simplifies the specified geometry.
bool canbeGeneralizedByMapBoundingBox (const QgsRectangle &envelope) const
 Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context.
- Public Member Functions inherited from QgsAbstractGeometrySimplifier
virtual ~QgsAbstractGeometrySimplifier ()

Static Public Member Functions

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.
static bool simplifyGeometry (QgsGeometry *geometry, int simplifyFlags, double tolerance)
 Simplifies the geometry when is applied the specified map2pixel context.
- Static Public Member Functions inherited from QgsAbstractGeometrySimplifier
static bool canbeGeneralizedByDeviceBoundingBox (const QgsRectangle &envelope, float mapToPixelTol=1.0f)
 Returns whether the device-envelope can be replaced by its BBOX when is applied the specified tolerance.
static bool canbeGeneralizedByDeviceBoundingBox (const QVector< QPointF > &points, float mapToPixelTol=1.0f)
 Returns whether the device-geometry can be replaced by its BBOX when is applied the specified tolerance.

Static Protected Member Functions

static float calculateLengthSquared2D (double x1, double y1, double x2, double y2)
 Returns the squared 2D-distance of the vector defined by the two points specified.

Protected Attributes

int mSimplifyFlags
 Current simplification flags.
double mTolerance
 Distance tolerance for the simplification.

Static Private Member Functions

static bool simplifyWkbGeometry (int simplifyFlags, QGis::WkbType wkbType, unsigned char *sourceWkb, size_t sourceWkbSize, unsigned char *targetWkb, size_t &targetWkbSize, const QgsRectangle &envelope, double map2pixelTol, bool writeHeader=true, bool isaLinearRing=false)
 Simplify the WKB-geometry using the specified tolerance.

Detailed Description

Implementation of GeometrySimplifier using the "MapToPixel" algorithm.

Simplifies a geometry removing points within of the maximum distance difference that defines the MapToPixel info of a RenderContext request. This class enables simplify the geometries to be rendered in a MapCanvas target to speed up the vector drawing.

Definition at line 32 of file qgsmaptopixelgeometrysimplifier.h.

Member Enumeration Documentation

Applicable simplification flags.

Enumerator:
NoFlags 

No simplification can be applied.

SimplifyGeometry 

The geometries can be simplified using the current map2pixel context state.

SimplifyEnvelope 

The geometries can be fully simplified by its BoundingBox.

Definition at line 39 of file qgsmaptopixelgeometrysimplifier.h.

Constructor & Destructor Documentation

QgsMapToPixelSimplifier::QgsMapToPixelSimplifier ( int  simplifyFlags,
double  tolerance 
)

Definition at line 21 of file qgsmaptopixelgeometrysimplifier.cpp.

QgsMapToPixelSimplifier::~QgsMapToPixelSimplifier ( )
virtual

Definition at line 26 of file qgsmaptopixelgeometrysimplifier.cpp.

Member Function Documentation

float QgsMapToPixelSimplifier::calculateLengthSquared2D ( double  x1,
double  y1,
double  x2,
double  y2 
)
staticprotected

Returns the squared 2D-distance of the vector defined by the two points specified.

Definition at line 34 of file qgsmaptopixelgeometrysimplifier.cpp.

Referenced by simplifyWkbGeometry().

bool QgsMapToPixelSimplifier::canbeGeneralizedByMapBoundingBox ( const QgsRectangle envelope,
double  map2pixelTol 
)
static

Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context.

Definition at line 314 of file qgsmaptopixelgeometrysimplifier.cpp.

References QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().

bool QgsMapToPixelSimplifier::canbeGeneralizedByMapBoundingBox ( const QgsRectangle envelope) const
inline

Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context.

Definition at line 76 of file qgsmaptopixelgeometrysimplifier.h.

References canbeGeneralizedByMapBoundingBox().

Referenced by canbeGeneralizedByMapBoundingBox().

void QgsMapToPixelSimplifier::setSimplifyFlags ( int  simplifyFlags)
inline

Definition at line 62 of file qgsmaptopixelgeometrysimplifier.h.

QgsGeometry * QgsMapToPixelSimplifier::simplify ( QgsGeometry geometry) const
virtual

Returns a simplified version the specified geometry.

Returns a simplified version the specified geometry (Removing duplicated points) when is applied the specified map2pixel context.

Implements QgsAbstractGeometrySimplifier.

Definition at line 325 of file qgsmaptopixelgeometrysimplifier.cpp.

References QgsGeometry::asWkb(), QgsGeometry::fromWkb(), mSimplifyFlags, mTolerance, simplifyGeometry(), and QgsGeometry::wkbSize().

int QgsMapToPixelSimplifier::simplifyFlags ( ) const
inline

Definition at line 61 of file qgsmaptopixelgeometrysimplifier.h.

bool QgsMapToPixelSimplifier::simplifyGeometry ( QgsGeometry geometry) const
virtual

Simplifies the specified geometry.

Simplifies the geometry (Removing duplicated points) when is applied the specified map2pixel context.

Implements QgsAbstractGeometrySimplifier.

Definition at line 365 of file qgsmaptopixelgeometrysimplifier.cpp.

References mSimplifyFlags, and mTolerance.

Referenced by simplify().

bool QgsMapToPixelSimplifier::simplifyGeometry ( QgsGeometry geometry,
int  simplifyFlags,
double  tolerance 
)
static

Simplifies the geometry when is applied the specified map2pixel context.

Simplifies the geometry (Removing duplicated points) when is applied the specified map2pixel context.

Definition at line 339 of file qgsmaptopixelgeometrysimplifier.cpp.

References QgsGeometry::asWkb(), QgsGeometry::boundingBox(), QgsGeometry::fromWkb(), QGis::Line, QGis::Polygon, simplifyWkbGeometry(), QgsGeometry::type(), QgsGeometry::wkbSize(), and QgsGeometry::wkbType().

bool QgsMapToPixelSimplifier::simplifyWkbGeometry ( int  simplifyFlags,
QGis::WkbType  wkbType,
unsigned char *  sourceWkb,
size_t  sourceWkbSize,
unsigned char *  targetWkb,
size_t &  targetWkbSize,
const QgsRectangle envelope,
double  map2pixelTol,
bool  writeHeader = true,
bool  isaLinearRing = false 
)
staticprivate

Member Data Documentation

int QgsMapToPixelSimplifier::mSimplifyFlags
protected

Current simplification flags.

Definition at line 52 of file qgsmaptopixelgeometrysimplifier.h.

Referenced by simplify(), and simplifyGeometry().

double QgsMapToPixelSimplifier::mTolerance
protected

Distance tolerance for the simplification.

Definition at line 55 of file qgsmaptopixelgeometrysimplifier.h.

Referenced by simplify(), and simplifyGeometry().


The documentation for this class was generated from the following files: