热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

ArcServer+Flex发布GP服务生成等值面(三)---前端调用

<?xmlversion1.0encodingutf-8?><mx:Applicationxmlns:mxhttp:www.adobe.com200


                   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);           
            }      
        ]]>   
       
    
               
   
           
       
       

   

image


推荐阅读
author-avatar
宋紫紫云__
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有