Skip to content
Permalink
Browse files

fix QgsGeometry::asMultiPoint() (followup 6bbd17c; fixes #9423)

  • Loading branch information
jef-n committed Jan 25, 2014
1 parent 9439eb8 commit 781e34a5bc690df4c1868bbc1b35cfdda0eb25da
Showing with 11 additions and 1 deletion.
  1. +0 −1 src/core/qgsgeometry.cpp
  2. +11 −0 tests/src/python/test_qgsgeometry.py
@@ -5367,7 +5367,6 @@ QgsMultiPoint QgsGeometry::asMultiPoint() const
QgsMultiPoint points( nPoints );
for ( int i = 0; i < nPoints; i++ )
{
wkbPtr += 1 + sizeof( int );
points[i] = asPoint( wkbPtr, hasZValue );
}

@@ -752,6 +752,17 @@ def testMultipoint(self):
if not TestQgsGeometry.wkbPtr:
return

# #9423
points = [ QgsPoint(10, 30), QgsPoint(40, 20), QgsPoint(30,10), QgsPoint(20,10) ]
wkt = "MULTIPOINT (10 30, 40 20, 30 10, 20 10)"
multipoint = QgsGeometry.fromWkt(wkt)
assert multipoint.isMultipart(), "Expected MULTIPOINT to be multipart"
assert multipoint.wkbType() == QGis.WKBMultiPoint, "Expected wkbType to be WKBMultipoint"
i = 0
for p in multipoint.asMultiPoint():
assert p == points[i], "Expected %s at %d, got %s" % (points[i].toString(), i, p.toString())
i+=1

multipoint = QgsGeometry.fromWkt( "MULTIPOINT(5 5)" )
assert multipoint.vertexAt( 0 ) == QgsPoint(5,5), "MULTIPOINT fromWkt failed"

0 comments on commit 781e34a

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