Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
11 additions
and
1 deletion.
-
+0
−1
src/core/qgsgeometry.cpp
-
+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" |
|
|
|
|
|