Skip to content

Commit db0b6dc

Browse files
author
mhugent
committed
fix for addIsland to work also with polygons that are no longer in the view extent (bug #1495)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10122 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 663e6b4 commit db0b6dc

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/core/qgsvectorlayer.cpp

+18-1
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@ int QgsVectorLayer::addIsland( const QList<QgsPoint>& ring )
16571657
}
16581658
}
16591659

1660-
//else, if must be contained in mCachedGeometries
1660+
//is the feature contained in the view extent (mCachedGeometries) ?
16611661
QgsGeometryMap::iterator cachedIt = mCachedGeometries.find( selectedFeatureId );
16621662
if ( cachedIt != mCachedGeometries.end() )
16631663
{
@@ -1669,6 +1669,23 @@ int QgsVectorLayer::addIsland( const QList<QgsPoint>& ring )
16691669
}
16701670
return errorCode;
16711671
}
1672+
else //maybe the selected feature has been moved outside the visible area and therefore is not contained in mCachedGeometries
1673+
{
1674+
QgsFeature f;
1675+
QgsGeometry* fGeom = 0;
1676+
if(featureAtId( selectedFeatureId, f, true, false ))
1677+
{
1678+
fGeom = f.geometryAndOwnership();
1679+
if(fGeom)
1680+
{
1681+
int errorCode = fGeom->addIsland(ring);
1682+
mChangedGeometries.insert( selectedFeatureId, *fGeom);
1683+
setModified( true, true );
1684+
delete fGeom;
1685+
return errorCode;
1686+
}
1687+
}
1688+
}
16721689

16731690
return 6; //geometry not found
16741691
}

0 commit comments

Comments
 (0)