Skip to content
Permalink
Browse files

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
mhugent committed Apr 17, 2008
1 parent ae5d5ec commit 16331cf62a402bd595c5d018c5af05d0f8f011e1
Showing with 22 additions and 2 deletions.
  1. +22 −2 src/core/qgsgeometry.cpp
@@ -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)
@@ -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 ||
@@ -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
{
@@ -3035,8 +3057,6 @@ int QgsGeometry::makeDifference(QgsGeometry* other)
return 6;
}

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

0 comments on commit 16331cf

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