readd qgsgeometry method

This commit is contained in:
Loïc Bartoletti 2021-05-17 10:18:19 +02:00 committed by Nyall Dawson
parent da7c614f1a
commit ba409e0832
2 changed files with 43 additions and 0 deletions

View File

@ -832,6 +832,28 @@ looping twice over the set of points.
points whose z or m value is closest to the original x/y point, but only the first one found.
.. versionadded:: 3.20
%End
static bool transferFirstZOrMValueToPoint( const QgsGeometry &geom, QgsPoint &point );
%Docstring
A Z or M dimension is added to ``point`` if one of the points in the list
``points`` contains Z or M value.
This method is equivalent to successively calling Z and M but avoiding
looping twice over the set of points.
:param geom: geometry in which a M point is searched.
:param point: The point to update with Z or M dimension and value.
:return: ``True`` if the point is updated, ``False`` otherwise
.. warning::
This method does not copy the z or m value of the coordinate from the
points whose z or m value is closest to the original x/y point, but only the first one found.
.. versionadded:: 3.20
%End

View File

@ -889,6 +889,27 @@ class CORE_EXPORT QgsGeometryUtils
return QgsGeometryUtils::transferFirstZOrMValueToPoint( points.constBegin(), points.constEnd(), point );
}
/**
* A Z or M dimension is added to \a point if one of the points in the list
* \a points contains Z or M value.
*
* This method is equivalent to successively calling Z and M but avoiding
* looping twice over the set of points.
*
* \param geom geometry in which a M point is searched.
* \param point The point to update with Z or M dimension and value.
* \returns TRUE if the point is updated, FALSE otherwise
*
* \warning This method does not copy the z or m value of the coordinate from the
* points whose z or m value is closest to the original x/y point, but only the first one found.
*
* \since QGIS 3.20
*/
static bool transferFirstZOrMValueToPoint( const QgsGeometry &geom, QgsPoint &point )
{
return QgsGeometryUtils::transferFirstZOrMValueToPoint( geom.vertices_begin(), geom.vertices_end(), point );
}
/**
* Returns the point (\a pointX, \a pointY) forming the bisector from segment (\a aX \a aY) (\a bX \a bY)
* and segment (\a bX, \a bY) (\a dX, \a dY).