QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsmaptopixelgeometrysimplifier.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmaptopixelgeometrysimplifier.h
3 ---------------------
4 begin : December 2013
5 copyright : (C) 2013 by Alvaro Huarte
6 email : http://wiki.osgeo.org/wiki/Alvaro_Huarte
7
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef QGSMAPTOPIXELGEOMETRYSIMPLIFIER_H
18#define QGSMAPTOPIXELGEOMETRYSIMPLIFIER_H
19
20#include <memory>
21
22#include "qgis.h"
23#include "qgis_core.h"
24#include "qgis_sip.h"
26
27#include <QPolygonF>
28
30class QgsWkbPtr;
31class QgsConstWkbPtr;
32
33
42{
43 public:
44
47
55
56 private:
58 static std::unique_ptr<QgsAbstractGeometry> simplifyGeometry( int simplifyFlags, Qgis::VectorSimplificationAlgorithm simplifyAlgorithm, const QgsAbstractGeometry &geometry, double map2pixelTol, bool isaLinearRing );
59
60 protected:
63
66
68 double mTolerance;
69
71 static float calculateLengthSquared2D( double x1, double y1, double x2, double y2 );
72
74 static bool equalSnapToGrid( double x1, double y1, double x2, double y2, double gridOriginX, double gridOriginY, float gridInverseSizeXY );
75
76 public:
78 int simplifyFlags() const { return mSimplifyFlags; }
81
86
87 QgsGeometry simplify( const QgsGeometry &geometry ) const override;
88 QgsAbstractGeometry *simplify( const QgsAbstractGeometry *geometry ) const override SIP_FACTORY;
89
91 void setTolerance( double value ) { mTolerance = value; }
92
93 // MapToPixel simplification helper methods
94 public:
95
97 static bool isGeneralizableByMapBoundingBox( const QgsRectangle &envelope, double map2pixelTol );
98
100 inline bool isGeneralizableByMapBoundingBox( const QgsRectangle &envelope ) const
101 {
103 }
104};
105
106#endif // QGSMAPTOPIXELGEOMETRYSIMPLIFIER_H
VectorSimplificationAlgorithm
Simplification algorithms for vector features.
Definition qgis.h:3013
@ Distance
The simplification uses the distance between points to remove duplicate points.
Definition qgis.h:3014
Abstract base class for simplifying geometries using a specific algorithm.
virtual QgsGeometry simplify(const QgsGeometry &geometry) const =0
Returns a simplified version the specified geometry.
Abstract base class for all geometries.
A const WKB pointer.
Definition qgswkbptr.h:139
A geometry is the spatial representation of a feature.
bool isGeneralizableByMapBoundingBox(const QgsRectangle &envelope) const
Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel cont...
double mTolerance
Distance tolerance for the simplification.
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.
static bool isGeneralizableByMapBoundingBox(const QgsRectangle &envelope, double map2pixelTol)
Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel cont...
int simplifyFlags() const
Gets the simplification hints of the vector layer managed.
void setSimplifyFlags(int simplifyFlags)
Sets the simplification hints of the vector layer managed.
void setTolerance(double value)
Sets the tolerance of the vector layer managed.
void setSimplifyAlgorithm(Qgis::VectorSimplificationAlgorithm simplifyAlgorithm)
Sets the local simplification algorithm of the vector layer managed.
Qgis::VectorSimplificationAlgorithm mSimplifyAlgorithm
Current algorithm.
SimplifyFlag
Applicable simplification flags.
@ NoFlags
No simplification can be applied.
@ SimplifyEnvelope
The geometries can be fully simplified by its BoundingBox.
@ SimplifyGeometry
The geometries can be simplified using the current map2pixel context state.
int mSimplifyFlags
Current simplification flags.
static bool equalSnapToGrid(double x1, double y1, double x2, double y2, double gridOriginX, double gridOriginY, float gridInverseSizeXY)
Returns whether the points belong to the same grid.
Qgis::VectorSimplificationAlgorithm simplifyAlgorithm() const
Gets the local simplification algorithm of the vector layer managed.
QgsMapToPixelSimplifier(int simplifyFlags, double tolerance, Qgis::VectorSimplificationAlgorithm simplifyAlgorithm=Qgis::VectorSimplificationAlgorithm::Distance)
Constructor.
A rectangle specified with double values.
WKB pointer handler.
Definition qgswkbptr.h:45
#define SIP_FACTORY
Definition qgis_sip.h:84