Skip to content
Permalink
Browse files
fix for addIsland to work also with polygons that are no longer in th…
…e view extent (bug #1495)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10122 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Feb 7, 2009
1 parent 663e6b4 commit db0b6dc
Showing 1 changed file with 18 additions and 1 deletion.
@@ -1657,7 +1657,7 @@ int QgsVectorLayer::addIsland( const QList<QgsPoint>& ring )
}
}

//else, if must be contained in mCachedGeometries
//is the feature contained in the view extent (mCachedGeometries) ?
QgsGeometryMap::iterator cachedIt = mCachedGeometries.find( selectedFeatureId );
if ( cachedIt != mCachedGeometries.end() )
{
@@ -1669,6 +1669,23 @@ int QgsVectorLayer::addIsland( const QList<QgsPoint>& ring )
}
return errorCode;
}
else //maybe the selected feature has been moved outside the visible area and therefore is not contained in mCachedGeometries
{
QgsFeature f;
QgsGeometry* fGeom = 0;
if(featureAtId( selectedFeatureId, f, true, false ))
{
fGeom = f.geometryAndOwnership();
if(fGeom)
{
int errorCode = fGeom->addIsland(ring);
mChangedGeometries.insert( selectedFeatureId, *fGeom);
setModified( true, true );
delete fGeom;
return errorCode;
}
}
}

return 6; //geometry not found
}

0 comments on commit db0b6dc

Please sign in to comment.