| QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
    | 
A class to trim lines and polygons to within a rectangular region. More...
#include <qgsclipper.h>
| Public Types | |
| enum | Boundary { XMax , XMin , YMax , YMin , ZMax , ZMin } | 
| A handy way to refer to the four boundaries.  More... | |
| Static Public Member Functions | |
| static bool | clipLineSegment (double left, double right, double bottom, double top, double &x0, double &y0, double &x1, double &y1) | 
| Clips a line segment to a rectangle.  More... | |
| static void | clipped3dLine (const QVector< double > &xIn, const QVector< double > &yIn, const QVector< double > &zIn, QVector< double > &x, QVector< double > &y, QVector< double > &z, const QgsBox3d &clipExtent) | 
| Takes a line with 3D coordinates and clips it to clipExtent.  More... | |
| 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 2D 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) | 
| Trims the given polygon to a rectangular box, by modifying the given polygon in place.  More... | |
| static void | trimPolygon (QVector< double > &x, QVector< double > &y, QVector< double > &z, const QgsBox3d &clipRect) | 
| Trims a polygon consisting of the specified x, y and z values to a pseudo 3D box, by modifying the arrays in place.  More... | |
| 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... | |
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 50 of file qgsclipper.h.
| enum QgsClipper::Boundary | 
A handy way to refer to the four boundaries.
| Enumerator | |
|---|---|
| XMax | |
| XMin | |
| YMax | |
| YMin | |
| ZMax | Maximum Z (since QGIS 3.26) | 
| ZMin | Minimum Z (since QGIS 3.26) | 
Definition at line 82 of file qgsclipper.h.
| 
 | inlinestatic | 
Clips a line segment to a rectangle.
An implementation of the 'Fast clipping' algorithm (Sobkow et al. 1987, Computers & Graphics Vol.11, 4, p.459-467).
| left | x-coordinate of left side of rectangle | 
| right | x-coordinate of right side of rectangle | 
| bottom | y-coordinate of bottom side of rectangle | 
| top | y-coordinate of top side of rectangle | 
| x0 | x-coordinate of start of line | 
| y0 | y-coordinate of start of line | 
| x1 | x-coordinate of end of line | 
| y1 | y-coordinate of end of line | 
true if line was clipped.Definition at line 780 of file qgsclipper.h.
| 
 | static | 
Takes a line with 3D coordinates and clips it to clipExtent.
Definition at line 40 of file qgsclipper.cpp.
| 
 | static | 
Takes a linestring and clips it to clipExtent.
| curve | the linestring | 
| clipExtent | clipping bounds | 
Definition at line 110 of file qgsclipper.cpp.
| 
 | static | 
Takes a 2D curve and clips it to clipExtent.
| curve | the linestring | 
| clipExtent | clipping bounds | 
Definition at line 115 of file qgsclipper.cpp.
| 
 | 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).
Definition at line 264 of file qgsclipper.h.
| 
 | inlinestatic | 
Trims the given polygon to a rectangular box, by modifying the given polygon in place.
| pts | polygon as 2D coordinates | 
| clipRect | clipping rectangle | 
Definition at line 285 of file qgsclipper.h.
| 
 | inlinestatic | 
Trims a polygon consisting of the specified x, y and z values to a pseudo 3D box, by modifying the arrays in place.
Definition at line 299 of file qgsclipper.h.
| 
 | static | 
Maximum X-coordinate of the rectangular box used for clipping.
Definition at line 72 of file qgsclipper.h.
| 
 | static | 
Maximum Y-coordinate of the rectangular box used for clipping.
Definition at line 76 of file qgsclipper.h.
| 
 | static | 
Minimum X-coordinate of the rectangular box used for clipping.
Definition at line 74 of file qgsclipper.h.
| 
 | static | 
Minimum Y-coordinate of the rectangular box used for clipping.
Definition at line 78 of file qgsclipper.h.