Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix problem where multipolyons changed to polygons in QgsGeometry::ma…
…keDifference (bug 968)

git-svn-id: http://svn.osgeo.org/qgis/trunk@8357 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 17, 2008
1 parent ae5d5ec commit 16331cf
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/core/qgsgeometry.cpp
Expand Up @@ -525,6 +525,12 @@ QGis::WKBTYPE QgsGeometry::wkbType()

QGis::VectorType QgsGeometry::vectorType()
{
if (mDirtyWkb)
{
// convert from GEOS
exportGeosToWkb();
}

QGis::WKBTYPE type = wkbType();
if (type == QGis::WKBPoint || type == QGis::WKBPoint25D ||
type == QGis::WKBMultiPoint || type == QGis::WKBMultiPoint25D)
Expand All @@ -541,6 +547,12 @@ QGis::VectorType QgsGeometry::vectorType()

bool QgsGeometry::isMultipart()
{
if (mDirtyWkb)
{
// convert from GEOS
exportGeosToWkb();
}

QGis::WKBTYPE type = wkbType();
if (type == QGis::WKBMultiPoint ||
type == QGis::WKBMultiPoint25D ||
Expand Down Expand Up @@ -3020,7 +3032,17 @@ int QgsGeometry::makeDifference(QgsGeometry* other)
{
if(mGeos->intersects(other->mGeos))
{
//check if multitype before and after
bool multiType = isMultipart();

mGeos = mGeos->difference(other->mGeos);
mDirtyWkb = true;

if(multiType && !isMultipart())
{
convertToMultiType();
exportWkbToGeos();
}
}
else
{
Expand All @@ -3035,8 +3057,6 @@ int QgsGeometry::makeDifference(QgsGeometry* other)
return 6;
}

//set wkb dirty to true
mDirtyWkb = true;
return 0;
}

Expand Down

0 comments on commit 16331cf

Please sign in to comment.