<?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. Rman备份及不完全恢复操作

    最后更新时间:2018/12/18 启用归档 --检查是否为归档 SQL> archive log list; Database log mode              No Archive ...

  2. 到2023年将会有超过90%的PC采用SSD硬盘

    本文转载自超能网,其他媒体转载需经超能网同意 现在买电脑或者自己装机,还有谁不要SSD硬盘吗?这个问题似乎没什么可说的,SSD硬盘各种好,装机可以说是必选了,但实际上现在的SSD适配率并没有想象中那么 ...

  3. Python 读写文件 小应用:生成随机的测验试卷文件

    去年学习了python的读写文件部分,了解了python读写的常用模块os.shelve,今天准备把课后作业试着自己做一下 目标:1)生成35份试卷.每个试卷有50道选择题 2)为了防止有学生作弊,需 ...

  4. photoshop快捷键汇总

    图层应用相关快捷键: 复制图层:Ctrl+j 盖印图层:Ctrl+Alt+Shift+E 向下合并图层:Ctrl+E 合并可见图层:Ctrl+Shift+E 激活上一图层:Alt+中括号(]) 激活下 ...

  5. CMSIS-RTOS 简介

    CMSIS-RTOS API是基于Arm®Cortex®-M处理器的设备的通用RTOS接口.CMSIS-RTOS为需要RTOS功能的软件组件提供标准化API,从而为用户和软件行业带来了巨大的好处. C ...

  6. OpenCV图像处理篇之边缘检測算子

    3种边缘检測算子 灰度或结构等信息的突变位置是图像的边缘,图像的边缘有幅度和方向属性.沿边缘方向像素变化缓慢,垂直边缘方向像素变化剧烈.因此,边缘上的变化能通过梯度计算出来. 一阶导数的梯度算子 对于 ...

  7. 关于Windows7下创建Cocos2D-X项目的小问题

    "新版的Cocos2D-X"已经不支持用上述脚本来创建工程了,而是改为用create-project.py来创建...命令格式: python create-project.py ...

  8. HDUOJ Let the Balloon Rise 1004

     /* Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Ja ...

  9. Linux能ping通IP,ping不通域名

    今天碰到个问题, 能ping通IP地址, ping不通域名, 一直以为是 DNS解析服务器的问题, 找了半天. 问题不在这里. [root@www postfix]# cat /etc/resolv. ...

  10. Install Qt 5 on Ubuntu(使用qt-opensource-linux-x64-5.7.0.run进行安装,而且是官方的wiki)

    Introduction This is a tutorial for installation of Qt 5.7.0 to Ubuntu 12.10. It may be used also fo ...