${REST_DatasetBufferAnalystParams_Title}
${REST_DatasetBufferAnalystParams_Description}
private void GenerateAbsoluteUrl(DatasetBufferAnalystParameters parameters) { if (parameters == null) { throw new ArgumentNullException("请求服务参数为空!"); } if (string.IsNullOrEmpty(parameters.Dataset) || string.IsNullOrEmpty(parameters.Dataset)) { 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/buffer.json if (this.Url.EndsWith("/")) { this.Url += "datasets/" + parameters.Dataset + "/buffer.json?debug=true&returnContent=true"; } else { this.Url += "/datasets/" + parameters.Dataset + "/buffer.json?debug=true&returnContent=true"; } }
/// <summary>${REST_DatasetBufferAnalystService_method_ProcessAsync_D}</summary> /// <param name="parameters">${REST_DatasetBufferAnalystService_method_ProcessAsync_param_parameter}</param> /// <param name="state">${REST_DatasetBufferAnalystService_method_ProcessAsync_param_state}</param> public async Task<DatasetBufferAnalystResult> ProcessAsync(DatasetBufferAnalystParameters parameters) { GenerateAbsoluteUrl(parameters); var result = await base.SubmitRequest(this.Url, GetDictionaryParameters(parameters), true, false, false); JsonObject resultJson = JsonObject.Parse(result); return DatasetBufferAnalystResult.FromJson(resultJson["recordset"].GetObjectEx()); }
private System.Collections.Generic.Dictionary<string, string> GetDictionaryParameters(DatasetBufferAnalystParameters parameters) { return DatasetBufferAnalystParameters.ToDictionary(parameters); }
private async void DatasetBufferAnalyst_Click(object sender, RoutedEventArgs e) { resultLayer.ClearFeatures(); if (string.IsNullOrEmpty(MyTextBox.Text)) { await MessageBox.Show("缓冲半径不能为空"); return; } double radio = 0; if (!double.TryParse(MyTextBox.Text, out radio)) { await MessageBox.Show("缓冲半径必须为数值"); return; } DatasetBufferAnalystParameters param = new DatasetBufferAnalystParameters { BufferSetting = new BufferSetting { EndType = BufferEndType.ROUND, LeftDistance = new BufferDistance { Value = radio }, SemicircleLineSegment = 12, }, FilterQueryParameter = new SuperMap.WinRT.REST.FilterParameter { AttributeFilter = "SmID=19" }, Dataset = "Landuse_R@Jingjin", }; try { DatasetBufferAnalystService datasetBufferAnalyst = new DatasetBufferAnalystService(url2); var result = await datasetBufferAnalyst.ProcessAsync(param); if (result.Recordset.Features.Count > 0) { foreach (Feature feature in result.Recordset.Features) { feature.Style = new PredefinedFillStyle { StrokeThickness = 1, Fill = new SolidColorBrush { Color = Colors.Red, Opacity = 0.3 } }; } resultLayer.AddFeatureSet(result.Recordset.Features); } else { await MessageBox.Show("缓冲区分析失败!"); } } catch(Exception ex) { MessageBox.Show(ex.Message); } }