1.查找WebServer接口数据
/**
* 通过调用WebService来获取数据
* @param date 调用该日期的数据
*/
private function getDataByWebservice():void
{
var serviceLabel:String = configXML.webService.estuariesLaterWebService.@serviceLabel;
var functionName:String = configXML.webService.estuariesLaterWebService.@functionName;
var webServiceUrl:String = configData.webService[serviceLabel];
var obj:Object=new Object();
obj.year=ddlYear.selectedItem.toString().substr(0,4);
obj.month=ddlMonth.selectedItem.toString().substring(0,ddlMonth.selectedItem.toString().indexOf("月"));
var object:Object=new Object();
object.filterParams=obj;
var where:String=JSON.encode(object);
resultLabel.text="0";
//resultLabel.visible=false;
MapUni.callWebService(webServiceUrl, functionName, [where], onGetData);
}
/**
* 监听成功调取数据
*/
private function onGetData(event:ResultEvent):void
{
monitorValueLayer.clear();
layerxuanran.clear();
var dataStr:String = event.result.toString();
if(dataStr)
{
var dataAry:Array = JSON.decode(dataStr);
dataGrid.dataProvider =arrangeData(dataAry);
// stationDgc.dataField = configXML.dataField.estuariesDataField.@stationName;
sectionDgc.dataField = configXML.dataField.estuariesDataField.@sectionName;
}
XuanranRiver();//渲染河流
}
2.查找XML基础地图数据
/**
* 获取所有河流图层
**/
private var heliuArr:Array=new Array();
private function getAllRegionName():void
{
var layerName:String=configXML.layers.RiverLayer.@layerName;
var layerURL:String=MapUni.layerUrl(map,layerName);
MapUni.search(layerURL,null,"1=1",onSearchResult);
//onSearchResult是查询到的地市结果
function onSearchResult(featureSet:FeatureSet):void
{
//将查询到的结果放在数组里 里面是十一个地市
heliuArr=featureSet.features as Array;
}
}
3.WebServer接口数据与XML基础地图数据进行匹配渲染
/**
* 渲染匹配河流
*/
private var simplsy:SimpleLineSymbol;
private function XuanranRiver():void
{
layerxuanran.clear();//清空图层
for each(var heliuGra:Graphic in heliuArr)
{
var attribute:Object=heliuGra.attributes;
var heliuName:String=attribute.NAME;
// var oo:Object=fader.play();
for(var i:int=0;i<dataArr.length;i++)
{
var graphicnew:Graphic=heliuGra as Graphic;
var obj:Object=graphicnew.attributes;
if(heliuName==dataArr[i].RiverName)
{
var graphic:Graphic=new Graphic(graphicnew.geometry,null,obj);
layerxuanran.add(graphic);
simplsy=new SimpleLineSymbol("solid",0x0000FF,0.9,3);
graphic.symbol = simplsy;
break;
}
}
}
}