${IS6_QueryByGeometryParameters_Title}
${IS6_QueryByGeometryParameters_Description}
/// <summary>${IS6_QueryByGeometryService_method_ProcessAsync_D}</summary> /// <param name="parameters">${IS6_QueryByGeometryService_method_ProcessAsync_param_parameters}</param> /// <param name="state">${IS6_QueryByGeometryService_method_ProcessAsync_param_state}</param> public void ProcessAsync(QueryByGeometryParameters parameters, object state) { if (parameters == null) { //TODO:资源 //throw new ArgumentNullException("QueryByGeometryParameters is Null"); throw new ArgumentNullException(ExceptionStrings.ArgumentIsNull); } if (string.IsNullOrEmpty(this.Url)) { //TODO:资源 //throw new InvalidOperationException("Url is not set"); throw new InvalidOperationException(ExceptionStrings.InvalidUrl); } base.SubmitRequest(base.Url + "/query.ashx?", GetParameters(parameters), new EventHandler<RequestEventArgs>(request_Completed), state, false); }
//服务器返回查询结果 private void DrawCompleted(object sender, DrawEventArgs e) { QueryLayer querylayer = new QueryLayer(); querylayer.LayerName = comboBox.SelectionBoxItem.ToString(); List<QueryLayer> queryLayers = new List<QueryLayer>() { querylayer }; QueryParam queryParam = new QueryParam() { ExpectCount = 0, QueryLayers = queryLayers, StartRecord = 0 }; QueryByGeometryParameters parameters = new QueryByGeometryParameters { Geometry = e.Geometry, MapName = "changchun", QueryParam = queryParam }; QueryByGeometryService queryByGeometryService = new QueryByGeometryService("http://localhost/IS/AjaxDemo"); queryByGeometryService.ProcessAsync(parameters); queryByGeometryService.Failed += new EventHandler<ServiceFailedEventArgs>(queryByGeometryService_Failed); queryByGeometryService.ProcessCompleted += new EventHandler<QueryServiceEventArgs>(queryByGeometryService_ProcessCompleted); featuresLayer.MouseLeftButtonDown +=new EventHandler<FeatureMouseButtonEventArgs>(featuresLayer_MouseLeftButtonDown); }
private Dictionary<string, string> GetParameters(QueryByGeometryParameters parameters) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); Point2DCollection gps = new Point2DCollection(); if (parameters.Geometry is GeoLine) { string method = "QueryByLine"; dictionary.Add("map", parameters.MapName); dictionary.Add("method", method); foreach (Point2DCollection g in (parameters.Geometry as GeoLine).Parts) { for (int i = 0; i < g.Count; i++) { gps.Add(g[i]); } } } else if (parameters.Geometry is GeoRegion) { string method = "QueryByPolygen"; dictionary.Add("map", parameters.MapName); dictionary.Add("method", method); foreach (Point2DCollection g in (parameters.Geometry as GeoRegion).Parts) { for (int i = 0; i < g.Count; i++) { gps.Add(g[i]); } } } else if (parameters.Geometry is GeoCircle) { string method = "QueryByPolygen"; dictionary.Add("map", parameters.MapName); dictionary.Add("method", method); foreach (Point2DCollection g in (parameters.Geometry as GeoCircle).Parts) { for (int i = 0; i < g.Count; i++) { gps.Add(g[i]); } } } else if (parameters.Geometry is GeoPoint) { string method = "QueryByPoint"; dictionary.Add("map", parameters.MapName); dictionary.Add("method", method); dictionary.Add("point", JsonHelper.FromPoint2D(((GeoPoint)parameters.Geometry).Bounds.Center)); dictionary.Add("tolerance", "0"); dictionary.Add("queryParam", QueryParam.ToJson(parameters.QueryParam)); dictionary.Add("trackingLayerIndex", "-1"); dictionary.Add("userID", string.Format("\"{0}\"", Guid.NewGuid())); return dictionary; } dictionary.Add("points", JsonHelper.FromPoint2DCollection(gps)); dictionary.Add("queryParam", QueryParam.ToJson(parameters.QueryParam)); dictionary.Add("trackingLayerIndex", "-1"); dictionary.Add("userID", string.Format("\"{0}\"", Guid.NewGuid())); return dictionary; }
/// <summary>${IS6_QueryByGeometryService_method_ProcessAsync_D}</summary> /// <overloads>${IS6_QueryByGeometryService_method_ProcessAsync_overloads_D}</overloads> /// <param name="paramters">${IS6_QueryByGeometryService_method_ProcessAsync_param_parameters}</param> public void ProcessAsync(QueryByGeometryParameters paramters) { ProcessAsync(paramters, null); }