<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009

      xmlns:s="library://ns.adobe.com/flex/spark" 

      xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:supportClasses="com.esri.ags.skins.supportClasses.*" minWidth="955" minHeight="600" xmlns:esri="http://www.esri.com/2008/ags"

      initialize="init()"

      >     

 <fx:Script>

  <![CDATA[

   import com.esri.ags.Graphic;

   import com.esri.ags.SpatialReference;

   import com.esri.ags.geometry.MapPoint;

   import com.esri.ags.geometry.Polyline;

   import com.esri.ags.layers.GraphicsLayer;

   import com.esri.ags.symbols.SimpleLineSymbol;

   import com.esri.ags.symbols.SimpleMarkerSymbol;

import mx.controls.Alert;

   private var arr:Array=

    [new MapPoint(123.361328,41.265625,new SpatialReference(5326)),

     new MapPoint(123.720703,41.703125,new SpatialReference(5326)),

     new MapPoint(123.431641,41.320313,new SpatialReference(5326)),

     new MapPoint(123.646484,41.515625,new SpatialReference(5326)),

     new MapPoint(123.763272,41.734675,new SpatialReference(5326)),

     new MapPoint(123.248047,41.710938,new SpatialReference(5326)),

     new MapPoint(124.248047,42.510938,new SpatialReference(5326)),

     new MapPoint(123.748047,43.210938,new SpatialReference(5326)),

     new MapPoint(123.748047,43.210938,new SpatialReference(5326))

    ];

   private var polyine:Polyline=new Polyline();

   private var graphicsLayer:GraphicsLayer=new GraphicsLayer();

   private var grahpic:Graphic=new Graphic();

   

   private function init():void

   {

    graphicsLayer.add(grahpic);

    Map.addLayer(graphicsLayer);

   }      

   private function PlayPoint(e:MouseEvent):void

   {

    

    graphicsLayer.clear();

    var i:int=0;

    var timer:Timer = new Timer(1000, arr.length-1);

    timer.addEventListener(TimerEvent.TIMER, TimerMethod);

    timer.start();

    function TimerMethod(event:TimerEvent):void

    {

     var mps:Array=new Array;

     var mpStat:MapPoint=arr[i] as MapPoint;

     

     

     grahpic=new Graphic(mpStat,sps);

     

     graphicsLayer.add(grahpic);

     i=i+1;

    }

   }

   private function PlayLine(e:MouseEvent):void

   {

    

    polyine=new Polyline();

    var i:int=0;

    var timer:Timer = new Timer(1000, arr.length-1);

    timer.addEventListener(TimerEvent.TIMER, TimerMethod);

    timer.start();

    function TimerMethod(event:TimerEvent):void

    {

     var mps:Array=new Array;

     var mpStat:MapPoint=arr[i] as MapPoint;

     var mpEnd:MapPoint=arr[i+1] as MapPoint;

     mps.push(mpStat);

     mps.push(mpEnd);

     polyine.addPath(mps);

        

     grahpic=new Graphic(polyine,sls);

     

     graphicsLayer.add(grahpic);

     i=i+1;

    }

   }

     

   

  ]]>

 </fx:Script>

 <fx:Declarations>

  <!-- 将非可视元素(比如服务、值对象)放在此处 -->

  <esri:SimpleLineSymbol id="sls"

          width="3"

          color="0x00FF00"/>

  <esri:SimpleMarkerSymbol id="sms"

         color="0x00FF00"

         size="12"

         style="square"/>

  <esri:PictureMarkerSymbol id="sps" source="http://localhost/Red_glow.swf"  width="20" height="20" />

 

 </fx:Declarations>

 <esri:Map id="Map" >

  <esri:ArcGISDynamicMapServiceLayer url="xxx "/>

</esri:Map>

 

  

 <mx:ControlBar  width="100%" top="0" left="0" paddingTop="0" paddingBottom="0"   horizontalAlign="left" >

  <mx:Button label="開始点轨迹"  width="100" fontSize="12" click="PlayPoint(event)"/>

  <mx:Button label="開始线轨迹"  width="100" fontSize="12" click="PlayLine(event)"/>

 </mx:ControlBar>

</s:Application>

ArcGIS Api For Flex 动态画点和线的更多相关文章

  1. ArcGIS API for Flex实现GraphicsLayer上画点、线、面。

    目的: ArcGIS API for Flex实现GraphicsLayer上画点.线.面. 准备工作: 1.这次地图数据就用Esri提供的http://server.arcgisonline.com ...

  2. arcgis api for flex之专题图制作(饼状图,柱状图等)

    最近公司给我一个任务,就是利用arcgis api for flex实现在地图上点(业务数据)直接显示饼状图以及柱状图的专题图制作,而不是通过点击点显示气泡窗口的形式来实现,这个公司已经实现了. 经过 ...

  3. 天津政府应急系统之GIS一张图(arcgis api for flex)讲解(十)态势标绘模块

    config.xml文件的配置如下: <widget label="态势标绘" icon="assets/images/impact_area_over.png&q ...

  4. 天津政府应急系统之GIS一张图(arcgis api for flex)讲解(一)GIS一张图的系统开发环境以及flexviewer框架

    系统的GIS功能实现是基于arcgis api for flex,首先附上系统的主界面图,接下来的是对主界面的模块功能详细讲解: 一.GIS环境软件安装 (1)arcgis desktop的安装,要是 ...

  5. Clustering with the ArcGIS API for Flex

    Clustering is an excellent technique for visualizing lotss of point data. We've all seen application ...

  6. ArcGIS API for Silverlight动态标绘的实现

    原文:ArcGIS API for Silverlight动态标绘的实现 1.下载2个dll文件,分别是: ArcGISPlotSilverlightAPI.dll 和 Matrix.dll 其下载地 ...

  7. arcgis api for flex 开发入门(一)环境搭建

    http://www.cnblogs.com/wenjl520/archive/2009/06/02/1494514.html arcgis api for flex 开发入门(一)环境搭建arcgi ...

  8. 天津政府应急系统之GIS一张图(arcgis api for flex)讲解(十三)台风模块

    config.xml文件的配置如下: <widget label="台风" icon="assets/images/typhoon.png" config ...

  9. 天津政府应急系统之GIS一张图(arcgis api for flex)讲解(十一)路径导航模块

    config.xml文件的配置如下: <widget label="路径导航" icon="assets/images/lujingdaohang.png" ...

随机推荐

  1. NOIP2016 天天爱跑步(树上差分)

    题意 给定一棵树,从时刻 0 开始,有若干人从 S[i] 出发向 T[i] 移动,每单位时刻移动一条边 对于树上每个点 x,求 w[x]  时刻有多少人恰好路过 x N,M≤300000 题解 从上午 ...

  2. PostgreSQL指定用户可访问的数据库pg_hba.conf

    进入指定目录: # cd /var/lib/pgsql/9.3/data/ 使用vi编辑pg_hba.conf文件 # vi pg_hba.conf 以上配置为所有IP及网关都允许访问,使用MD5认证 ...

  3. Varnish 问题点 与 技术方案 Varnish 优劣分析

      A10 有没有能做热点统计   1 Varnish 分布式 HA  (目前没有HA) 2 Varnish 热点监控     (建议热点需要外部插件统计,API的话目前并木有发现,但是他自带一个伪热 ...

  4. [Python] Slice the data with pandas

    For example we have dataframe like this: SPY AAPL IBM GOOG GLD 2017-01-03 222.073914 114.311760 160. ...

  5. IOS--文件管理NSFileManager

    iOS的沙盒机制.应用仅仅能訪问自己应用文件夹下的文件.iOS不像android.没有SD 卡概念.不能直接訪问图像.视频等内容. iOS应用产生的内容,如图像.文件.缓存内容等都必须存储在自己的沙盒 ...

  6. 正则表达式 Tricks

    *:0 或 多个 ?:任意一个 [list]:a[xyz]b,a 与 b 之间必须也只能有一个字符,但只能是 x/y/z,也即:axb, ayb, azb [!list]:匹配除 list 中的任意单 ...

  7. 分贝(dB)的理解

    分贝(dB,decibels)表达的是功率比(power ratio,P2/P1),而不是一个amount,P2>P1,分贝为正值,否则为负值.分贝是对数形式的,而不是线性形式的,也即 20 d ...

  8. 安装vnc出现的问题

    重启vnc 命令:/sbin/service vncserver start或者vncserver VNC的启动/停止/重启 #service vncserver start/stop/restart ...

  9. hashCode 和 equals 方法

    hashCode 和 equals 方法 hashCode()和equals()定义在Object类中,这个类是所有java类的基类,所以所有的java类都继承这两个方法. 使用hashCode()和 ...

  10. <QT之Bug制造机>QT中串口类“QSerialPort”的学习笔记

    QT5中已经增加了串口类QSrialPort,可以直接调用API函数进行快速开发. 1. 获取串口信息 Dialog::Dialog(QWidget *parent) : QDialog(parent ...