Skip to content
Permalink
Browse files

Expose makeValid() errors to QgsGeometry::error()

  • Loading branch information
m-kuhn committed Aug 13, 2017
1 parent feffa04 commit d0f33d6d05cb07b4ea83249ffbfb0143135b3715
Showing with 17 additions and 6 deletions.
  1. +9 −3 python/core/geometry/qgsgeometry.sip
  2. +1 −2 src/core/geometry/qgsgeometry.cpp
  3. +7 −1 src/core/geometry/qgsgeometry.h
@@ -1109,15 +1109,21 @@ Ring 0 is outer ring and can't be deleted.
%Docstring
Attempts to make an invalid geometry valid without losing vertices.

.. note::

Ported from PostGIS ST_MakeValid() and it should return equivalent results.
Already-valid geometries are returned without further intervention.
In case of full or partial dimensional collapses, the output geometry may be a collection
of lower-to-equal dimension geometries or a geometry of lower dimension.
Single polygons may become multi-geometries in case of self-intersections.
It preserves Z values, but M values will be dropped.

If an error was encountered during the process, more information can be retrieved
by calling `error()` on the returned geometry.

:return: new valid QgsGeometry or null geometry on error

.. note::

Ported from PostGIS ST_MakeValid() and it should return equivalent results.

.. versionadded:: 3.0
:rtype: QgsGeometry
%End
@@ -2012,8 +2012,7 @@ QgsGeometry QgsGeometry::makeValid()
if ( !d->geometry )
return QgsGeometry();

QString errorMsg;
QgsAbstractGeometry *g = _qgis_lwgeom_make_valid( d->geometry, errorMsg );
QgsAbstractGeometry *g = _qgis_lwgeom_make_valid( d->geometry, d->error );

return QgsGeometry( g );
}
@@ -993,13 +993,19 @@ class CORE_EXPORT QgsGeometry
/**
* Attempts to make an invalid geometry valid without losing vertices.
*
* \note Ported from PostGIS ST_MakeValid() and it should return equivalent results.
* Already-valid geometries are returned without further intervention.
* In case of full or partial dimensional collapses, the output geometry may be a collection
* of lower-to-equal dimension geometries or a geometry of lower dimension.
* Single polygons may become multi-geometries in case of self-intersections.
* It preserves Z values, but M values will be dropped.
*
* If an error was encountered during the process, more information can be retrieved
* by calling `error()` on the returned geometry.
*
* \returns new valid QgsGeometry or null geometry on error
*
* \note Ported from PostGIS ST_MakeValid() and it should return equivalent results.
*
* \since QGIS 3.0
*/
QgsGeometry makeValid();

0 comments on commit d0f33d6

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