Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix QgsGeometry::asMultiPoint() (followup 6bbd17c; fixes #9423)
  • Loading branch information
jef-n committed Jan 25, 2014
1 parent 9439eb8 commit 781e34a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/core/qgsgeometry.cpp
Expand Up @@ -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 );
}

Expand Down
11 changes: 11 additions & 0 deletions tests/src/python/test_qgsgeometry.py
Expand Up @@ -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"

Expand Down

0 comments on commit 781e34a

Please sign in to comment.