mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Make QgsClipper::clipLineSegment public
This commit is contained in:
parent
67084ed289
commit
f0946aa807
@ -83,6 +83,26 @@ Takes a linestring and clips it to clipExtent
|
||||
Takes a ``curve`` and clips it to clipExtent.
|
||||
|
||||
.. versionadded:: 3.16
|
||||
%End
|
||||
|
||||
static bool clipLineSegment( double left, double right, double bottom, double top, double &x0 /In,Out/, double &y0 /In,Out/, double &x1 /In,Out/, double &y1 /In,Out/ );
|
||||
%Docstring
|
||||
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).
|
||||
|
||||
:param left: x-coordinate of left side of rectangle
|
||||
:param right: x-coordinate of right side of rectangle
|
||||
:param bottom: y-coordinate of bottom side of rectangle
|
||||
:param top: y-coordinate of top side of rectangle
|
||||
:param x0: x-coordinate of start of line
|
||||
:param y0: y-coordinate of start of line
|
||||
:param x1: x-coordinate of end of line
|
||||
:param y1: y-coordinate of end of line
|
||||
|
||||
:return: ``True`` if line was clipped.
|
||||
|
||||
.. versionadded:: 3.26
|
||||
%End
|
||||
|
||||
};
|
||||
|
@ -116,6 +116,25 @@ class CORE_EXPORT QgsClipper
|
||||
*/
|
||||
static QPolygonF clippedLine( const QPolygonF &curve, const QgsRectangle &clipExtent );
|
||||
|
||||
/**
|
||||
* 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).
|
||||
*
|
||||
* \param left x-coordinate of left side of rectangle
|
||||
* \param right x-coordinate of right side of rectangle
|
||||
* \param bottom y-coordinate of bottom side of rectangle
|
||||
* \param top y-coordinate of top side of rectangle
|
||||
* \param x0 x-coordinate of start of line
|
||||
* \param y0 y-coordinate of start of line
|
||||
* \param x1 x-coordinate of end of line
|
||||
* \param y1 y-coordinate of end of line
|
||||
* \returns TRUE if line was clipped.
|
||||
*
|
||||
* \since QGIS 3.26
|
||||
*/
|
||||
static bool clipLineSegment( double left, double right, double bottom, double top, double &x0 SIP_INOUT, double &y0 SIP_INOUT, double &x1 SIP_INOUT, double &y1 SIP_INOUT );
|
||||
|
||||
private:
|
||||
|
||||
// Used when testing for equivalence to 0.0
|
||||
@ -147,9 +166,6 @@ class CORE_EXPORT QgsClipper
|
||||
QPointF pt2,
|
||||
Boundary b, const QgsRectangle &rect );
|
||||
|
||||
//Implementation of 'Fast clipping' algorithm (Sobkow et al. 1987, Computers & Graphics Vol.11, 4, p.459-467)
|
||||
static bool clipLineSegment( double xLeft, double xRight, double yBottom, double yTop, double &x0, double &y0, double &x1, double &y1 );
|
||||
|
||||
/**
|
||||
* Connects two lines split by the clip (by inserting points on the clip border)
|
||||
* \param x0 x-coordinate of the first line end
|
||||
|
Loading…
x
Reference in New Issue
Block a user