Skip to content
Permalink
Browse files

Return empty point instead of point( 0, 0 )

  • Loading branch information
uclaros authored and nyalldawson committed May 18, 2020
1 parent d03d190 commit 0beee90f09ed98297e6c4c166627c5ec60aa1109
Showing with 6 additions and 6 deletions.
  1. +2 −2 src/core/geometry/qgsgeometry.cpp
  2. +3 −3 src/core/geometry/qgsgeometry.h
  3. +1 −1 src/core/geometry/qgstriangle.h
@@ -385,7 +385,7 @@ QgsPointXY QgsGeometry::closestVertex( const QgsPointXY &point, int &atVertex, i
if ( !d->geometry )
{
sqrDist = -1;
return QgsPointXY( 0, 0 );
return QgsPointXY();
}

QgsPoint pt( point.x(), point.y() );
@@ -395,7 +395,7 @@ QgsPointXY QgsGeometry::closestVertex( const QgsPointXY &point, int &atVertex, i
if ( !id.isValid() )
{
sqrDist = -1;
return QgsPointXY( 0, 0 );
return QgsPointXY();
}
sqrDist = QgsGeometryUtils::sqrDistance2D( pt, vp );

@@ -632,7 +632,7 @@ class CORE_EXPORT QgsGeometry
* \param afterVertex will be set to the vertex index of the next vertex after the closest one. Will be set to -1 if
* not present.
* \param sqrDist will be set to the square distance between the closest vertex and the specified point
* \returns closest point in geometry. If not found (empty geometry), returns null point nad sqrDist is negative.
* \returns closest point in geometry. If not found (empty geometry), returns null point and sqrDist is negative.
*/
QgsPointXY closestVertex( const QgsPointXY &point, int &atVertex SIP_OUT, int &beforeVertex SIP_OUT, int &afterVertex SIP_OUT, double &sqrDist SIP_OUT ) const;

@@ -731,7 +731,7 @@ class CORE_EXPORT QgsGeometry
/**
* Returns coordinates of a vertex.
* \param atVertex index of the vertex
* \returns Coordinates of the vertex or QgsPoint(0,0) on error
* \returns Coordinates of the vertex or empty QgsPoint() on error
*/
QgsPoint vertexAt( int atVertex ) const;

@@ -1630,7 +1630,7 @@ class CORE_EXPORT QgsGeometry
*
* Any z or m values present in the geometry will be discarded.
*
* \warning If the geometry is not a single-point type, a QgsPoint( 0, 0 ) will be returned.
* \warning If the geometry is not a single-point type, an empty QgsPointXY() will be returned.
*/
QgsPointXY asPoint() const;
#else
@@ -101,7 +101,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygon
/**
* Returns coordinates of a vertex.
* \param atVertex index of the vertex
* \returns Coordinates of the vertex or QgsPoint(0,0) on error (\a atVertex < 0 or > 3).
* \returns Coordinates of the vertex or empty QgsPoint() on error (\a atVertex < 0 or > 3).
*/
QgsPoint vertexAt( int atVertex ) const;

0 comments on commit 0beee90

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