• ShapeLib插入要素,效率远远高于ArcEngine的插入要素


                  string str =_Path+"\\"+ _Name;

                string str =_Path+"\\"+ _Name;

                IntPtr tShapePtr = ShapeLib.SHPOpen(str+".shp","rb+");

                //其中 "rb+"代表可读 可写。

                IntPtr tDBFPtr = ShapeLib.DBFOpen((str) + ".dbf","rb+");

                int iShape = 0;

                for (int i = 0; i < _Rows; i++)

                    {

                        for (int j = 0; j < _Cols; j++)

                        {

                            double[] pX=null;

                            double[] pY=null;

                            getPolygon(i,j,ref pX,ref pY);

                            IntPtr tPolygon = ShapeLib.SHPCreateSimpleObject(ShapeLib.ShapeType.Polygon, pX.Length, pX, pY, null);

                            if (tPolygon!=IntPtr.Zero)

                            {

                                ShapeLib.SHPWriteObject(tShapePtr, iShape, tPolygon);

                                ShapeLib.DBFWriteIntegerAttribute(tDBFPtr, iShape, 0, iShape);

                                ShapeLib.SHPDestroyObject(tPolygon);

                            }

                            iShape++;

                        }

                    }

                ShapeLib.SHPClose(tShapePtr);

                ShapeLib.DBFClose(tDBFPtr);

  • 相关阅读:
    软件命名规则
    从命令行git转到Tortoise
    如何让浏览器不解析html?
    说几点我觉得谷歌浏览器不好的地方
    移动端开发:使用jQuery Mobile还是Zepto
    开源许可证GPL、BSD、MIT、Mozilla、Apache和LGPL的区别
    给大家讲个故事,感受一下什么叫CF。不知道的请认真听。
    cmd中utf-8编码的问题
    web前端关于html转义符的常用js函数
    js实例分析JavaScript中的事件委托和事件绑定
  • 原文地址:https://www.cnblogs.com/cglNet/p/2391633.html
Copyright © 2020-2023  润新知