作者:老翅几回寒_332 | 来源:互联网 | 2023-09-25 15:28
1.AE的COM对象释放问题尤其是IFeatureCursor建议用ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(pObj);或者intiRefsLeft
1.AE的COM对象释放问题尤其是IFeatureCursor
建议用
ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(pObj);
或者
int iRefsLeft = 0;
do
{
iRefsLeft = System.Runtime.InteropServices.Marshal.ReleaseComObject(pObj);
}
while (iRefsLeft > 0);
调用System.Runtime.InteropServices.Marshal.ReleaseComObject时
每次释放后有个返回值,表示还剩余的要释放的com对象,直到为0就不用释放了,只释放一次可能仍然导致未完全释放。而AE提供的方法就是Decrements the reference count to zero of the supplied runtime callable wrapper即将引用的com计数器减为0。
2尽量使用IWorkspaceFactory2
使用IWorkspaceFactory打开personal geodatabase时,有可能会报错,无法将system._comobject转为IWorkspaceFactory
3.ITopologicalOperator拓扑操作前图形最好Simplify
(pGeo1 as ITopologicalOperator).Simplify();
(pGeo2 as ITopologicalOperator).Simplify();
(pGeo2 as ITopologicalOperator).Intersect( pGeo1 , esriGeometryDimension.esriGeometry2Dimension);
否则可能报错 HRESULT:0x80040239