Skip to content
Permalink
Browse files

QgsGeometryUtils: rename 2 methods

- projPointOnSegment has been renamed to projectPointOnSegment
- getSelfIntersections has been renamed to selfIntersections
  • Loading branch information
3nids committed Jan 24, 2018
1 parent 5f5f1f9 commit 0e7cea2244404651635a9bdab67a0c6dd8867992
@@ -1251,6 +1251,9 @@ QgsGeometryUtils {#qgis_api_break_3_0_QgsGeometryUtils}
- 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".
- projPointOnSegment has been renamed to projectPointOnSegment
- getSelfIntersections has been renamed to selfIntersections


QgsGPSConnectionRegistry {#qgis_api_break_3_0_QgsGPSConnectionRegistry}
------------------------
@@ -153,7 +153,7 @@ the closest point to the initial ``intersection`` point is returned.
@return true if an intersection has been found
%End

static QgsPoint projPointOnSegment( const QgsPoint &p, const QgsPoint &s1, const QgsPoint &s2 );
static QgsPoint projectPointOnSegment( const QgsPoint &p, const QgsPoint &s1, const QgsPoint &s2 );
%Docstring
Project the point on a segment

@@ -62,7 +62,7 @@ void QgsGeometrySelfContactCheck::collectErrors( QList<QgsGeometryCheckError *>
}
const QgsPoint &si = ring[i];
const QgsPoint &sj = ring[j];
QgsPoint q = QgsGeometryUtils::projPointOnSegment( p, si, sj );
QgsPoint q = QgsGeometryUtils::projectPointOnSegment( p, si, sj );
if ( QgsGeometryUtils::sqrDistance2D( p, q ) < mContext->tolerance * mContext->tolerance )
{
errors.append( new QgsGeometryCheckError( this, layerFeature, p, QgsVertexId( iPart, iRing, vtxMap[iVert] ) ) );
@@ -71,7 +71,7 @@ void QgsGeometrySelfIntersectionCheck::collectErrors( QList<QgsGeometryCheckErro
{
for ( int iRing = 0, nRings = geom->ringCount( iPart ); iRing < nRings; ++iRing )
{
for ( const QgsGeometryUtils::SelfIntersection &inter : QgsGeometryUtils::getSelfIntersections( geom, iPart, iRing, mContext->tolerance ) )
for ( const QgsGeometryUtils::SelfIntersection &inter : QgsGeometryUtils::selfIntersections( geom, iPart, iRing, mContext->tolerance ) )
{
errors.append( new QgsGeometrySelfIntersectionCheckError( this, layerFeature, inter.point, QgsVertexId( iPart, iRing ), inter ) );
}
@@ -45,7 +45,7 @@ QgsSnapIndex::SegmentSnapItem::SegmentSnapItem( const QgsSnapIndex::CoordIdx *_i

QgsPoint QgsSnapIndex::SegmentSnapItem::getSnapPoint( const QgsPoint &p ) const
{
return QgsGeometryUtils::projPointOnSegment( p, idxFrom->point(), idxTo->point() );
return QgsGeometryUtils::projectPointOnSegment( p, idxFrom->point(), idxTo->point() );
}

bool QgsSnapIndex::SegmentSnapItem::getIntersection( const QgsPoint &p1, const QgsPoint &p2, QgsPoint &inter ) const
@@ -690,7 +690,7 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl
if ( subjPointFlags[iPart][iRing][iVert] == SnappedToRefSegment &&
subjPointFlags[iPart][iRing][iPrev] != Unsnapped &&
subjPointFlags[iPart][iRing][iNext] != Unsnapped &&
QgsGeometryUtils::sqrDistance2D( QgsGeometryUtils::projPointOnSegment( pMid, pPrev, pNext ), pMid ) < 1E-12 )
QgsGeometryUtils::sqrDistance2D( QgsGeometryUtils::projectPointOnSegment( pMid, pPrev, pNext ), pMid ) < 1E-12 )
{
if ( ( ringIsClosed && nVerts > 3 ) || ( !ringIsClosed && nVerts > 2 ) )
{
@@ -84,7 +84,7 @@ QgsEllipse QgsEllipse::fromCenter2Points( const QgsPoint &center, const QgsPoint
double azimuth = 180.0 / M_PI * QgsGeometryUtils::lineAngle( center.x(), center.y(), pt1.x(), pt1.y() );
double axis_a = center.distance( pt1 );

double length = pt2.distance( QgsGeometryUtils::projPointOnSegment( pt2, center, pt1 ) );
double length = pt2.distance( QgsGeometryUtils::projectPointOnSegment( pt2, center, pt1 ) );
QgsPoint pp = center.project( length, 90 + azimuth );
double axis_b = center.distance( pp );

@@ -360,7 +360,7 @@ bool QgsGeometryUtils::lineCircleIntersection( const QgsPointXY &center, const d
}
}

QVector<QgsGeometryUtils::SelfIntersection> QgsGeometryUtils::getSelfIntersections( const QgsAbstractGeometry *geom, int part, int ring, double tolerance )
QVector<QgsGeometryUtils::SelfIntersection> QgsGeometryUtils::selfIntersections( const QgsAbstractGeometry *geom, int part, int ring, double tolerance )
{
QVector<SelfIntersection> intersections;

@@ -158,7 +158,7 @@ class CORE_EXPORT QgsGeometryUtils
* \param s2 The segment end point
* \returns The projection of the point on the segment
*/
static QgsPoint projPointOnSegment( const QgsPoint &p, const QgsPoint &s1, const QgsPoint &s2 )
static QgsPoint projectPointOnSegment( const QgsPoint &p, const QgsPoint &s1, const QgsPoint &s2 )
{
double nx = s2.y() - s1.y();
double ny = -( s2.x() - s1.x() );
@@ -184,7 +184,7 @@ class CORE_EXPORT QgsGeometryUtils
* \note not available in Python bindings
* \since QGIS 2.12
*/
static QVector<SelfIntersection> getSelfIntersections( const QgsAbstractGeometry *geom, int part, int ring, double tolerance ) SIP_SKIP;
static QVector<SelfIntersection> selfIntersections( const QgsAbstractGeometry *geom, int part, int ring, double tolerance ) SIP_SKIP;

/**
* Returns a value < 0 if the point (\a x, \a y) is left of the line from (\a x1, \a y1) -> ( \a x2, \a y2).

0 comments on commit 0e7cea2

Please sign in to comment.
You can’t perform that action at this time.