mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Added QgsGeometry::buffer() function that returns buffer around the geometry.
git-svn-id: http://svn.osgeo.org/qgis/trunk@7986 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
764ee5d0a7
commit
be72a7a663
@ -208,6 +208,10 @@ not disjoint with existing polygons of the feature*/
|
||||
/** Test for containment of a point (uses GEOS) */
|
||||
bool contains(QgsPoint* p);
|
||||
|
||||
/** Returns a buffer region around this geometry having the given width and with a specified number
|
||||
of segments used to approximate curves */
|
||||
QgsGeometry* buffer(double distance, int segments) /Factory/;
|
||||
|
||||
/**Creates a geos geometry from this features geometry. Note, that the returned object needs to be deleted*/
|
||||
// TODO: unsupported class... would be possible to use PyGEOS?
|
||||
//geos::Geometry* geosGeometry() const;
|
||||
|
@ -5511,3 +5511,15 @@ double QgsGeometry::distance(QgsGeometry& geom)
|
||||
|
||||
return mGeos->distance(geom.mGeos);
|
||||
}
|
||||
|
||||
|
||||
QgsGeometry* QgsGeometry::buffer(double distance, int segments)
|
||||
{
|
||||
if (mGeos == NULL)
|
||||
exportWkbToGeos();
|
||||
GEOS_GEOM::Geometry* geos = mGeos->buffer(distance, segments);
|
||||
QgsGeometry* g = new QgsGeometry;
|
||||
g->setGeos(geos);
|
||||
return g;
|
||||
}
|
||||
|
||||
|
@ -278,6 +278,10 @@ not disjoint with existing polygons of the feature*/
|
||||
/** Test for containment of a point (uses GEOS) */
|
||||
bool contains(QgsPoint* p);
|
||||
|
||||
/** Returns a buffer region around this geometry having the given width and with a specified number
|
||||
of segments used to approximate curves */
|
||||
QgsGeometry* buffer(double distance, int segments);
|
||||
|
||||
/** Exports the geometry to mWkt
|
||||
@return true in case of success and false else
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user