- Update api_break.dox

- rename isIntersect to isIntersection
- rename inter to intersectionPoint
This commit is contained in:
lbartoletti 2017-12-13 14:03:55 +01:00
parent c6838fdec6
commit 03d8565e2a
4 changed files with 20 additions and 19 deletions

View File

@ -1453,7 +1453,8 @@ QgsGeometryUtils {#qgis_api_break_3_0_QgsGeometryUtils}
- componentType enum has been renamed to ComponentType and its members were CamelCased too: VERTEX, RING and PART become Vertex, Ring and Part, respectively.
- adjacentVertices was removed - use QgsAbstractGeometry.adjacentVertices instead.
- segmentIntersection takes an optional boolean parameter "acceptImproperIntersection" returning true even if the intersection is improper.
Takes another boolean argument "isIntersection" returning if there is an intersection or not. The "inter" parameter has been renamed "intersectionPoint".
QgsGPSConnectionRegistry {#qgis_api_break_3_0_QgsGPSConnectionRegistry}
------------------------

View File

@ -98,15 +98,15 @@ class QgsGeometryUtils
:rtype: bool
%End
static bool segmentIntersection( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &inter /Out/, bool &isIntersect /Out/, double tolerance, bool acceptImproperIntersection = false );
static bool segmentIntersection( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &intersectionPoint /Out/, bool &isIntersection /Out/, double tolerance, bool acceptImproperIntersection = false );
%Docstring
Compute the intersection between two segments
\param p1 First segment start point
\param p2 First segment end point
\param q1 Second segment start point
\param q2 Second segment end point
\param inter Output parameter, the intersection point
\param isIntersect Output parameter, return true if an intersection is found
\param intersectionPoint Output parameter, the intersection point
\param isIntersection Output parameter, return true if an intersection is found
\param tolerance The tolerance to use
\param acceptImproperIntersection By default, this method returns true only if segments have proper intersection. If set true, returns also true if segments have improper intersection (end of one segment on other segment ; continuous segments).
:return: Whether the segments intersect

View File

@ -251,9 +251,9 @@ bool QgsGeometryUtils::lineIntersection( const QgsPoint &p1, QgsVector v, const
return true;
}
bool QgsGeometryUtils::segmentIntersection( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &inter, bool &isIntersect, double tolerance, bool acceptImproperIntersection )
bool QgsGeometryUtils::segmentIntersection( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &intersectionPoint, bool &isIntersection, double tolerance, bool acceptImproperIntersection )
{
isIntersect = false;
isIntersection = false;
QgsVector v( p2.x() - p1.x(), p2.y() - p1.y() );
QgsVector w( q2.x() - q1.x(), q2.y() - q1.y() );
@ -267,53 +267,53 @@ bool QgsGeometryUtils::segmentIntersection( const QgsPoint &p1, const QgsPoint &
v = v / vl;
w = w / wl;
if ( !QgsGeometryUtils::lineIntersection( p1, v, q1, w, inter ) )
if ( !QgsGeometryUtils::lineIntersection( p1, v, q1, w, intersectionPoint ) )
{
return false;
}
isIntersect = true;
isIntersection = true;
if ( acceptImproperIntersection )
{
if ( ( p1 == q1 ) || ( p1 == q2 ) )
{
inter = p1;
intersectionPoint = p1;
return true;
}
else if ( ( p2 == q1 ) || ( p2 == q2 ) )
{
inter == p2;
intersectionPoint == p2;
return true;
}
double x, y;
if ( qgsDoubleNear( QgsGeometryUtils::sqrDistToLine( p1.x(), p1.y(), q1.x(), q1.y(), q2.x(), q2.y(), x, y, tolerance ), 0.0, tolerance ) )
{
inter == p1;
intersectionPoint == p1;
return true;
}
else if ( qgsDoubleNear( QgsGeometryUtils::sqrDistToLine( p2.x(), p2.y(), q1.x(), q1.y(), q2.x(), q2.y(), x, y, tolerance ), 0.0, tolerance ) )
{
inter == p2;
intersectionPoint == p2;
return true;
}
else if ( qgsDoubleNear( QgsGeometryUtils::sqrDistToLine( q1.x(), q1.y(), p1.x(), p1.y(), p2.x(), p2.y(), x, y, tolerance ), 0.0, tolerance ) )
{
inter == q1;
intersectionPoint == q1;
return true;
}
else if ( qgsDoubleNear( QgsGeometryUtils::sqrDistToLine( q2.x(), q2.y(), p1.x(), p1.y(), p2.x(), p2.y(), x, y, tolerance ), 0.0, tolerance ) )
{
inter == q2;
intersectionPoint == q2;
return true;
}
}
double lambdav = QgsVector( inter.x() - p1.x(), inter.y() - p1.y() ) * v;
double lambdav = QgsVector( intersectionPoint.x() - p1.x(), intersectionPoint.y() - p1.y() ) * v;
if ( lambdav < 0. + tolerance || lambdav > vl - tolerance )
return false;
double lambdaw = QgsVector( inter.x() - q1.x(), inter.y() - q1.y() ) * w;
double lambdaw = QgsVector( intersectionPoint.x() - q1.x(), intersectionPoint.y() - q1.y() ) * w;
return !( lambdaw < 0. + tolerance || lambdaw >= wl - tolerance );
}

View File

@ -106,8 +106,8 @@ class CORE_EXPORT QgsGeometryUtils
* \param p2 First segment end point
* \param q1 Second segment start point
* \param q2 Second segment end point
* \param inter Output parameter, the intersection point
* \param isIntersect Output parameter, return true if an intersection is found
* \param intersectionPoint Output parameter, the intersection point
* \param isIntersection Output parameter, return true if an intersection is found
* \param tolerance The tolerance to use
* \param acceptImproperIntersection By default, this method returns true only if segments have proper intersection. If set true, returns also true if segments have improper intersection (end of one segment on other segment ; continuous segments).
* \returns Whether the segments intersect
@ -135,7 +135,7 @@ class CORE_EXPORT QgsGeometryUtils
* # (True, 'Point (0 0)', True)
* \endcode
*/
static bool segmentIntersection( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &inter SIP_OUT, bool &isIntersect SIP_OUT, double tolerance, bool acceptImproperIntersection = false );
static bool segmentIntersection( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &intersectionPoint SIP_OUT, bool &isIntersection SIP_OUT, double tolerance, bool acceptImproperIntersection = false );
/**
* \brief Project the point on a segment