arcgis for flex齐国地图天气预报的详细实现过程解

arcgis for flex齐国地图天气预报的详细实现过程解
作者:超越 发布时间:2019-08-23 21:34
arcgis for flex齐国地图天气预报的详细实现过程解

体系架构是B/S,开发语言是flex,开发东西是myeclise或者flashbuild,通过调用baidu提供的在线天气预报web api接口的方式来实现。

       采用地图是ArcGIS齐国地图,开发接口为arcgis api for flex,可是程序可以拓展api 接口,可以采用另外GIS api,地图数据也能够更换另外地图数据,拓展性比较好。

       先谈谈主界面的布局,只是简单的设计了或许的布局,如下:

      

arcgis for flex天下地图天气预报的具体实现过程解

      首先是两行,第一行是标题;第二行再分为两列,第一列是用来天气预报查询和显示查询的结果,第二列用来显示齐国地图。

      贴上界面布局的代码:

  <s:layout>

<s:VerticalLayout gap="0"/>

</s:layout>

<s:BorderContainer width="100%" backgroundColor="#D七D七D七">

<s:layout>

<s:VerticalLayout paddingBottom="七"

paddingLeft="10"

paddingRight="10"

paddingTop="七"/>

</s:layout>

<s:RichText width="100%">

             flex for arcgis----天气预报专题

</s:RichText>

</s:BorderContainer>

<s:HGroup width="100%" height="100%"

paddingLeft="1"

paddingTop="1">

<s:Group width="三0%" height="100%" >

<s:Rect width="100%" height="100%">

<s:stroke>

<s:SolidColorStroke color="0xCECECE"/>

</s:stroke>

</s:Rect>

<s:VGroup width="100%" height="100%" horizontalAlign="center">

<s:HGroup horizontalAlign="center" width="100%" paddingTop="10">

<s:Label  text="乡市名称:" paddingTop="4"/>

<s:TextInput id="txt_userName"  text="广州"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

   <s:Button  label="查询" id="btn_login"/>

<s:Button  label="查询扫数" click="all_clickHandler(event)"/>

</s:HGroup>

<s:Line width="100%">

<s:stroke>

<s:SolidColorStroke color="0xCECECE" weight="1"/>

</s:stroke>

</s:Line>

<s:VGroup width="100%" height="100%" horizontalAlign="center" id="hidepanel" visible="false">

  <s:HGroup horizontalAlign="center" width="100%">

  <s:Label  text="星期:" paddingTop="4"/>

  <s:Label  text="" paddingTop="4" id="date1"/>

  </s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="温度:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="temperature1"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="白天:" paddingTop="4"/>

<s:Image id="dayimg1" width="2五" height="1五"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="乌夜:" paddingTop="4"/>

<s:Image id="nightimg1" width="2五" height="1五"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="气候:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="weather1"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="风向:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="wind1"/>

</s:HGroup>

<s:Line width="100%">

<s:stroke>

<s:SolidColorStroke color="0xCECECE" weight="1"/>

</s:stroke>

</s:Line>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="星期:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="date2"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="温度:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="temperature2"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="白天:" paddingTop="4"/>

<s:Image id="dayimg2" width="2五" height="1五"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="乌夜:" paddingTop="4"/>

<s:Image id="nightimg2" width="2五" height="1五"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="气候:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="weather2"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="风向:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="wind2"/>

</s:HGroup>

<s:Line width="100%">

<s:stroke>

<s:SolidColorStroke color="0xCECECE" weight="1"/>

</s:stroke>

</s:Line>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="星期:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="date三"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="温度:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="temperature三"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="白天:" paddingTop="4"/>

<s:Image id="dayimg三" width="2五" height="1五"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="乌夜:" paddingTop="4"/>

<s:Image id="nightimg三" width="2五" height="1五"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="气候:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="weather三"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="风向:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="wind三"/>

</s:HGroup>

<s:Line width="100%">

<s:stroke>

<s:SolidColorStroke color="0xCECECE" weight="1"/>

</s:stroke>

</s:Line>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="星期:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="date4"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="温度:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="temperature4"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="白天:" paddingTop="4"/>

<s:Image id="dayimg4" width="2五" height="1五"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="乌夜:" paddingTop="4"/>

<s:Image id="nightimg4" width="2五" height="1五"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="气候:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="weather4"/>

</s:HGroup>

<s:HGroup horizontalAlign="center" width="100%">

<s:Label  text="风向:" paddingTop="4"/>

<s:Label  text="" paddingTop="4" id="wind4"/>

</s:HGroup>

</s:VGroup>

<s:Label width="100%"

paddingBottom="0"

text="地理位置: {mapCoordX.toFixed(4)},{mapCoordY.toFixed(4)}"/>

</s:VGroup>

</s:Group>

<esri:Map id="myMap" wrapAround1八0="true">

<esri:extent>

<esri:Extent xmin="七1.六1八4七七九1三三三八1" ymin="2九.七2六0六142402三0六五" xmax="1三五.五0七00五九1九八八112" ymax="五4.九4八三4八0八五八240三">

<esri:SpatialReference wkid="4三2六"/>

</esri:Extent>

</esri:extent>

<esri:infoWindowContent>

<s:TextArea id="myTextArea"

width="2五0" height="七五"/>

</esri:infoWindowContent>

<esri:ArcGISDynamicMapServiceLayer url=":六0八0/arcgis/rest/services/weather/MapServer"/>

<esri:GraphicsLayer id="myGraphicsLayer"/>

</esri:Map>

</s:HGroup>

复造代码

红色背景的url是地图宣布的服务,调用显示齐国地图。后台的核心实现:

<fx:Declarations>

<!-- 将非可视元素(比方服务、值对象)放在此处 -->

<s:HTTPService id="httpSer" method="POST">

</s:HTTPService>

<esri:PictureMarkerSymbol id="sfs"/>

<!-- <esri:PictureMarkerSymbol id="sfs1"/>-->

<!-- Layer with US States -->

<esri:QueryTask id="queryTask" url=":六0八0/arcgis/rest/services/weather/MapServer/0"/>

<esri:Query id="query"

outSpatialReference="{myMap.spatialReference}"

returnGeometry="true"

text="{str}">

<esri:outFields>

<fx:String>Name</fx:String>

<fx:String>X</fx:String>

<fx:String>Y</fx:String>

</esri:outFields>

</esri:Query>

</fx:Declarations>

复造代码

电话
020-66888888