Class: QgsClipper

class qgis.core.QgsClipper

Bases: sip.wrapper

A class to trim lines and polygons to within a rectangular region. The functions in this class are likely to be called from within a render loop and hence need to as CPU efficient as possible. The main purpose of the functions in this class are to trim lines and polygons to lie within a rectangular region. This is necessary for drawing items to an X11 display which have a limit on the magnitude of the screen coordinates (+/- 32768, i.e. 16 bit integer).

Enums

Methods

clippedLine Takes a linestring and clips it to clipExtent
trimFeature Trims the given feature to a rectangular box.
trimPolygon

Signals

Attributes

MAX_X
MAX_Y
MIN_X
MIN_Y
XMax
XMin
YMax
YMin
class Boundary

Bases: int

MAX_X = 16000.0
MAX_Y = 16000.0
MIN_X = -16000.0
MIN_Y = -16000.0
XMax = 0
XMin = 1
YMax = 2
YMin = 3
clippedLine(curve: QgsCurve, clipExtent: QgsRectangle) → QPolygonF

Takes a linestring and clips it to clipExtent

Parameters:
  • curve – the linestring
  • clipExtent – clipping bounds
Returns:

clipped line coordinates

trimFeature(x: Iterable[float], y: Iterable[float], shapeOpen: bool)

Trims the given feature to a rectangular box. Returns the trimmed feature in x and y. The shapeOpen parameter determines whether the function treats the points as a closed shape (polygon), or as an open shape (linestring).

Note

not available in Python bindings on android

trimPolygon(pts: QPolygonF, clipRect: QgsRectangle)