Skip to content
Permalink
Browse files

Fix QgsGeometry wkbType()

  • Loading branch information
mhugo committed Jan 25, 2016
1 parent 73bef58 commit 3418dd003daea8dd6444fb8259aaf1faeb5517bd
Showing with 5 additions and 1 deletion.
  1. +1 −1 src/core/geometry/qgsgeometry.cpp
  2. +4 −0 tests/src/python/test_qgsgeometry.py
@@ -300,7 +300,7 @@ QGis::WkbType QgsGeometry::wkbType() const
}
else
{
return static_cast< QGis::WkbType >( d->geometry->wkbType() );
return QGis::fromNewWkbType( d->geometry->wkbType() );
}
}

@@ -1697,6 +1697,7 @@ def testAddZValue(self):
geom = QgsGeometry.fromWkt('Polygon ((0 0, 1 0, 1 1, 2 1, 2 2, 0 2, 0 0))')
assert geom.geometry().addZValue(3)
assert geom.geometry().wkbType() == QgsWKBTypes.PolygonZ
assert geom.wkbType() == QGis.WKBPolygon25D
expWkt = 'PolygonZ ((0 0 3, 1 0 3, 1 1 3, 2 1 3, 2 2 3, 0 2 3, 0 0 3))'
wkt = geom.exportToWkt()
assert compareWkt(expWkt, wkt), "addZValue to CurvePolygon failed: mismatch Expected:\n%s\nGot:\n%s\n" % (expWkt, wkt)
@@ -1705,6 +1706,7 @@ def testAddZValue(self):
geom = QgsGeometry.fromWkt('MultiPoint ((1 2),(2 3))')
assert geom.geometry().addZValue(4)
assert geom.geometry().wkbType() == QgsWKBTypes.MultiPointZ
assert geom.wkbType() == QGis.WKBMultiPoint25D
expWkt = 'MultiPointZ ((1 2 4),(2 3 4))'
wkt = geom.exportToWkt()
assert compareWkt(expWkt, wkt), "addZValue to GeometryCollection failed: mismatch Expected:\n%s\nGot:\n%s\n" % (expWkt, wkt)
@@ -1713,6 +1715,7 @@ def testAddZValue(self):
geom = QgsGeometry.fromWkt('LineString (1 2, 2 3)')
assert geom.geometry().addZValue(4)
assert geom.geometry().wkbType() == QgsWKBTypes.LineStringZ
assert geom.wkbType() == QGis.WKBLineString25D
expWkt = 'LineStringZ (1 2 4, 2 3 4)'
wkt = geom.exportToWkt()
assert compareWkt(expWkt, wkt), "addZValue to LineString failed: mismatch Expected:\n%s\nGot:\n%s\n" % (expWkt, wkt)
@@ -1721,6 +1724,7 @@ def testAddZValue(self):
geom = QgsGeometry.fromWkt('Point (1 2)')
assert geom.geometry().addZValue(4)
assert geom.geometry().wkbType() == QgsWKBTypes.PointZ
assert geom.wkbType() == QGis.WKBPoint25D
expWkt = 'PointZ (1 2 4)'
wkt = geom.exportToWkt()
assert compareWkt(expWkt, wkt), "addZValue to Point failed: mismatch Expected:\n%s\nGot:\n%s\n" % (expWkt, wkt)

0 comments on commit 3418dd0

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