Skip to content

Commit

Permalink
fix for addIsland to work also with polygons that are no longer in th…
Browse files Browse the repository at this point in the history
…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.
19 changes: 18 additions & 1 deletion src/core/qgsvectorlayer.cpp
Expand Up @@ -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() )
{
Expand All @@ -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
}
Expand Down

0 comments on commit db0b6dc

Please sign in to comment.