<? 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: ESRI = "Http://www.esri.com/2008/ags"
Xmlns: Flash = "Flash. Text .*"
Pagetitle = "Using a WMS map service with the ArcGIS API for Flex" Xmlns: ArcGIS = "Cn.com. vistech. ArcGIS .*" Xmlns: Containers = "Net. brandonmeyer. containers .*" Xmlns: supportclasses = "Com. ESRI. AGS. layers. supportclasses .*" >
< FX: Declarations >
< ESRI: simplemarkersymbol ID = "Mysymbol"
Alpha = "0.8"
Color = "0xdddd00"
Size = "10"
Style = "Circle" >
< ESRI: simplelinesymbol Width = "2"
Alpha = "1"
Color = "0xdd0000"
Style = "Solid" />
</ ESRI: simplemarkersymbol >
< ESRI: textsymbol ID = "Mytext" Text = "China (Nanjing) 78.6" Placement = "Start" Xoffset = "7" Yoffset = "0" Color = & Quot; 0x333333 & quot" Border = "False" Bordercolor = & Quot; 0x000000 & quot" Background = "False" Backgroundcolor = "0 xffffff" >
< Flash: textformat Size = "13" Font = "" Bold = "True" Italic = "False" Underline = "False" />
</ ESRI: textsymbol >
</ FX: Declarations >
< ESRI: Map ID = "Map" >
< ESRI: lods >
< ESRI: Dump Resolution = "1.71661376953125e-4" Scale = "1" />
< ESRI: Dump Resolution = "3.4332275390625e-4" Scale = "2" />
< ESRI: Dump Resolution = "6.866455078125e-4" Scale = "3" />
< ESRI: Dump Resolution = "0.001373291015625" Scale = "4" />
< ESRI: Dump Resolution = "0.00274658203125" Scale = "5" />
< ESRI: Dump Resolution = "0.0054931640625" Scale = "6" />
< ESRI: Dump Resolution = "0.010986328125" Scale = "7" />
</ ESRI: lods >
< ArcGIS: jiangsuwmslayer ID = "Jslayer" />
< ESRI: graphicslayer Symbol = "{Mysymbol }" ID = "Rain" >
</ ESRI: graphicslayer >
< ESRI: mapimagelayer >
< Supportclasses: mapimage Href = "Http: // 10.32.22.250: 8080/appservices/emf2vec/visoline-e8ae9217c5f11185fcc46d24f89ff9ac.swf" Extent = "{New extent (114.85300, 30.37240, 123.09154, 35.62217 )}" />
</ ESRI: mapimagelayer >
</ ESRI: Map >
< Containers: superpanel ID = "Yuqing" Width = "320" Right = "10" Top = "36" Height = "294" Title = "Water condition" Allowminimize = "True" Alpha = "0.8" Visible = "True" >
< S: button Label = "Loading water conditions" Click = "Button#clickhandler (event )" />
< S: button Label = "Loading contour" Click = "Button2_clickhandler (event )" />
</ Containers: superpanel >
< S: buttonbar ID = "Navbuttonbar" Requireselection = "True" Width = "320"
Change = "Changeselection (event )" Right = "10" Top = "10" Height = "21" >
< S: dataprovider >
< S: arraycollection Source = "['Rain', 'water']" />
</ S: dataprovider >
</ S: buttonbar >
< FX: script >
<! [CDATA [
Import cn.com. vistech. ArcGIS. mysymbol;
Import cn.com. vistech. utils. objectop;
Import spark. Events. indexchangeevent;
Import com. Adobe. serialization. JSON. JSON;
Import com. ESRI. AGS. Graphic;
Import com. ESRI. AGS. spatialreference;
Import com. ESRI. AGS. Geometry. extent;
Import com. ESRI. AGS. Geometry. geometry;
Import com. ESRI. AGS. Geometry. mappoint;
Import com. ESRI. AGS. Geometry. polygon;
Cn.com. vistech. ArcGIS. mysymbol;
Import MX. Collections. arraycollection;
Import MX. Collections. arraylist;
Import MX. Controls. Alert;
Import MX. Core. uicomponent;
Import MX. rpc. Events. resultevent;
Import MX. rpc. http. httpservice;
Import MX. utils. arrayutil;
Protected function button#clickhandler (Event: mouseevent): void
{
VaR HTS: httpservice = new httpservice ();
HTs. url = "http: // localhost: 8080/flexgis/getdanytimepp. Action ";
HTs. method = "Post ";
VaR Params: urlvariables = new urlvariables ();
Params. startdate = "2011-07-20 ";
Params. enddate = "2011-07-27 ";
Params. r = new date (). getmilliseconds ();
HTs. Send (Params );
HTs. addeventlistener (resultevent. Result, getdanytimeppresult );
}
Private function getdanytimeppresult (Event: resultevent): void
{
VaR JSON: Object = JSON. Decode (event. Result. tostring ());
JSON = JSON. Decode (JSON. Result );
VaR danytimepparray: object;
Danytimepparray = arrayutil. toarray (JSON );
For each (VAR row: object in danytimepparray ){
VaR mygraphicpolygon: graphic = new graphic (New mappoint (row. lgtd, row. lttd ));
VaR text: textsymbol = mysymbol. gettextsymbol ();
Text. Text = row. stnm + "" + row. rainfallval;
Mygraphicpolygon. symbol = text;
Rain. Add (mygraphicpolygon );
VaR mygraphicpolygon1: graphic = new graphic (New mappoint (row. lgtd, row. lttd ));
Rain. Add (mygraphicpolygon1 );
}
}
Protected function button2_clickhandler (Event: mouseevent): void
{
Map. logovisible = false;
Map. openhandcursorvisible = false;
Alert. Show (Map. Scale. tostring ());
}
Private function changeselection (Event: indexchangeevent): void {
/// Alert.show(buttonbar(event.tar get). selecteditem );
If (" 文"" ==buttonbar(event.tar get). selecteditem ){
Yuqing. Visible = true;
} Else {
Yuqing. Visible = false;
}
// Selectiontext. Text = "selected item:" + buttonbar(event.tar get). selecteditem;
}
]>
</ FX: script >
</ S: Application >