From b5801afe29885a04758beeeee9bd708fc793fc03 Mon Sep 17 00:00:00 2001 From: Marco Hugentobler Date: Tue, 26 May 2015 11:42:27 +0200 Subject: [PATCH] Update python bindings for QgsGeometry --- python/core/geometry/qgsgeometry.sip | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/python/core/geometry/qgsgeometry.sip b/python/core/geometry/qgsgeometry.sip index aadc248696c..e1f3e216960 100644 --- a/python/core/geometry/qgsgeometry.sip +++ b/python/core/geometry/qgsgeometry.sip @@ -480,5 +480,47 @@ class QgsGeometry @returns the new computed QgsGeometry, or null */ static QgsGeometry *unaryUnion( const QList& geometryList ) /Factory/; + + /** Compares two polylines for equality within a specified tolerance. + * @param p1 first polyline + * @param p2 second polyline + * @param epsilon maximum difference for coordinates between the polylines + * @returns true if polylines have the same number of points and all + * points are equal within the specified tolerance + * @note added in QGIS 2.9 + */ + static bool compare( const QgsPolyline& p1, const QgsPolyline& p2, double epsilon = 4 * DBL_EPSILON ); + + /** Compares two polygons for equality within a specified tolerance. + * @param p1 first polygon + * @param p2 second polygon + * @param epsilon maximum difference for coordinates between the polygons + * @returns true if polygons have the same number of rings, and each ring has the same + * number of points and all points are equal within the specified tolerance + * @note added in QGIS 2.9 + */ + static bool compare( const QgsPolygon& p1, const QgsPolygon& p2, double epsilon = 4 * DBL_EPSILON ); + + /** Compares two multipolygons for equality within a specified tolerance. + * @param p1 first multipolygon + * @param p2 second multipolygon + * @param epsilon maximum difference for coordinates between the multipolygons + * @returns true if multipolygons have the same number of polygons, the polygons have the same number + * of rings, and each ring has the same number of points and all points are equal within the specified + * tolerance + * @note added in QGIS 2.9 + */ + static bool compare( const QgsMultiPolygon& p1, const QgsMultiPolygon& p2, double epsilon = 4 * DBL_EPSILON ); + + /**Smooths a geometry by rounding off corners using the Chaikin algorithm. This operation + * roughly doubles the number of vertices in a geometry. + * @param iterations number of smoothing iterations to run. More iterations results + * in a smoother geometry + * @param offset fraction of line to create new vertices along, between 0 and 1.0 + * eg the default value of 0.25 will create new vertices 25% and 75% along each line segment + * of the geometry for each iteration. Smaller values result in "tighter" smoothing. + * @note added in 2.9 + */ + QgsGeometry* smooth( const unsigned int iterations, const double offset ) const; }; // class QgsGeometry