Skip to content

Commit 134b413

Browse files
author
mhugent
committedApr 17, 2008
Fix problem where multipolyons changed to polygons in QgsGeometry::makeDifference (bug 968)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8357 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed
 

‎src/core/qgsgeometry.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,12 @@ QGis::WKBTYPE QgsGeometry::wkbType()
525525

526526
QGis::VectorType QgsGeometry::vectorType()
527527
{
528+
if (mDirtyWkb)
529+
{
530+
// convert from GEOS
531+
exportGeosToWkb();
532+
}
533+
528534
QGis::WKBTYPE type = wkbType();
529535
if (type == QGis::WKBPoint || type == QGis::WKBPoint25D ||
530536
type == QGis::WKBMultiPoint || type == QGis::WKBMultiPoint25D)
@@ -541,6 +547,12 @@ QGis::VectorType QgsGeometry::vectorType()
541547

542548
bool QgsGeometry::isMultipart()
543549
{
550+
if (mDirtyWkb)
551+
{
552+
// convert from GEOS
553+
exportGeosToWkb();
554+
}
555+
544556
QGis::WKBTYPE type = wkbType();
545557
if (type == QGis::WKBMultiPoint ||
546558
type == QGis::WKBMultiPoint25D ||
@@ -3020,7 +3032,17 @@ int QgsGeometry::makeDifference(QgsGeometry* other)
30203032
{
30213033
if(mGeos->intersects(other->mGeos))
30223034
{
3035+
//check if multitype before and after
3036+
bool multiType = isMultipart();
3037+
30233038
mGeos = mGeos->difference(other->mGeos);
3039+
mDirtyWkb = true;
3040+
3041+
if(multiType && !isMultipart())
3042+
{
3043+
convertToMultiType();
3044+
exportWkbToGeos();
3045+
}
30243046
}
30253047
else
30263048
{
@@ -3035,8 +3057,6 @@ int QgsGeometry::makeDifference(QgsGeometry* other)
30353057
return 6;
30363058
}
30373059

3038-
//set wkb dirty to true
3039-
mDirtyWkb = true;
30403060
return 0;
30413061
}
30423062

0 commit comments

Comments
 (0)
Please sign in to comment.