QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
QgsClipper Class Reference

A class to trim lines and polygons to within a rectangular region. More...

#include <qgsclipper.h>

Public Types

enum  Boundary { XMax, XMin, YMax, YMin }
 A handy way to refer to the four boundaries. More...
 

Static Public Member Functions

static QPolygonF clippedLine (const QgsCurve &curve, const QgsRectangle &clipExtent)
 Takes a linestring and clips it to clipExtent. More...
 
static QPolygonF clippedLine (const QPolygonF &curve, const QgsRectangle &clipExtent)
 Takes a curve and clips it to clipExtent. More...
 
static void trimFeature (QVector< double > &x, QVector< double > &y, bool shapeOpen)
 Trims the given feature to a rectangular box. More...
 
static void trimPolygon (QPolygonF &pts, const QgsRectangle &clipRect)
 

Static Public Attributes

static const double MAX_X = 16000
 Maximum X-coordinate of the rectangular box used for clipping. More...
 
static const double MAX_Y = 16000
 Maximum Y-coordinate of the rectangular box used for clipping. More...
 
static const double MIN_X = -16000
 Minimum X-coordinate of the rectangular box used for clipping. More...
 
static const double MIN_Y = -16000
 Minimum Y-coordinate of the rectangular box used for clipping. More...
 

Detailed Description

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).

Definition at line 45 of file qgsclipper.h.

Member Enumeration Documentation

◆ Boundary

A handy way to refer to the four boundaries.

Enumerator
XMax 
XMin 
YMax 
YMin 

Definition at line 77 of file qgsclipper.h.

Member Function Documentation

◆ clippedLine() [1/2]

QPolygonF QgsClipper::clippedLine ( const QgsCurve curve,
const QgsRectangle clipExtent 
)
static

Takes a linestring and clips it to clipExtent.

Parameters
curvethe linestring
clipExtentclipping bounds
Returns
clipped line coordinates

Definition at line 41 of file qgsclipper.cpp.

◆ clippedLine() [2/2]

QPolygonF QgsClipper::clippedLine ( const QPolygonF &  curve,
const QgsRectangle clipExtent 
)
static

Takes a curve and clips it to clipExtent.

Since
QGIS 3.16

Definition at line 46 of file qgsclipper.cpp.

◆ trimFeature()

void QgsClipper::trimFeature ( QVector< double > &  x,
QVector< double > &  y,
bool  shapeOpen 
)
inlinestatic

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

Definition at line 188 of file qgsclipper.h.

◆ trimPolygon()

void QgsClipper::trimPolygon ( QPolygonF &  pts,
const QgsRectangle clipRect 
)
inlinestatic

Definition at line 209 of file qgsclipper.h.

Member Data Documentation

◆ MAX_X

const double QgsClipper::MAX_X = 16000
static

Maximum X-coordinate of the rectangular box used for clipping.

Definition at line 67 of file qgsclipper.h.

◆ MAX_Y

const double QgsClipper::MAX_Y = 16000
static

Maximum Y-coordinate of the rectangular box used for clipping.

Definition at line 71 of file qgsclipper.h.

◆ MIN_X

const double QgsClipper::MIN_X = -16000
static

Minimum X-coordinate of the rectangular box used for clipping.

Definition at line 69 of file qgsclipper.h.

◆ MIN_Y

const double QgsClipper::MIN_Y = -16000
static

Minimum Y-coordinate of the rectangular box used for clipping.

Definition at line 73 of file qgsclipper.h.


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