DrawTool工具类使用方法

<?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" minWidth="955" minHeight="600"
      xmlns:esri="http://www.esri.com/2008/ags" xmlns:symbols="com.esri.ags.symbols.*">
 <fx:Script>
  <![CDATA[
   import spark.events.IndexChangeEvent;

   protected function btn1_changeHandler(event:IndexChangeEvent):void
   {
    switch (btn1.selectedItem)
    {
    case "点":
     drawtool1.activate(com.esri.ags.tools.DrawTool.MAPPOINT);
     break;
    case "多点":
     drawtool1.activate(com.esri.ags.tools.DrawTool.MULTIPOINT);
     break;
    case "线":
     drawtool1.activate(com.esri.ags.tools.DrawTool.LINE);
     break;
    case "线段":
     drawtool1.activate(com.esri.ags.tools.DrawTool.POLYLINE);
     break;
    
    case "多边形":
     drawtool1.activate(com.esri.ags.tools.DrawTool.POLYGON);
     break;
    case "自由多边形":
     drawtool1.activate(com.esri.ags.tools.DrawTool.FREEHAND_POLYGON);
     break;
    case "自由线段":
     drawtool1.activate(com.esri.ags.tools.DrawTool.FREEHAND_POLYLINE);
     break;
    }
   }

  ]]>
 </fx:Script>
 <fx:Declarations>
  <!-- Place non-visual elements (e.g., services, value objects) here -->
  <esri:PictureMarkerSymbol source="user4.png" id="pic1" />
  <esri:SimpleLineSymbol color="0x000000"  width="5" id="linesymbol1" />
  <esri:SimpleFillSymbol id="fillsymbol1" color="0xFF0000" alpha="0.6" style="cross" outline="{linesymbol1}" />
  <esri:DrawTool map="{map1}" markerSymbol="{pic1}" fillSymbol="{fillsymbol1}" lineSymbol="{linesymbol1}" id="drawtool1"  graphicsLayer="{myGraphic}"/>
 </fx:Declarations>
 <esri:Map id="map1">
  <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
 <esri:GraphicsLayer id="myGraphic" />
 <esri:GraphicsLayer id="graphic2" />
 </esri:Map>
 <s:ButtonBar x="88" y="10" id="btn1" change="btn1_changeHandler(event)">
  <s:ArrayCollection>
   <fx:String>点</fx:String>
   <fx:String>多点</fx:String>
   <fx:String>线</fx:String>
   <fx:String>线段</fx:String>
  
   <fx:String>多边形</fx:String>
   <fx:String>自由多边形</fx:String>
   <fx:String>自由线段</fx:String>
  </s:ArrayCollection>
 </s:ButtonBar>
</s:Application>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值