${iServer2_SpatialOperateParameters_Title}
${iServer2_SpatialOperateParameters_Description}
/// <summary>${iServer2_SpatialOperateService_method_ProcessAsync_D}</summary> /// <param name="parameters">${iServer2_SpatialOperateService_method_ProcessAsync_param_parameters}</param> /// <param name="state">${iServer2_SpatialOperateService_method_ProcessAsync_param_state}</param> public void ProcessAsync(SpatialOperateParameters parameters, object state) { if (parameters == null) { //TODO:资源 //throw new ArgumentNullException("SpatialOperateParameters is Null"); throw new ArgumentNullException(SuperMap.Web.iServerJava2.Resources.ExceptionStrings.ArgumentIsNull); } if (string.IsNullOrEmpty(base.Url)) { //TODO:资源 //throw new InvalidOperationException("Url is not set"); throw new InvalidOperationException(SuperMap.Web.iServerJava2.Resources.ExceptionStrings.InvalidUrl); } if (!base.Url.EndsWith("/")) { base.Url += '/'; } base.SubmitRequest(base.Url + "commonhandler?", GetParameters(parameters), new EventHandler<RequestEventArgs>(request_Completed), state, false); }
//合并选中地物 private void UnionEntity_Click(object sender, RoutedEventArgs e) { SpatialOperateParameters spatialOper = new SpatialOperateParameters { SpatialOperationType = SpatialOperationType.Union, MapName = "Changchun" }; //所选地物只有一个时 if (unionGeometry.Count < 2) { MessageBox.Show("请选择两个地物进行合并!"); } //选中多个地物时,只将最后两个被选择地物合并 else { spatialOper.SourceGeometry = unionGeometry[unionGeometry.Count - 2]; spatialOper.OperatorGeometry = unionGeometry[unionGeometry.Count - 1]; } //与服务器交互合并地物 SpatialOperateService spatialService = new SpatialOperateService("http://localhost:7080/demo"); spatialService.ProcessAsync(spatialOper); spatialService.Failed += (s, args) => { MessageBox.Show(args.Error.ToString()); }; spatialService.ProcessCompleted += new EventHandler<SpatialOperateEventArgs>(spatialService_ProcessCompleted); }
private Dictionary<string, string> GetParameters(SpatialOperateParameters parameters) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); string method = "spatialOperate"; dictionary.Add("method", method); dictionary.Add("mapName", parameters.MapName); Dictionary<string, string> dict = new Dictionary<string, string>(); dict.Add("mapName", parameters.MapName); dict.Add("sourceGeometry", ServerGeometry.ToJson(parameters.SourceGeometry)); dict.Add("operatorGeometry", ServerGeometry.ToJson(parameters.OperatorGeometry)); dict.Add("spatialOperationType", ((int)parameters.SpatialOperationType).ToString()); dictionary.Add("params", Bridge.CreateParams(method, dict)); return dictionary; }
/// <overloads>${iServer2_SpatialOperateService_method_ProcessAsync_overloads_D}</overloads> /// <summary>${iServer2_SpatialOperateService_method_ProcessAsync_D}</summary> /// <param name="parameters">${iServer2_SpatialOperateService_method_ProcessAsync_param_parameters}</param> public void ProcessAsync(SpatialOperateParameters parameters) { ProcessAsync(parameters, null); }
private void union_Click(object sender, RoutedEventArgs e) { SpatialOperateParameters sop = new SpatialOperateParameters { SourceGeometry = sgVegetable, OperatorGeometry = sgResidentialArea, SpatialOperationType = SpatialOperationType.Union, MapName = "Changchun" }; SpatialOperateService sos = new SpatialOperateService("http://localhost:7080/demo"); sos.ProcessAsync(sop); sos.Failed += (s, args) => { MessageBox.Show(args.Error.ToString()); }; sos.ProcessCompleted += new EventHandler<SpatialOperateEventArgs>(sos_ProcessCompleted); }