加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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 ort mx.rpc.AsyncResponder;
??? ???imp ort com.esri.ags.tasks.Query;
??? ???imp ort com.esri.ags.tasks.QueryTask;
??? ???imp ort? com.esri.ags.tasks.FeatureSet;
??? ???imp ort mx.controls.Alert;?? ???
??? ???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 Result,on Fault));
??? ???
??? ???function on Result( featureSet : FeatureSet,token : Object = null ) : void
???????????????? {
???????????????? ?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 Fault( info : Object,token : Object = null ) : void
??????????? {
?????????????? Alert.show( info.toString() );
??????????? }
???????????
???????????
???????????
???????????
??? ??]]>
??? ?</mx:initialize>
??? ?
???? <mx:Style>
?.infoSymbolContainerAfrica
{
?backgroundColor: #FF0000;
?
}
.infoSymbolContainerSouthAmerica?
?{
color:#000000;
backgroundColor:white;
}
?</mx:Style>
??? ?<mx:Script>
??? ??<![CDATA[
??? ???imp ort mx.containers.HBox;
??? ???imp ort mx.controls.Image;
??? ???imp ort mx.containers.Canvas;
??? ???imp ort mx.containers.VBox;
??? ???imp ort com.esri.ags.geometry.MapPoint;
??? ???imp ort com.esri.ags.Graphic;
??? ???imp ort mx.rpc.AsyncResponder;
??? ???imp ort com.esri.ags.tasks.Query;
??? ???imp ort com.esri.ags.tasks.QueryTask;
??? ???imp ort mx.controls.Alert;??
??? ???
?? ???imp ort org.gif.player.GIFPlayer;
??? ???imp ort org.gif.decoder.GIFDecoder;
??? ???imp ort org.gif.events.GIFPlayerEvent;
??? ???imp ort org.gif.events.FileTypeEvent;
??? ???imp ort org.gif.events.FrameEvent;
??? ???imp ort org.gif.events.TimeoutEvent;

??????????????? 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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读