合并图形失败,其中有图形有拓扑错误,导致合并的结果有图形丢失。
public static Geometry UnionGeometry(Recordset pRecordset)
{
List<Geometry> pGeommetryList = new List<Geometry>();
if (pRecordset != null && pRecordset.RecordCount > 0)
{
pRecordset.MoveFirst();
while (!pRecordset.IsEOF)
{
Geometry pGeo = pRecordset.GetGeometry();
GeoLine pLine = (pGeo as GeoRegion).ConvertToLine();
pGeommetryList.Add(pLine.ConvertToRegion());
pRecordset.MoveNext();
}
}
Geometry pResult = null;
foreach (Geometry pGeo in pGeommetryList)
{
if (pResult == null)
{
pResult = pGeo.Clone();
}
else
{
if (pGeo.ID == 14)
{
Geometry pTmp = pGeo.Clone();
pResult = Geometrist.Union(pResult, pTmp);
}
else
{
pResult = Geometrist.Union(pResult, pGeo.Clone());
}
}
}
return pResult;
}
希望在合并前(调用Geometrist.Union)能够处理一下拓扑。请告知处理单个图形Geometry的拓扑方法。