QgsClipper class
A class to trim lines and polygons to within a rectangular region.
Contents
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).
Public types
Public static variables
- static const double MAX_X
- Maximum X-coordinate of the rectangular box used for clipping.
- static const double MAX_Y
- Maximum Y-coordinate of the rectangular box used for clipping.
- static const double MIN_X
- Minimum X-coordinate of the rectangular box used for clipping.
- static const double MIN_Y
- Minimum Y-coordinate of the rectangular box used for clipping.
Public static functions
- static auto clippedLine(const QgsCurve& curve, const QgsRectangle& clipExtent) -> QPolygonF
- Takes a linestring and clips it to clipExtent.
- static void trimFeature(QVector<double>& x, QVector<double>& y, bool shapeOpen)
- Trims the given feature to a rectangular box.
Function documentation
static QPolygonF QgsClipper:: clippedLine(const QgsCurve& curve,
const QgsRectangle& clipExtent)
Takes a linestring and clips it to clipExtent.
| Parameters | |
|---|---|
| curve | the linestring |
| clipExtent | clipping bounds |
| Returns | clipped line coordinates |
static void QgsClipper:: trimFeature(QVector<double>& x,
QVector<double>& y,
bool shapeOpen)
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).