zoukankan      html  css  js  c++  java
  • 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);

  • 相关阅读:
    [erlang] Erlang继承(inheritance)
    [python]python 动态调用模块&类&方法
    [mysql]将mysql输入内容保存文件
    [erlang] Erlang TCP(gen_tcp)
    hdu 3350 #define is unsafe && hdu3328 Flipper
    hdu 1690 Bus System
    hdu 1401 Solitaire (双向广搜)
    hdu3172 Virtual Friends (并查集+字典树)
    hdu1426 Sudoku Killer
    hdu3111 Sudoku (精确覆盖解数独 DLX)
  • 原文地址:https://www.cnblogs.com/cglNet/p/2391633.html
Copyright © 2011-2022 走看看