作者:宋紫紫云__ | 来源:互联网 | 2023-09-16 11:33
xmlns:esri=http://www.esri.com/2008/ags
layout="absolute" xmlns:layers="com.esri.ags.layers.*">
import classes.GPContainer;
import mx.managers.PopUpManager;
import mx.containers.TitleWindow;
import mx.containers.VBox;
import com.esri.ags.layers.ImageParameters;
import com.esri.ags.layers.GPResultImageLayer;
import com.esri.ags.tasks.Query;
import com.esri.ags.tasks.QueryTask;
import com.esri.ags.layers.GraphicsLayer;
import mx.messaging.channels.StreamingAMFChannel;
import mx.rpc.events.FaultEvent;
import com.esri.ags.tasks.JobInfo;
import com.esri.ags.events.GeoprocessorEvent;
import com.esri.ags.Graphic;
import com.esri.ags.events.MapMouseEvent;
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.tasks.ExecuteResult;
import com.esri.ags.tasks.FeatureSet;
import com.esri.ags.tasks.ParameterValue;
import mx.controls.Alert;
import mx.rpc.AsyncResponder;
private var jobid:String="";
private function computeServiceArea(mapPoint:MapPoint):void
{
//先查询出FeatureSet 作为GP的输入参数
var queryTask:QueryTask=new QueryTask("http://sps-010/ArcGIS/rest/services/guangyuangp/MapServer/0");
queryTask.showBusyCursor=true;
var query:Query=new Query();
query.outFields=new Array("OBJECTID","SHAPE","DYP");
query.where="STCD <>''";
queryTask.execute(query,new AsyncResponder(onQueryResult,onQueryFault));
function onQueryResult(featureSet:FeatureSet, token:Object = null):void
{
var params:Object = {
"Input_point_features":featureSet
};
gp.addEventListener(GeoprocessorEvent.JOB_COMPLETE, completeCallback);
gp.addEventListener(FaultEvent.FAULT,onFault);
gp.submitJob( params );
}
function onQueryFault(info:Object, token:Object = null):void
{
Alert.show(info.toString());
}
}
function completeCallback(event: GeoprocessorEvent) : void
{
jobid=event.jobInfo.jobId;
var imageParameters : ImageParameters = new ImageParameters();
imageParameters.format="png32";
imageParameters.outputMap",imageParameters,new AsyncResponder(onimgok, onimgno));
}
function onimgok(info:Object, token:Object = null):void
{
var obj:Object=gp.getResultImageLastResult;
var imageParameters : ImageParameters = new ImageParameters();
imageParameters.format="png32";
imageParameters.outputMap",imageParameters);
//myMap.addLayer(myImageLayer);
var gpWin:GPCOntainer=PopUpManager.createPopUp(this,GPContainer,false) as GPContainer;
gpWin.ShowResultLayer(myImageLayer);
gpWin.title="降雨等值面";
PopUpManager.centerPopUp(gpWin);
}
function onimgno(info:Object, token:Object = null):void
{
}
private function mapClickHandler(event:MapMouseEvent):void
{
computeServiceArea(event.mapPoint);
}
]]>