zoukankan      html  css  js  c++  java
  • C#+ AE 注意问题汇总(不断更新)

    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 
  • 相关阅读:
    FFT模板
    树链剖分模板
    295. 数据流的中位数
    我罗斯方块最终篇
    面向对象程序设计寒假作业3
    2020面向对象寒假作业(二)
    2020面向对象程序设计寒假作业1
    违规二哥
    士大夫和为啥
    啥给测试
  • 原文地址:https://www.cnblogs.com/jhlong/p/5394434.html
Copyright © 2011-2022 走看看