Skip to content

Commit 35f10e1

Browse files
author
wonder
committed
Applied patch of Stefanie Tellex, fixes QgsGeometry::setWkbGeometry() in Python
Thanks! git-svn-id: http://svn.osgeo.org/qgis/trunk@8580 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent f250c3f commit 35f10e1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

python/core/qgsgeometry.sip

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,13 @@ class QgsGeometry
5959
Set the geometry, feeding in the buffer containing OGC Well-Known Binary and the buffer's length.
6060
This class will take ownership of the buffer.
6161
*/
62-
// SIP: buffer will be transferred from python to C++
63-
// TODO: create pythonic interface that will receive wkb as a string
64-
void setWkbAndOwnership(unsigned char * wkb /Transfer, Array/, size_t length /ArraySize/);
62+
void setWkbAndOwnership(unsigned char * wkb /Array/, size_t length /ArraySize/);
63+
%MethodCode
64+
// create copy of Python's string and pass it to setWkbAndOwnership()
65+
unsigned char * copy = new unsigned char[a1];
66+
memcpy(copy, a0, a1);
67+
sipCpp->setWkbAndOwnership(copy, a1);
68+
%End
6569

6670
/**
6771
Returns the buffer containing this geometry in WKB format.

0 commit comments

Comments
 (0)