В продолжение моей темы
Оверлейные операцииПри большом количестве полигонов, которыми нужно вырезать области в исходном, при попытке удалить feature "полигона-дырки" происходит эксепшн вот такой
[System.Runtime.InteropServices.COMException] = {"Error HRESULT E_FAIL has been returned from a call to a COM component."}
Source = "ESRI.ArcGIS.Geodatabase"
StackTrace = " at ESRI.ArcGIS.Geodatabase.IFeature.Delete()\r\n at ConverterCadastr.clsConvert.CutOrJoinPart(IFeature pFeature, IFeature pPartFeature) in D:\\DOC\\Visual Studio 2005\\Projects\\clsConvert.cs:line 381"
TargetSite = {Void Delete()}
_HResult = -2147467259
_xcode = -532459699
А вот код
private bool CutOrJoinPart (IFeature pFeature, IFeature pPartFeature)
{
try
{
IRelationalOperator pRelOp = (IRelationalOperator)pFeature.Shape;
ITopologicalOperator pTopoOp = (ITopologicalOperator)pFeature.Shape;
if (pRelOp != null && pTopoOp != null)
{
IGeometry pHostGeometry = pFeature.Shape as IGeometry;
IGeometry pSlaveGeometry = pPartFeature.Shape as IGeometry;
if (pRelOp.Contains(pSlaveGeometry) == true || (pRelOp.Crosses(pSlaveGeometry) == true))
{
pHostGeometry = pTopoOp.Difference(pSlaveGeometry);
pFeature.Shape = pHostGeometry;
pFeature.Store();
pPartFeature.Delete();//вот тута return true;
а вызов этой процедуры происходит так
for (Int32 l = 0; l < h; l++)
{
if (FeatureArray[0] != null && FeatureArray[l + 1] != null)
{
if (CutOrJoinPart(FeatureArray[0], FeatureArray[l + 1]) == true)
{
}
else
{
}
}
Работат при малом количестве "полигонов дырок"