Skip to content

Commit

Permalink
backport of bugfix for #1495
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/branches/Version-1_0@10124 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Feb 7, 2009
1 parent d059cc6 commit bc91f2b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/core/qgsvectorlayer.cpp
Expand Up @@ -1648,7 +1648,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() )
{
Expand All @@ -1660,6 +1660,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
}
Expand Down

0 comments on commit bc91f2b

Please sign in to comment.