arcgis flex api实现提示可以动的天气图标
发布时间:2020-12-15 04:14:57 所属栏目:百科 来源:网络整理
导读:实现效果 ? 需要两个flex库文件 GifPlayer.swc agslib-1.3-2009-10-31.swc ? ?xml version="1.0" encoding="utf-8"? mx:Application ??? xmlns:mx=" http://www.adobe.com/2006/mxml" ??? xmlns:esri=" http://www.esri.com/2008/ags" ??? pageTitle="Exampl
实现效果
?
需要两个flex库文件
GifPlayer.swc
agslib-1.3-2009-10-31.swc
?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application ??? xmlns:mx=" http://www.adobe.com/2006/mxml" ??? xmlns:esri=" http://www.esri.com/2008/ags" ??? pageTitle="Example - ArcGIS API for Flex connecting to a dynamic AGS service">
??? ?<mx:initialize>
??? ??<![CDATA[ ??? ??imp ??? ???imp ??? ???imp ??? ???imp ??? ???imp ??? ???var queryTask:QueryTask=new QueryTask(" http://localhost/ArcGIS/rest/services/ahtl/MapServer/0");
? //换为你的点要素显示图层
?
???????var query :Query=new Query(); ??? ???query.where="name <> ''"; ??? ???query.returnGeometry=true; ??? ???query.outFields=["name","temperature","rainfall"]; ??? ? ??? ???queryTask.execute(query,new AsyncResponder(on ??? ??? ??? ???function on ???????????????? { ???????????????? ?for each(var myGraphic:Graphic in featureSet.features ) ???????????????? ?{ ???????????????? ??myGraphic.addEventListener(MouseEvent.ROLL_OVER,mouSEOverHandler); ???????????????? ??myGraphic.addEventListener(MouseEvent.ROLL_OUT,mouSEOutHandler); ???????????????? ??myGraphic.symbol=defaultSymbol; ???????????????? ??myGraphicsLayer.add(myGraphic); ???????????????? ?} ???????????????? } ???????????????? function on ??????????? { ?????????????? Alert.show( info.toString() ); ??????????? } ??????????? ??????????? ??????????? ??????????? ??? ??]]> ??? ?</mx:initialize> ??? ? ???? <mx:Style> ?.infoSymbolContainerAfrica { ?backgroundColor: #FF0000;
?
} .infoSymbolContainerSouthAmerica? ?{ color:#000000; backgroundColor:white;
}
?</mx:Style> ??? ?<mx:Script> ??? ??<![CDATA[ ??? ???imp ??? ???imp ??? ???imp ??? ???imp ??? ???imp ??? ???imp ??? ???imp ??? ???imp ??? ???imp ??? ???imp
??? ???
?? ???imp ??? ???imp ??? ???imp ??? ???imp ??? ???imp ??? ???imp ??????????????? var MyGIFPlayer:GIFPlayer = new GIFPlayer(true); ???????????????? public function init():void { ???????????????? var request:URLRequest = new URLRequest("qingtoduoyun.gif");?? //换为你的gif图片 ???????????????? MyGIFPlayer.load(request); ????????????????? MyGIFPlayer.visible = true; ????????????????? } ????????????????? ????????????????? ?????????????????? ?????????????????? public const m_content:cityInfo=new cityInfo(); ??????????????????? private function mouSEOverHandler(event:MouseEvent):void ??????????????????? {? ??????????????????? ? var graphic :Graphic=Graphic(event.target); ??????????????????? ?? var mypoint:MapPoint=MapPoint(graphic.geometry); ??????????????????? ?? m_content.names=graphic.attributes.name; ??????????????????? ?? m_content.rainfall=graphic.attributes.rainfall; ??????????????????? ?? m_content.temperature=graphic.attributes.temperature; ??????????????????? ??? myMap.infoWindow.show(mypoint); ??????????????????? ???? } ??????????????????? ???? ??????????????????? ???? ??????????????????? ???? ????????? override protected function createChildren():void ??????????? {? ??????????? init(); ?????????? ?super.createChildren(); ??????????? myMap.infoWindow.labelVisible = false; ????????? var canvas:Canvas=new Canvas; ?????????? var image:Image=new Image; ??????????? image.addChild(MyGIFPlayer); ??????????? image.x=30; ??????????? image.y=30; ??????????? m_content.x=10; ??????????? m_content.y=110;?????? ? canvas.addChild(image); ? canvas.addChild(m_content); ? canvas.explicitWidth=150; ? canvas.styleName="infoSymbolContainerSouthAmerica";? ??????? //vbox.addChild(m_content); ??????? ??????? ??????? myMap.infoWindow.content=canvas;
?????????? myMap.infoWindow.closeButtonVisible = false;
?????????? } ??? ? ??? ?? ????????? private function mouSEOutHandler(event:MouseEvent):void ????????? { ????????? myMap.infoWindow.hide(); ????????? ????????? } ????????? ??? ??]]> ??? ?</mx:Script>
??? ?
??? ? <mx:Canvas width="557" height="411" borderStyle="solid" borderThickness="3" horizontalCenter="-58" verticalCenter="16">
??? <esri:Map? id="myMap" logoVisible="false">
?????? <esri:extent>? ?? ?<esri:Extent xmax="121.038744488817" xmin="112.856179582198" ymin="28.4205762028686" ymax="34.9595969230879"? >???????????????????? //换为你的显示大小 ?? ???? ?<esri:SpatialReference wkid="4610"/> ?? ?</esri:Extent>?
?? ??
?? ? ?? </esri:extent> ??????? <esri:ArcGISDynamicMapServiceLayer ??????????? url=" http://localhost/ArcGIS/rest/services/ahtl/MapServer"/>???? //换为你的arcserver服务地址 ?? <esri:GraphicsLayer? id="myGraphicsLayer"> ?? ? ?? ? ?? </esri:GraphicsLayer> ? ? ????????? </esri:Map>?? ???? </mx:Canvas>? ?????? <esri:SimpleMarkerSymbol id="defaultSymbol" color="0x00FF00" style="circle" size="12" alpha="0.5" > ?????? ?<esri:SimpleLineSymbol/> ?????? ?? ?????? </esri:SimpleMarkerSymbol> ?????? </mx:Application>
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |