Class: QgsMapToPixelSimplifier¶
- class qgis.core.QgsMapToPixelSimplifier¶
Bases:
QgsAbstractGeometrySimplifier
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.
QgsMapToPixelSimplifier(simplifyFlags: int, tolerance: float, simplifyAlgorithm: QgsMapToPixelSimplifier.SimplifyAlgorithm = QgsMapToPixelSimplifier.Distance) Constructor
QgsMapToPixelSimplifier(
QgsMapToPixelSimplifier
)Methods
Returns the squared 2D-distance of the vector defined by the two points specified
Returns whether the points belong to the same grid
Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context
Sets the local simplification algorithm of the vector layer managed
Sets the simplification hints of the vector layer managed
Sets the tolerance of the vector layer managed
- param geometry:
Gets the local simplification algorithm of the vector layer managed
Gets the simplification hints of the vector layer managed
Attributes
- Distance = 0¶
- NoFlags = 0¶
- class SimplifyAlgorithm¶
Bases:
int
- SimplifyEnvelope = 2¶
- class SimplifyFlag¶
Bases:
int
- SimplifyGeometry = 1¶
- SnapToGrid = 1¶
- SnappedToGridGlobal = 3¶
- Visvalingam = 2¶
- calculateLengthSquared2D(x1: float, y1: float, x2: float, y2: float) float ¶
Returns the squared 2D-distance of the vector defined by the two points specified
- Parameters:
x1 (float) –
y1 (float) –
x2 (float) –
y2 (float) –
- Return type:
float
- equalSnapToGrid(x1: float, y1: float, x2: float, y2: float, gridOriginX: float, gridOriginY: float, gridInverseSizeXY: float) bool ¶
Returns whether the points belong to the same grid
- Parameters:
x1 (float) –
y1 (float) –
x2 (float) –
y2 (float) –
gridOriginX (float) –
gridOriginY (float) –
gridInverseSizeXY (float) –
- Return type:
bool
- isGeneralizableByMapBoundingBox(envelope: QgsRectangle, map2pixelTol: float) bool ¶
Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context
isGeneralizableByMapBoundingBox(self, envelope:
QgsRectangle
) -> bool Returns whether the envelope can be replaced by its BBOX when is applied the specified map2pixel context- Parameters:
envelope (QgsRectangle) –
map2pixelTol (float) –
- Return type:
bool
- setSimplifyAlgorithm(self, simplifyAlgorithm: QgsMapToPixelSimplifier.SimplifyAlgorithm)¶
Sets the local simplification algorithm of the vector layer managed
- Parameters:
simplifyAlgorithm (QgsMapToPixelSimplifier.SimplifyAlgorithm) –
- setSimplifyFlags(self, simplifyFlags: int)¶
Sets the simplification hints of the vector layer managed
- Parameters:
simplifyFlags (int) –
- setTolerance(self, value: float)¶
Sets the tolerance of the vector layer managed
- Parameters:
value (float) –
- simplify(self, geometry: QgsGeometry) QgsGeometry ¶
- simplify(self, geometry: QgsAbstractGeometry) QgsAbstractGeometry
- Parameters:
geometry (QgsGeometry) –
- Return type:
- simplifyAlgorithm(self) QgsMapToPixelSimplifier.SimplifyAlgorithm ¶
Gets the local simplification algorithm of the vector layer managed
- Return type:
- simplifyFlags(self) int ¶
Gets the simplification hints of the vector layer managed
- Return type:
int