${iServerJava6R_Query_queryParamerters_Title}

${iServerJava6R_Query_queryParamerters_Description}

 /// <summary>${iServerJava6R_Query_QueryByDistanceService_method_GetParameters_D}</summary>
 /// <param name="parameters">${iServerJava6R_Query_QueryByDistanceService_method_GetParameters_parameters}</param>
 protected override Dictionary<string, string> GetParameters(QueryParameters parameters)
 {
     Dictionary<string, string> dictionary = new Dictionary<string, string>();
     dictionary.Add("queryMode", "\"SqlQuery\"");
     dictionary.Add("queryParameters", QueryParameters.ToJson(parameters));
     return dictionary;
 }
        /// <summary>${iServerJava6R_Query_QueryByDistanceService_method_GetParameters_D}</summary>
        /// <param name="parameters">${iServerJava6R_Query_QueryByDistanceService_method_GetParameters_parameters}</param>
        protected override Dictionary<string, string> GetParameters(QueryParameters parameters)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            dictionary.Add("queryMode", "\"SpatialQuery\"");
            dictionary.Add("queryParameters", QueryParameters.ToJson(parameters));
            dictionary.Add("geometry", ServerGeometry.ToJson(((QueryByGeometryParameters)parameters).Geometry.ToServerGeometry()));
            dictionary.Add("spatialQueryMode", string.Format("\"{0}\"", ((QueryByGeometryParameters)parameters).SpatialQueryMode));

            return dictionary;
        }
        /// <summary>${iServerJava6R_Query_QueryByBoundsService_method_GetParameters}</summary>
        /// <param name="parameters">${iServerJava6R_Query_QueryByBoundsService_method_GetParameters_parameters}</param>
        protected override Dictionary<string, string> GetParameters(QueryParameters parameters)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            dictionary.Add("queryMode", "\"BoundsQuery\"");
            dictionary.Add("queryParameters", QueryParameters.ToJson(parameters));
            if (!((QueryByBoundsParameters)parameters).Bounds.IsEmpty)
            {
                dictionary.Add("bounds", JsonHelper.FromRectangle2D(((QueryByBoundsParameters)parameters).Bounds));
            }
            return dictionary;
        }
        //
        internal static string ToJson(QueryParameters param)
        {
            if (param == null)
            {
                return null;
            }

            string json = "{";
            List<string> list = new List<string>();

            if (!string.IsNullOrEmpty(param.CustomParams))
            {
                list.Add(string.Format("\"customParams\":\"{0}\"", param.CustomParams));
            }
            else
            {
                list.Add("\"customParams\":null");
            }

            if (param.HoldTime != int.MinValue)
            {
                list.Add(string.Format(System.Globalization.CultureInfo.InvariantCulture, "\"holdTime\":{0}", param.HoldTime));
            }

            list.Add(string.Format(System.Globalization.CultureInfo.InvariantCulture, "\"expectCount\":{0}", param.ExpectCount));
            list.Add(string.Format(System.Globalization.CultureInfo.InvariantCulture, "\"startRecord\":{0}", param.StartRecord));
            list.Add(string.Format("\"networkType\":\"{0}\"", param.NetworkType.ToString()));
            list.Add(string.Format("\"queryOption\":\"{0}\"", param.QueryOption.ToString()));

            IList<FilterParameter> queryParams = param.FilterParameters;
            if (queryParams != null && queryParams.Count > 0)
            {
                List<string> layerParams = new List<string>();

                for (int i = 0; i < queryParams.Count; i++)
                {
                    layerParams.Add(FilterParameter.ToJson(param.FilterParameters[i]));
                }
                string temp = "[" + string.Join(",", layerParams.ToArray()) + "]";
                list.Add(string.Format("\"queryParams\":{0}", temp));
            }

            json += string.Join(",", list.ToArray());
            json += "}";
            return json;
        }
        /// <summary>${iServerJava6R_Query_QueryByDistanceService_method_GetParameters_D}</summary>
        /// <param name="parameters">${iServerJava6R_Query_QueryByDistanceService_method_GetParameters_parameters}</param>
        protected override Dictionary<string, string> GetParameters(QueryParameters parameters)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            if (((QueryByDistanceParameters)parameters).IsNearest)
            {
                dictionary.Add("queryMode", "\"FindNearest\"");
            }
            else
            {
                dictionary.Add("queryMode", "\"DistanceQuery\"");
            }
            dictionary.Add("queryParameters", QueryParameters.ToJson(parameters));
            dictionary.Add("geometry", ServerGeometry.ToJson(((QueryByDistanceParameters)parameters).Geometry.ToServerGeometry()));
            dictionary.Add("distance", ((QueryByDistanceParameters)parameters).Distance.ToString(System.Globalization.CultureInfo.InvariantCulture));

            return dictionary;
        }
        /// <summary>${iServerJava6R_Query_QueryService_method_ProcessAsync_D}</summary>
        /// <param name="parameters">${iServerJava6R_Query_QueryService_ProcessAsync_param_parameters}</param>
        /// <param name="state">${iServerJava6R_Query_QueryService_ProcessAsync_param_state}</param>
        public void ProcessAsync(QueryParameters parameters, object state)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(ExceptionStrings.ArgumentIsNull);
            }
            if (string.IsNullOrEmpty(this.Url))
            {
                throw new InvalidOperationException(ExceptionStrings.InvalidUrl);
            }

            if (!base.Url.EndsWith("/"))
            {
                base.Url += '/';
            }
            //参数必须放在 URI 中
            base.Url += string.Format("queryResults.json?returnContent={0}&debug=true", parameters.ReturnContent.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower());

            base.SubmitRequest(base.Url, GetParameters(parameters), new EventHandler<RequestEventArgs>(request_Completed), state, true);
        }
 /// <summary>${iServerJava6R_Query_QueryService_method_ProcessAsync_D}</summary>
 /// <overloads>${iServerJava6R_Query_QueryService_method_ProcessAsync_overloads}</overloads>
 /// <param name="parameters">${iServerJava6R_Query_QueryService_ProcessAsync_param_parameters}</param>
 public void ProcessAsync(QueryParameters parameters)
 {
     ProcessAsync(parameters, null);
 }
 /// <summary>${iServerJava6R_Query_QueryService_method_GetParameters_D}</summary>
 /// <param name="parameters">${iServerJava6R_Query_QueryService_method_GetParameters_parameters}</param>
 protected abstract Dictionary<string, string> GetParameters(QueryParameters parameters);