${REST_DatasetOverlayAnalystParms_Title}

${REST_DatasetOverlayAnalystParms_Description}

상속: OverlayAnalystParameters
        private async void DatasetOverlayAnalyst_Click(object sender, RoutedEventArgs e)
        {
            DatasetOverlayAnalystParameters param = new DatasetOverlayAnalystParameters
            {
                Operation = OverlayOperationType.CLIP,
                OperateDataset = "Lake_R@Jingjin",
                SourceDataset = "Landuse_R@Jingjin",

            };
            //与服务器交互
            try
            {
                DatasetOverlayAnalystService datasetOverlayAnalystService = new DatasetOverlayAnalystService(url2);
                var result = await datasetOverlayAnalystService.ProcessAsync(param);

                foreach (Feature feature in result.Recordset.Features)
                {
                    feature.Style = new PredefinedFillStyle
                    {
                        StrokeThickness = 1,
                        Fill = new SolidColorBrush
                        {
                            Color = Colors.Magenta,
                            Opacity = 0.8
                        }
                    };
                }
                featuresLayer.AddFeatureSet(result.Recordset.Features);
            }
            //交互失败
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 /// <summary>${REST_DatasetOverlayAnalystService_method_ProcessAsync_D}</summary>
 /// <param name="Overlayparams">${REST_DatasetOverlayAnalystService_method_ProcessAsync_param_Parameters}</param>
 /// <param name="state">${REST_DatasetOverlayAnalystService_method_ProcessAsync_param_state}</param>
 public async Task<DatasetOverlayAnalystResult> ProcessAsync(DatasetOverlayAnalystParameters Overlayparams)
 {
     GenerateAbsoluteUrl(Overlayparams);
     var result = await base.SubmitRequest(this.Url, GetDictionaryParameters(Overlayparams), true, false, false);
     JsonObject jsonResult = JsonObject.Parse(result);
     return DatasetOverlayAnalystResult.FromJson(jsonResult["recordset"].GetObjectEx());
 }
        private void GenerateAbsoluteUrl(DatasetOverlayAnalystParameters Overlayparams)
        {
            if (Overlayparams == null)
            {
                throw new ArgumentNullException("请求服务参数为空!");
            }

            if (string.IsNullOrEmpty(((DatasetOverlayAnalystParameters)Overlayparams).SourceDataset) || string.IsNullOrEmpty(((DatasetOverlayAnalystParameters)Overlayparams).SourceDataset))
            {
                throw new ArgumentNullException("数据集参数为空");
            }

            if (this.Url == null)
            {
                throw new InvalidOperationException(ExceptionStrings.InvalidUrl);
            }

            //http://192.168.11.154:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst/datasets/SamplesP@Interpolation/overlay
            if (this.Url.EndsWith("/"))
            {
                this.Url += "datasets/" + ((DatasetOverlayAnalystParameters)Overlayparams).SourceDataset + "/overlay.json?returnContent=true&debug=true";
            }
            else
            {
                this.Url += "/datasets/" + ((DatasetOverlayAnalystParameters)Overlayparams).SourceDataset + "/overlay.json?returnContent=true&debug=true";
            }
        }
 private System.Collections.Generic.Dictionary<string, string> GetDictionaryParameters(DatasetOverlayAnalystParameters parameters)
 {
     return DatasetOverlayAnalystParameters.ToDictionary((DatasetOverlayAnalystParameters)parameters);
 }
        internal static System.Collections.Generic.Dictionary<string, string> ToDictionary(DatasetOverlayAnalystParameters datasetOverlayParams)
        {
            System.Collections.Generic.Dictionary<string, string> dict = new System.Collections.Generic.Dictionary<string, string>();

            if (!string.IsNullOrEmpty(datasetOverlayParams.OperateDataset) && !string.IsNullOrWhiteSpace(datasetOverlayParams.OperateDataset))
            {
                dict.Add("operateDataset", "\"" + datasetOverlayParams.OperateDataset + "\"");
            }
            else
            {
                dict.Add("operateDataset", "\"\"");
            }

            dict.Add("operation", "\"" + datasetOverlayParams.Operation.ToString() + "\"");

            string dataReturnOption = "{\"dataReturnMode\": \"RECORDSET_ONLY\",\"deleteExistResultDataset\": true,";
            dataReturnOption += string.Format("\"expectCount\":{0}", datasetOverlayParams.MaxReturnRecordCount);
            dataReturnOption += "}";
            dict.Add("dataReturnOption", dataReturnOption);

            if (datasetOverlayParams.SourceDatasetFilter != null)
            {
                dict.Add("sourceDatasetFilter", FilterParameter.ToJson(datasetOverlayParams.SourceDatasetFilter));
            }
            else
            {
                dict.Add("sourceDatasetFilter", FilterParameter.ToJson(new FilterParameter()));
            }

            if (datasetOverlayParams.OperateDatasetFilter != null)
            {
                dict.Add("operateDatasetFilter", FilterParameter.ToJson(datasetOverlayParams.OperateDatasetFilter));
            }
            else
            {
                dict.Add("operateDatasetFilter", FilterParameter.ToJson(new FilterParameter()));
            }

            if (datasetOverlayParams.OperateDatasetFields != null)
            {
                string operateFields = "[";
                System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
                foreach (var item in datasetOverlayParams.OperateDatasetFields)
                {
                    list.Add("\"" + item + "\"");
                }
                operateFields += string.Join(",", list.ToArray());
                operateFields += "]";

                dict.Add("operateDatasetFields", operateFields);
            }
            else
            {
                dict.Add("operateDatasetFields", "[]");
            }

            if (datasetOverlayParams.SourceDatasetFields != null)
            {
                string sourceFields = "[";
                System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
                foreach (var item in datasetOverlayParams.SourceDatasetFields)
                {
                    list.Add("\"" + item + "\"");
                }
                sourceFields += string.Join(",", list.ToArray());
                sourceFields += "]";

                dict.Add("sourceDatasetFields", sourceFields);
            }
            else
            {
                dict.Add("sourceDatasetFields", "[]");
            }

            if (datasetOverlayParams.OperateRegions != null)
            {
                string Regions = "[";
                System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
                foreach (var item in datasetOverlayParams.OperateRegions)
                {
                    list.Add(ServerGeometry.ToJson(item.ToServerGeometry()));
                }
                Regions += string.Join(",", list.ToArray());
                Regions += "]";

                dict.Add("operateRegions", Regions);
            }
            else
            {
                dict.Add("operateRegions", "[]");
            }

            dict.Add("tolerance", datasetOverlayParams.Tolerance.ToString());
            return dict;
        }