${IS6_QueryByCenterParameters_Title}

${IS6_QueryByCenterParameters_Description}

Inheritance: QueryParametersBase
 /// <summary>${IS6_QueryByCenterService_method_ProcessAsync_D}</summary>
 /// <param name="parameters">${IS6_QueryByCenterService_method_ProcessAsync_param_parameters}</param>
 /// <param name="state">${IS6_QueryByCenterService_method_ProcessAsync_param_state}</param>
 public void ProcessAsync(QueryByCenterParameters parameters, object state)
 {
     if (parameters == null)
     {
         //TODO:资源
         // throw new ArgumentNullException("QueryByCenterParamters 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 point_DrawCompleted(object sender, DrawEventArgs e)
        {
            QueryParam queryParam = new QueryParam();
            QueryLayer queryLayer = new QueryLayer();
            queryLayer.LayerName = comboBox.SelectionBoxItem.ToString();
            List<QueryLayer> queryLayers = new List<QueryLayer> { queryLayer };
            queryParam = new QueryParam()
            {
                ExpectCount = 0,
                QueryLayers = queryLayers,
                StartRecord = 0
            };

            //将文本中读取的容限值转换为Double类型,如果值为0则将其设为100
            double tolerance;
            if (!double.TryParse(MyTextBox.Text, out tolerance))
            {
                tolerance = 100;
            }

            QueryByCenterParameters parameters = new QueryByCenterParameters
            {
                MapName = "changchun",
                CenterPoint = e.Geometry.Bounds.Center,
                Tolerance = tolerance,
                QueryParam = queryParam
            };

            if (FindNearest.IsChecked == true)
            {
                parameters.IsNearest = true;
            }

            //与服务器交互
            QueryByCenterService query = new QueryByCenterService("http://localhost/IS/AjaxDemo");
            query.ProcessAsync(parameters);
            query.Failed += new EventHandler<ServiceFailedEventArgs>(query_Failed);
            query.ProcessCompleted += new EventHandler<QueryServiceEventArgs>(query_ProcessCompleted);

            featuresLayer.MouseLeftButtonDown+=new EventHandler<FeatureMouseButtonEventArgs>(featuresLayer_MouseLeftButtonDown);
        }
 private void point_DrawCompleted(object sender, DrawEventArgs e)
 {
     Pushpin pushPin = new Pushpin();
     pushPin.Location = e.Geometry.Bounds.Center;
     elementsLayer.AddChild(pushPin);
     QueryByCenterParameters queryParameters = new QueryByCenterParameters()
     {
         MapName = "changchun",
         Tolerance = 100,
         IsNearest = true,
         QueryParam = new QueryParam()
         {
             QueryAllLayer = false,
             QueryLayers = new List<QueryLayer>() { new QueryLayer() { LayerName = "RoadNet@changchun" } },
             HasGeometry = true,
             ReturnShape = true,
             ExpectCount = 1,
         }
     };
     queryParameters.CenterPoint = e.Geometry.Bounds.Center;
     QueryByCenterService queryService = new QueryByCenterService("http://localhost/IS/AjaxDemo");
     queryService.ProcessAsync(queryParameters);
     queryService.ProcessCompleted += new EventHandler<QueryServiceEventArgs>(queryService_ProcessCompleted);
 }
        private Dictionary<string, string> GetParameters(QueryByCenterParameters parameters)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            string method = parameters.IsNearest ? "FindNearest" : "QueryByPoint";

            dictionary.Add("map", parameters.MapName);
            dictionary.Add("method", method);

            dictionary.Add("point", JsonHelper.FromPoint2D(parameters.CenterPoint));
            dictionary.Add("tolerance", parameters.Tolerance.ToString());
            dictionary.Add("queryParam", QueryParam.ToJson(parameters.QueryParam));
            dictionary.Add("trackingLayerIndex", "-1");
            dictionary.Add("userID", string.Format("\"{0}\"", Guid.NewGuid()));

            return dictionary;
        }
 /// <summary>${IS6_QueryByCenterService_method_ProcessAsync_D}</summary>
 /// <overloads>${IS6_QueryByCenterService_method_ProcessAsync_overloads_D}</overloads>
 /// <param name="paramters">${IS6_QueryByCenterService_method_ProcessAsync_param_parameters}</param>
 public void ProcessAsync(QueryByCenterParameters paramters)
 {
     ProcessAsync(paramters, null);
 }