ArcGIS flex API 使用样例

<?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:layers="com.dmap.flexapi.layers.*"
      xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:dmap="http://www.chinadci.com/client" minWidth="955" minHeight="600" initialize="application1_initializeHandler(event)">
 <s:layout>
  <s:BasicLayout/>
 </s:layout>
 <fx:Style>
  @namespace s "library://ns.adobe.com/flex/spark";
  @namespace layers "com.dmap.flexapi.layers.*";
  @namespace mx "library://ns.adobe.com/flex/mx";
  @namespace dmap "http://www.chinadci.com/client";
  #pa{
   borderWeight:5px;
   borderColor:#FFFFFF;
  }
 </fx:Style>
 
 <fx:Script>
  <![CDATA[
   import com.dmap.flexapi.controls.ui.DBalloon;
   import com.dmap.flexapi.controls.ui.LabelDataRenderer;
   import com.dmap.flexapi.data.DDataSet;
   import com.dmap.flexapi.data.DFeature;
   import com.dmap.flexapi.data.DUnit;
   import com.dmap.flexapi.display.symbols.PictureFillSymbol;
   import com.dmap.flexapi.display.symbols.PictureMarkerSymbol;
   import com.dmap.flexapi.display.symbols.TextSymbol;
   import com.dmap.flexapi.events.DLayerEvent;
   import com.dmap.flexapi.events.DrawEvent;
   import com.dmap.flexapi.events.EditEvent;
   import com.dmap.flexapi.events.DFeatureEvent;
   import com.dmap.flexapi.events.MapMouseEvent;
   import com.dmap.flexapi.events.POIEvent;
   import com.dmap.flexapi.format.filter.comparison.Literal;
   import com.dmap.flexapi.format.filter.comparison.PropertyIsEqualTo;
   import com.dmap.flexapi.format.filter.comparison.PropertyName;
   import com.dmap.flexapi.format.ows.Exception;
   import com.dmap.flexapi.geom.DCircle;
   import com.dmap.flexapi.geom.DPolygon;
   import com.dmap.flexapi.geom.DPolyline;
   import com.dmap.flexapi.layers.DynamicLayer;
   import com.dmap.flexapi.layers.POISearchLayer;
   import com.dmap.flexapi.layers.WMSLayer;
   import com.dmap.flexapi.proj.ProjUtils;
   import com.dmap.flexapi.requests.POISearchQuery;
   import com.dmap.flexapi.requests.WFSQuery;
   
   import mx.collections.ArrayCollection;
   import mx.collections.ArrayList;
   import mx.controls.Alert;
   import mx.core.ComponentDescriptor;
   import mx.events.FlexEvent;
   import mx.rpc.Responder;
   import mx.rpc.events.FaultEvent;
   
   import spark.components.DataRenderer;
   import spark.components.Group;
   
   private var drawType:Number=-1;
   private var graphic:DFeature;
   private var lastEditGraphic:DFeature;
   private var lastActiveEditTypes:String;

   [Bindable]
   private var X:Number=0.0;
   [Bindable]
   private var Y:Number=0.0;
   
   
   private var lineS:Array=new Array();
   
   private var bb:DBalloon;
   protected function myEditTool_graphicsMoveStopHandler(event:EditEvent):void
   {
    var k:Number=0;
   }
   
   protected function image1_clickHandler(event:MouseEvent):void
   {
    if(cont.visible){
     cont.visible=false;
     cont.includeInLayout=false;
    }else{
     cont.visible=true;
     cont.includeInLayout=true;
    }
   }
   
   protected function application1_initializeHandler(event:FlexEvent):void
   {
    flash.system.System.useCodePage=true;
    cont.visible=false;
    cont.includeInLayout=false;
    
//    flash.system.Security.allowDomain("*");
//    flash.system.Security.loadPolicyFile("http://localhost:8080/crossdomain.xml");
//    mx.controls.Alert.show(flash.system.Capabilities.version);
//    Alert.show(flash.system.Capabilities.playerType);
   }
   protected function btn_cli(event:MouseEvent):void
   {
    var bt:Button=event.currentTarget as Button;
//    feCT="cl";
    drawType=2;
    switch(bt.label){
     case "放大":
      myMap.zoomIn();
      break;
     case "缩小":
      myMap.zoomOut();
      break;
     case "全图":
      myMap.fullExtent();
      break;
     case "居中":
      var dpoin:DPoint = new DPoint(504240.1290065232,347835.10820779146);
      myMap.centerAt(dpoin);
      myMap.level=1;
      break;
     case "测面":
      myDrawTool.activate(DDrawTool.POLYGON);
      drawType=1;
      break;
     case "画线":
      myDrawTool.activate(DDrawTool.POLYLINE);
      drawType=-1;
      break;
     case "测距":
      myDrawTool.activate(DDrawTool.LINE);
      drawType=0;
      break;
     case "画面":
      myDrawTool.activate(DDrawTool.POLYGON);
      drawType=-1;
      break;
     case "画椭圆":
      myDrawTool.activate (DDrawTool.ELLIPSE);
      break;
     case "画多点":
      myDrawTool.activate (DDrawTool.POINTS);
      break;
     case "随意画线":
      myDrawTool.activate (DDrawTool.FREEHAND_POLYLINE);
      break;
     case "随意画面":
      myDrawTool.activate (DDrawTool.FREEHAND_POLYGON);
      break;
     case "画圆":
      myDrawTool.activate(DDrawTool.CIRCLE);
      break;
     case "添加圆":
      var p1:DPoint = new DPoint(506810.73210939195,343480.5049961526);
      var dc:DCircle =  new DCircle(p1,5000,myMap);
      myGraphicsLayer.add(new DFeature(dc ,new  SimpleFillSymbol ("cross",0x004D85,0.5, new SimpleLineSymbol("solid", 0xFF0000,0.5,4))));
      myMap.centerByExtent(dc.extent);//居中显示
      break;
     case "画矩形":
      myDrawTool.activate (DDrawTool.EXTENT);
      break;
     case "添加矩形":
      var dj:DExtent = new DExtent(495553.6525195482,341744.33849224634,505298.5870898607,335975.7852695901);
      myGraphicsLayer.add(new DFeature(dj, new  SimpleFillSymbol ("cross",0x004D85,0.5, new SimpleLineSymbol("solid", 0xFF0000,0.5,4))));
      myMap.centerByExtent(dj.extent);
      break;
     case "添加折线":
      var dPoinList:Array = new Array();
      var dPoin:Array = new Array();
      var p1:DPoint = new DPoint(506810.73210939195,343480.5049961526);
      var p2:DPoint = new DPoint(519747.9728320482,338888.0645664651);
      var p3:DPoint = new DPoint(513923.4142382982,329479.1622227151);
      dPoinList.push(p1);
      dPoinList.push(p2);
      dPoinList.push(p3);
      dPoin.push(dPoinList);
      var dp:DPolyline = new DPolyline(dPoin);
      myGraphicsLayer.add(new DFeature(dp,new  SimpleLineSymbol("solid",0x004D85,0.5,4)));
      myMap.centerByExtent(dp.extent);//居中显示
      break;
     case "画多边形面":
      myDrawTool.activate(DDrawTool.POLYGON);
      break;
     case "添加多边形":
      var dPoinList:Array = new Array();
      var dPoin:Array = new Array();
      var p1:DPoint = new DPoint(493771.67126922647,342079.14941977256);
      var p2:DPoint = new DPoint(514829.69080047647,342975.23535727256);
      var p3:DPoint = new DPoint(498252.10095672647,332894.26856039756);
      var p4:DPoint = new DPoint(505532.79919891397,348799.79395102256);
      var p5:DPoint = new DPoint(511581.37927703897,333790.35449789756);
      var p6:DPoint = new DPoint(493771.67126922647,342079.14941977256);
      dPoinList.push(p1);
      dPoinList.push(p2);
      dPoinList.push(p3);
      dPoinList.push(p4);
      dPoinList.push(p5);
      dPoinList.push(p6)
      dPoin.push(dPoinList);
      var dp3:DPolygon = new DPolygon(dPoin);
      myGraphicsLayer.add(new DFeature(dp3,new  SimpleFillSymbol ("cross",0x004D85,0.5, new SimpleLineSymbol("solid", 0xFF0000,0.5,4))));
      myMap.centerByExtent(dp3.extent);//居中显示
      break;
     case "清除":
      myGraphicsLayer.clear();
      break;
     case "信息窗弹出":
      popTin();
      break;
     case "label示例":
      labelTextSymbol();
      break;
     case "点线面编辑":
      myMap.removeEventListener(MouseEvent.MOUSE_DOWN,moD);
      myMap.addEventListener(MouseEvent.MOUSE_DOWN,moD);
//      feCT="edi";
      break;
     case "打点":
      myDrawTool.activate(DDrawTool.POINT);
      break;
     case "获取坐标":
      myMap.removeEventListener(MapMouseEvent.MAP_CLICK,mapCl);
      myMap.addEventListener(MapMouseEvent.MAP_CLICK,mapCl);
      break;
     case "WMS出图":
      var wmslayer:WMSLayer=new WMSLayer("http://172.26.15.21:8099/GIMS/GovEMap/wms");
      //wmslayer.visibleLayers=new ArrayList();
      wmslayer.imageFormat="gif";
      var aray:ArrayList=new ArrayList();
      aray.addItem("L9999987");
      aray.addItem("L9999988");
      wmslayer.visibleLayers=aray;
      wmslayer.mapservice="IMAGESTAT";
      myMap.addLayer(wmslayer);
      break;
     case "地址匹配":
      var sp:POISearchLayer=new POISearchLayer();
      sp.url="http://localhost:8080/myflex/AddrCode/cmd";
      sp.addEventListener(DLayerEvent.LOAD,addrCal);
      sp.addEventListener(POIEvent.POIFEACHER_CLICK,function(e:POIEvent):void{
       var con:Tile=new Tile();
       var vb:VBox=new VBox();
       var lb:Label=new Label();
       var lb2:Label=new Label();
       lb.text="地址标准名称:"+(e.feacher as DFeature).attributes["地址标准名称"];
       lb2.text="地址标准名称2:"+(e.feacher as DFeature).attributes["地址标准名称"];
       vb.addChild(lb);
       vb.addChild(lb2);
       con.addChild(vb);
       myMap.infoWindow.label=(e.feacher as DFeature).attributes["地址标准名称"];
       myMap.infoWindowContent=con;
       myMap.infoWindow.show((e.feacher as DFeature).geometry as DPoint);
      });
      myMap.addLayer(sp);
      break;
     case "添加小车":
      var lineStr:String="478173.552240 345617.852530;483998.110830 345393.831040;481981.917480 342929.594710;480861.810050 340465.358390;483550.067870 340017.315420;486014.304190 341361.444320;487134.411620 344945.788070;488030.497550 349202.196280;483550.067870 349426.217760;475933.337400 348978.174790;474589.208490 345393.831040;476605.401850 343601.659170;477949.530760 341585.465810;478845.616690 340017.315420;478173.552240 338225.143540;482878.003410 337553.079090";      
      var ar:Array=lineStr.split(";");
      for(var i:Number=0;i<ar.length;i++){
       var dp2:Array=(ar[i].toString()).split(" ");
       lineS.push(new DPoint(dp2[0],dp2[1]));
      }
      var pl:DPolyline=new DPolyline();
      var nA:Array=new Array();
      nA.push(lineS);
      pl.paths=nA;
      myGraphicsLayer.addChild(new DFeature(pl,new PictureMarkerSymbol("assets/car3.png",20,32,0,16)));
      carlayer.lineStr=nA;
      break;
     case "soket连接":
      var dyl:DynamicLayer=new DynamicLayer();
      dyl.host="172.26.15.21";
      dyl.port=3333;
      dyl.layName="L1914_1";
      dyl.id="L1914_1";
      //dyl.star();
      myMap.addLayer(dyl);
      break;
     case "添加线":
//      var lineStr:String="478173.552240 345617.852530;483998.110830 345393.831040;481981.917480 342929.594710;480861.810050 340465.358390;483550.067870 340017.315420;486014.304190 341361.444320;487134.411620 344945.788070;488030.497550 349202.196280;483550.067870 349426.217760;475933.337400 348978.174790;474589.208490 345393.831040;476605.401850 343601.659170;477949.530760 341585.465810;478845.616690 340017.315420;478173.552240 338225.143540;482878.003410 337553.079090";
      var lineStr:String="504268.1264773975 304063.28736697685;504268.09387751366 304120.91337707016;504260.8035015107 304310.66436544503;504252.4957450571 304485.5364369393;504237.95008024824 304501.405952527;504241.334272525 304565.8069286479;504245.5623687561 304649.97224479646;504245.5449947404 304680.83938375104;504245.5347452742 304699.0487757667;504249.73281476024 304836.2878375009;504251.42716980685 304864.2690935376;504251.40426330105 304904.9071392946;504249.66837660107 304950.6517383103;504249.6497330653 304983.73955030774;504246.7013728658 305056.9086172007";
      var ar:Array=lineStr.split(";");
      for(var i:Number=0;i<ar.length;i++){
       var dp1:Array=(ar[i].toString()).split(" ");
       lineS.push(new DPoint(dp1[0],dp1[1]));
      }
      var pl:DPolyline=new DPolyline();
      var nA:Array=new Array();
      nA.push(lineS);
      pl.paths=nA;
      myGraphicsLayer.addChild(new DFeature(pl,new SimpleLineSymbol("solid",0xFF0000,0.5,6)));
      myMap.centerByExtent(pl.extent);
      break;
     case "添加标记":
      var p1:DPoint = new DPoint(497775.10888125,338160.331535);
      myGraphicsLayer.add(new DFeature(p1,new  SimpleMarkerSymbol("circle",14,0x004D85)));
      break;
     case "绘制标记":
      var p2:DPoint = new DPoint(497775.10888125,338160.331535);
      myGraphicsLayer.add(new DFeature(p2,new  PictureMarkerSymbol ("assets/thumbsup.jpg")));
      break;
    }
   }
   /**
    * 信息弹出窗
    * */
   private function popTin():void
   {
    var p1:DPoint = new DPoint(497775.10888125,338160.331535);
    myGraphicsLayer.add(new DFeature(p1,new SimpleMarkerSymbol("circle",14,0x004D85)));
    var b:Group = new Group();
    b.height=50;
    b.width=60;
    var l:Label = new Label();
    l.text="文本内容";
    b.addElement(l);
    myMap.infoWindow.label="标题";
    myMap.infoWindow.content=b;
    myMap.infoWindow.show(p1);
   }
   /**
    * 简单label示例
    * */
   private function labelTextSymbol():void
   {
    var textSymb:TextSymbol= new TextSymbol("这是一个测试");
    textSymb.border=true;
    textSymb.background=true;
    textSymb.backgroundColor=0xE8EFF8;
    textSymb.yoffset=18;
    var p1:DPoint = new DPoint(497775.10888125,338160.331535);
    myGraphicsLayer.add(new DFeature(p1,new SimpleMarkerSymbol("circle",14,0x004D85)));
    myGraphicsLayer.add(new DFeature(p1,textSymb));
   }
   
   private function addrCal(ev:DLayerEvent):void{
    flash.system.System.useCodePage=true;
    var sp:POISearchLayer=ev.layer as POISearchLayer;
    var spsq:POISearchQuery=new POISearchQuery();
    spsq.commandType=0;
    spsq.keyword=getUrlEncode("大兴区","大兴区");
    spsq.num=10;
    spsq.startpage=1;
    sp.isLod=true;
    sp.searchType="addr";
    sp.spaceQuery=spsq;
   }
   
   private function getUrlEncode(key:String,val:String):String{
    var vk:URLVariables=new URLVariables();
    vk[key]=val;
    return vk.toString();
   }
   
   private function mapCl(event:MapMouseEvent):void{
    this.X=event.mapPoint.x;
    this.Y=event.mapPoint.y;
   }
   private function moD(event:MouseEvent):void{
    event.currentTarget.addEventListener(MouseEvent.MOUSE_MOVE, map_mouseMoveHandler);
    event.currentTarget.addEventListener(MouseEvent.MOUSE_UP, map_mouseUpHandler);
    //myEditTool.deactivate();
   }
   private function map_mouseMoveHandler(event:MouseEvent):void
   {
    event.currentTarget.removeEventListener(MouseEvent.MOUSE_MOVE, map_mouseMoveHandler);
    event.currentTarget.removeEventListener(MouseEvent.MOUSE_UP, map_mouseUpHandler);
   }
   
   private function map_mouseUpHandler(event:MouseEvent):void
   {
    event.currentTarget.removeEventListener(MouseEvent.MOUSE_MOVE, map_mouseMoveHandler);
    event.currentTarget.removeEventListener(MouseEvent.MOUSE_UP, map_mouseUpHandler);       
                if (event.target is DFeature)
                {
                 graphic = DFeature(event.target);
     //if(feCT=="edi"){
                     if (lastEditGraphic !== graphic)
                     {
                         lastEditGraphic = graphic;
                         lastActiveEditTypes = "moveRotateScale"; // make sure move and edit vertices is the 1st mode
                     }
                     if (graphic.geometry is DPolyline || graphic.geometry is DPolygon)
                     {
                         if (lastActiveEditTypes == "moveEditVertices")
                         {
                             lastActiveEditTypes = "moveRotateScale";
                             myEditTool.activate(DEditTool.MOVE | DEditTool.SCALE | DEditTool.ROTATE, [ graphic ]);
                         }
                         else
                         {
                             lastActiveEditTypes = "moveEditVertices";
                             myEditTool.activate(DEditTool.MOVE | DEditTool.EDIT_VERTICES, [ graphic ]);
                         }
                     }
                     else if (graphic.geometry is DExtent)
                     {
                         myEditTool.activate(DEditTool.MOVE | DEditTool.SCALE, [ graphic ]);
                     }
                     else if (graphic.graphicsLayer == myGraphicsLayer)
                     {
                         myEditTool.activate(DEditTool.MOVE | DEditTool.EDIT_VERTICES, [ graphic ]);
                     }
        // }else{
    //  Alert.show(graphic.attributes["地址标准名称"],"提示");
    // }
                }
                else
                {
                    myEditTool.deactivate();
    // feCT="cl";
                    lastActiveEditTypes = "moveRotateScale"; // make sure move and edit vertices is the 1st mode
     myMap.removeEventListener(MouseEvent.MOUSE_DOWN,moD);
                }
   }
   protected function myDrawTool_drawEndHandler(event:DrawEvent):void
   {
    myDrawTool.deactivate();
    if(drawType==0||drawType==1){
     if(event.graphic.geometry){
      switch(drawType){
       case 1:
        Alert.show((event.graphic.geometry as DPolygon).measureArea,"测面结果");
        break;
       case 0:
        Alert.show((event.graphic.geometry as DPolyline).measureLength,"测距结果");
        break;
      }
     }
    }
   }
   //wfs....
//   protected function featurelayer1_featureAddHandler(event:FeatureEvent):void
//   {
//    //event.graphic.visible = false
//    event.graphic.geometry = ProjUtils.geographicToWebMercator(event.graphic.geometry);
//    event.graphic.toolTip = event.graphic.attributes.LANAME;
//    //if(event.graphic.id == "poly_landmarks.77")// && event.graphic.toolTip != "Battery Park" && event.graphic.toolTip != "Governors Island")Upper New York Bay
//    // event.graphic.visible = true;
//   }
//   protected function wfsLayer_faultHandler(event:FaultEvent):void
//   {
//    Alert.show(event.fault.faultString + "\n\n" + event.fault.faultDetail, "WFSLayer Fault " + event.fault.faultCode);
//   }
//   
//   protected function wfsLayer_loadErrorHandler(event:LayerEvent):void
//   {
//    Alert.show(event.fault.faultString + "\n\n" + event.fault.faultDetail, "WFSLayer Load Error " + event.fault.faultCode);
//   }
//   private function doSearch():void
//   {
//    // wfsLayer.layerDetails.displayField
//    //wfsLayer.definitionExpression = "STATE_NAME like '" + qText.text + "'";
//    var filter:PropertyIsEqualTo = new PropertyIsEqualTo(new PropertyName("OBJECTID"),new Literal(new String("1")));
//    var query:WFSQuery = new WFSQuery();
//    query.filter = filter;
//    wfsLayer.queryFeatures(query,new mx.rpc.Responder(wfsLayer_updateEndHandler,wfsLayer_faultHandler));
//   }
//   protected function wfsLayer_updateEndHandler(featureSet:DDataSet):void
//   {
//    
//    if (featureSet.features.length < 1)
//    {
//     Alert.show("Sorry, found no such features, please try something else");
//    }
//    
//    this.cursorManager.removeBusyCursor();
//   }
  ]]>
 </fx:Script>
<fx:Declarations>
  <!-- 将非可视元素(例如服务、值对象)放在此处 -->
  <s:Fade id="showVB" alphaFrom="0" alphaTo="1" duration="500"/>
  <s:Fade id="hideVB" alphaFrom="1" alphaTo="0" duration="500"/>
  <!-- Symbol for all point shapes -->
  <dmap:SimpleMarkerSymbol id="sms"
         color="0x00FF00"
         size="12"
         style="square"/>
  
  <!-- Symbol for all line shapes -->
  <dmap:SimpleLineSymbol id="sls"
          width="3"
          color="0x00FF00"/>
  
  <!-- Symbol for all polygon shapes -->
  <dmap:SimpleFillSymbol id="sfs"
          color="0xFFFFFF"
          style="diagonalcross">
   <dmap:outline>
    <dmap:SimpleLineSymbol width="2" color="0x00FF00"/>
   </dmap:outline>
  </dmap:SimpleFillSymbol>
  
  <dmap:DDrawTool id="myDrawTool"
      drawEnd="myDrawTool_drawEndHandler(event)"
      fillSymbol="{sfs}"
      graphicsLayer="{myGraphicsLayer}"
      lineSymbol="{sls}"
      map="{myMap}"
      markerSymbol="{sms}"/>
  
  <dmap:DEditTool id="myEditTool" allowDeleteVertices="true" map="{myMap}"/>
 </fx:Declarations>
 <mx:Canvas id="pa" width="340" horizontalScrollPolicy="off" right="0" depth="9" backgroundColor="#74A1CC" alpha="0.5" cornerRadius="5" borderStyle="solid">
  <mx:HBox width="100%" height="40" horizontalAlign="right" verticalAlign="middle" paddingRight="10">
   <s:Label>服务示例</s:Label><mx:Image source="assets/pick-button.gif" width="15" height="20" buttonMode="true" click="image1_clickHandler(event)"></mx:Image>
  </mx:HBox>
  <mx:VBox id="cont" top="40" left="0" hideEffect="hideVB" horizontalAlign="left"
     showEffect="showVB" verticalAlign="middle" verticalGap="10" horizontalGap="0" paddingBottom="20">
   <mx:VBox horizontalGap="2">
    <s:Label paddingLeft="5" text="地图基本操作"></s:Label>
    <mx:Tile paddingLeft="10">
     <s:Button click="btn_cli(event)" width="48">放大</s:Button>
     <s:Button click="btn_cli(event)" width="48">缩小</s:Button>
     <s:Button click="btn_cli(event)" width="48">全图</s:Button>
     <s:Button click="btn_cli(event)" width="48">居中</s:Button>
     <s:Button click="btn_cli(event)" width="48">测距</s:Button>
     <s:Button click="btn_cli(event)" width="48">测面</s:Button>
     <s:Button click="btn_cli(event)">获取坐标</s:Button>
     <s:Button click="btn_cli(event)" width="48">清除</s:Button>
    </mx:Tile>
   </mx:VBox>
   <mx:HBox horizontalGap="2">
    <s:Label left="5" paddingLeft="5" text="坐标信息"></s:Label>
    <mx:HBox paddingLeft="2">
     <s:Label text="X:"/><s:TextInput text="{this.X}" left="0" width="120"/>
    </mx:HBox>
    <mx:HBox paddingLeft="2">
     <s:Label text="Y:" left="0"/><s:TextInput text="{this.Y}" left="0" width="120"/>
    </mx:HBox>
   </mx:HBox>
   <mx:VBox horizontalGap="2">
    <s:Label paddingLeft="5" text="图形操作"></s:Label>
    <mx:Tile paddingLeft="10" horizontalGap="0">
     <s:Button click="btn_cli(event)" width="48">打点</s:Button>
     <s:Button click="btn_cli(event)" width="48">画线</s:Button>
     <s:Button click="btn_cli(event)" width="48">画圆</s:Button>
     <s:Button click="btn_cli(event)" width="48">画面</s:Button>
     <s:Button click="btn_cli(event)" width="60">画椭圆</s:Button>
     <s:Button click="btn_cli(event)" width="60">画多点</s:Button>
     <s:Button click="btn_cli(event)" width="60">画矩形</s:Button>
     <s:Button click="btn_cli(event)" width="60">添加圆</s:Button>
     <s:Button click="btn_cli(event)" >添加折线</s:Button>
     <s:Button click="btn_cli(event)">添加矩形</s:Button>
     <s:Button click="btn_cli(event)" >添加多边形</s:Button>
     <s:Button click="btn_cli(event)" >画多边形面</s:Button>
     <!--<s:Button click="btn_cli(event)" >点线面编辑</s:Button>-->
     <s:Button click="btn_cli(event)">随意画线</s:Button>
     <s:Button click="btn_cli(event)">随意画面</s:Button>
    </mx:Tile>
   </mx:VBox>
   <mx:VBox horizontalGap="2">
    <s:Label paddingLeft="5" text="图层操作"></s:Label>
    <mx:Tile paddingLeft="10" horizontalGap="0">
     <s:Button click="btn_cli(event)">WMS出图</s:Button>
     <s:Button click="btn_cli(event)">地址匹配</s:Button>
     <s:Button click="btn_cli(event)">添加标记</s:Button>
     <!--<s:Button click="btn_cli(event)">点线面编辑</s:Button>-->
     <s:Button click="btn_cli(event)">添加小车</s:Button>
     <s:Button click="btn_cli(event)" width="60">添加线</s:Button>
     <s:Button click="btn_cli(event)">soket连接</s:Button>
     <!--<s:Button click="btn_cli(event)">叠加图层</s:Button>-->
     <s:Button click="btn_cli(event)">label示例</s:Button>
     <s:Button click="btn_cli(event)">绘制标记</s:Button>
     <s:Button click="btn_cli(event)">信息窗弹出</s:Button>
    </mx:Tile>
   </mx:VBox>
  </mx:VBox>
       </mx:Canvas>
 <dmap:DMap id="myMap" zoomBoxFillColor="green"
      level="1"
      >  
  <!--<dmap:CenTilesLayer  url="http://10.192.22.215:8812/abc" tileType="png" id="centerLayer">-->
  <dmap:CenTilesLayer  url="http://172.26.15.21:8812/abc" tileType="png" id="centerLayer">
   <!--<dmap:CenTilesLayer  url="http://127.0.0.1:8812/abssc" tileType="png">-->
   
   <dmap:tileInfo>
    <layers:TilesLayerProperty height="256" width="256">
     <layers:origin>
      <dmap:DPoint x="0" y="688194" />
     </layers:origin>
     <layers:levels>
      <!--
      <dmap:DLevel level="1" scale="1641656.5625" resolution="224.021484375" />
      <dmap:DLevel level="2" scale="3283313.125" resolution="112.0107421875" />
      <dmap:DLevel level="3" scale="6566626.25" resolution="56.00537109375" />
      <dmap:DLevel level="4" scale="26266505" resolution="448.04296875" />
      -->
      
      <dmap:DLevel level="0" scale="3386781.496062992" resolution="896.0859375" />
      <dmap:DLevel level="1" scale="1693390.748031496" resolution="448.04296875" />
      <dmap:DLevel level="2" scale="846695.374015748" resolution="224.021484375" />
      <dmap:DLevel level="3" scale="423347.687007874" resolution="112.0107421875" />
      <dmap:DLevel level="4" scale="211673.843503937" resolution="56.00537109375" />
      <dmap:DLevel level="5" scale="105836.9217519685" resolution="28.002685546875" />
      <dmap:DLevel level="6" scale="52918.46087598425" resolution="14.0013427734375" />
      <dmap:DLevel level="7" scale="26459.23043799213" resolution="7.00067138671875" />
      <dmap:DLevel level="8" scale="13229.61521899604" resolution="3.50033569335937" />
      <dmap:DLevel level="9" scale="6614.807609498003" resolution="1.75016784667968" />
      <dmap:DLevel level="10" scale="3307.403804749013" resolution="0.875083923339843" />
      <dmap:DLevel level="11" scale="1653.701902374507" resolution="0.4375419616699215" />
      <dmap:DLevel level="12" scale="826.8509511872533" resolution="0.2187709808349608" />
     </layers:levels>
    </layers:TilesLayerProperty>    
   </dmap:tileInfo>
   <dmap:initialExtent>
    <dmap:DExtent xmin="371987.18334" ymin="252920.58593" xmax="624459.12036" ymax="423400.07714">
     <dmap:DCoordinateSystem wkid="102100" />
    </dmap:DExtent>
   </dmap:initialExtent>
   <dmap:fullExtent>
    <dmap:DExtent xmin="371987.18334" ymin="252920.58593" xmax="624459.12036" ymax="453400.07714">
     <dmap:DCoordinateSystem wkid="102100" />
    </dmap:DExtent>
   </dmap:fullExtent>
  </dmap:CenTilesLayer> 
  <dmap:DFeaturesLayer id="myGraphicsLayer">
  </dmap:DFeaturesLayer>
  <layers:CarLayer id="carlayer"></layers:CarLayer>
  <!--<dmap:POISearchLayer id="sp" url="http://localhost:8080/BJRMS_FB/AddrCode/cmd?" isLod="false" load="{sp_loadHandler()}">
   <dmap:infoWindowRenderer>
    <fx:Component id="cp">
     <dmap:LabelDataRenderer>
      <s:BorderContainer backgroundColor="white" borderColor="black">
       <s:Label>
        {data.地址标准名称}
       </s:Label> 
      </s:BorderContainer>
     </dmap:LabelDataRenderer>
    </fx:Component>
   </dmap:infoWindowRenderer>
  </dmap:POISearchLayer>-->
  <!--<dmap:WFSLayer id="wfsLayer"
        featureAdd="featurelayer1_featureAddHandler(event)"
        fault="wfsLayer_faultHandler(event)"
        load="{doSearch()}"
        loadError="wfsLayer_loadErrorHandler(event)"
        featureType="L3051"
        epsg="EPSG:4326"
        isC="true"
        url="http://192.168.101.166/service/GovEMap/wfs"/>-->
  
 </dmap:DMap>
 <s:BorderContainer id="open" bottom="0" right="0" width="300"  height="200">
  <dmap:DEagleeye id="dea" mainMap="{myMap}" width="300" height="200" depth="999"></dmap:DEagleeye>
 </s:BorderContainer>
</s:Application>

以上是一些API中针对map方法属性的运用,这对初学者是很有用处的。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值