zoukankan      html  css  js  c++  java
  • Flex 加载shp

    至于gis格式比较常见的shp是开源的,网上开源的as代码也很多 这个支持的shp算比较好的 源码在这边http://files.cnblogs.com/files/haibalai/shp.rar,加载shp必须勾选两个文件shp和dbf,shp是存取图形geometry信息。dbf是属性信息

     我这边写了个工具类调用

     1 package widgetscadastre.DwgLoad 
     2 {
     3     import com.esri.ags.Graphic;
     4     import com.szpl.extension.util.shp.dbf.DbfHeader;
     5     import com.szpl.extension.util.shp.dbf.DbfRecord;
     6     import com.szpl.extension.util.shp.dbf.DbfTools;
     7     import com.szpl.extension.util.shp.shp.ShpPolygon;
     8     import com.szpl.extension.util.shp.shp.ShpReader;
     9     import com.szpl.extension.util.shp.shp.ShpSymbol;
    10     import flash.events.Event;
    11     import flash.utils.ByteArray;
    12     import mx.collections.ArrayCollection;
    13     /**
    14      * ...
    15      * @author haibalai
    16      */
    17     public class ShpLoadTool 
    18     {
    19         
    20         public function ShpLoadTool() 
    21         {
    22             
    23         }
    24         
    25         private var _callFun:Function;
    26         public function shpLoad(shpByteArray:ByteArray, dbfByteArray:ByteArray,callFun:Function):void
    27         {
    28             _callFun = callFun; 
    29             var index:int = 0;
    30             const array:Array = [];
    31             const shpReader:ShpReader = new ShpReader(shpByteArray);
    32             const dbfHeader:DbfHeader = new DbfHeader(dbfByteArray);
    33             while (shpReader.hasMore())
    34             {
    35                 var shpPolygon:ShpPolygon = shpReader.readShpPolygon();
    36                 var dbfRecord:DbfRecord = DbfTools.getRecord(dbfByteArray, dbfHeader, index++);
    37                 array.push(new Graphic(shpPolygon, new ShpSymbol(), dbfRecord.values));
    38             }
    39         
    40             _callFun.call(null,array);
    41             
    42         }
    43         
    44     }
    45 
    46 }
  • 相关阅读:
    3dsmax script export/import tools
    BOBO输出插件的一些信息
    任务
    说说谷歌在线电子表格
    EditGrid在线编辑Excel文档
    如何控制,textField的宽度,
    在线文档管理平台
    雅虎的这个效果,有机会实现一下
    推荐在线电子表格EditGrid
    我的台账录入界面
  • 原文地址:https://www.cnblogs.com/haibalai/p/5029889.html
Copyright © 2011-2022 走看看