${iServer2_EntityBufferQueryParameters_Title}

${iServer2_EntityBufferQueryParameters_Description}

Inheritance: BufferQueryParameters
        /// <summary>${iServer2_EntityBufferQueryService_method_ProcessAsync_D}</summary>
        /// <param name="parameters">${iServer2_EntityBufferQueryService_method_ProcessAsync_param_parameters}</param>
        /// <param name="state">${iServer2_EntityBufferQueryService_method_ProcessAsync_param_state}</param>
        public void ProcessAsync(EntityBufferQueryParameters parameters, object state)
        {
            if (parameters == null)
            {
                //TODO:资源
                // throw new ArgumentNullException("Paramters is Null");
                throw new ArgumentNullException(SuperMap.Web.iServerJava2.Resources.ExceptionStrings.ArgumentIsNull);
            }
            if (string.IsNullOrEmpty(this.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 Dictionary<string, string> GetParameters(EntityBufferQueryParameters parameters)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            Point2DCollection gps = new Point2DCollection();

            if (parameters.Geometry is GeoPoint)
            {
                string method = "PointEntityBufferQuery";
                dictionary.Add("method", method);
                dictionary.Add("mapName", parameters.MapName);

                Dictionary<string, string> dict = new Dictionary<string, string>();
                dict.Add("mapName", parameters.MapName);
                dict.Add("point", JsonHelper.FromGeoPoint(parameters.Geometry as GeoPoint));
                dict.Add("fromLayer", parameters.FromLayer);
                dict.Add("bufferParam", BufferAnalystParam.ToJson(parameters.BufferParam));
                dict.Add("queryParam", QueryParam.ToJson(parameters.QueryParam));
                dict.Add("queryMode", ((int)parameters.QueryMode).ToString());

                dictionary.Add("params", Bridge.CreateParams(method, dict));
            }
            else if (parameters.Geometry is GeoLine)
            {
                string method = "LineEntityBufferQuery";
                dictionary.Add("method", method);
                dictionary.Add("mapName", parameters.MapName);

                Dictionary<string, string> dict = new Dictionary<string, string>();
                dict.Add("mapName", parameters.MapName);
                foreach (Point2DCollection g in (parameters.Geometry as GeoLine).Parts)
                {
                    for (int i = 0; i < g.Count; i++)
                    {
                        gps.Add(g[i]);
                    }
                }
                dict.Add("points", JsonHelper.FromPoint2DCollection(gps));
                dict.Add("fromLayer", parameters.FromLayer);
                dict.Add("bufferParam", BufferAnalystParam.ToJson(parameters.BufferParam));
                dict.Add("queryParam", QueryParam.ToJson(parameters.QueryParam));
                dict.Add("queryMode", ((int)parameters.QueryMode).ToString());

                dictionary.Add("params", Bridge.CreateParams(method, dict));
            }
            else if (parameters.Geometry is GeoRegion)
            {
                string method = "PolygonEntityBufferQuery";
                dictionary.Add("method", method);
                dictionary.Add("mapName", parameters.MapName);

                Dictionary<string, string> dict = new Dictionary<string, string>();
                dict.Add("mapName", parameters.MapName);
                foreach (Point2DCollection g in (parameters.Geometry as GeoRegion).Parts)
                {
                    for (int i = 0; i < g.Count; i++)
                    {
                        gps.Add(g[i]);
                    }
                }
                dict.Add("points", JsonHelper.FromPoint2DCollection(gps));
                dict.Add("fromLayer", parameters.FromLayer);
                dict.Add("bufferParam", BufferAnalystParam.ToJson(parameters.BufferParam));
                dict.Add("queryParam", QueryParam.ToJson(parameters.QueryParam));
                dict.Add("queryMode", ((int)parameters.QueryMode).ToString());

                dictionary.Add("params", Bridge.CreateParams(method, dict));

            }

            return dictionary;
        }
 /// <overloads>${iServer2_EntityBufferQueryService_method_ProcessAsync_overloads_D}</overloads>
 /// <summary>${iServer2_EntityBufferQueryService_method_ProcessAsync_D}</summary>
 /// <param name="parameters">${iServer2_EntityBufferQueryService_method_ProcessAsync_param_parameters}</param>
 public void ProcessAsync(EntityBufferQueryParameters parameters)
 {
     ProcessAsync(parameters, null);
 }
        //设置缓冲区查询参数类
        private void LoadParam(SuperMap.Web.Core.Geometry geo)
        {
            List<QueryLayerParam> queryLayerParams = new List<QueryLayerParam>();
            if (QueriedComboBox.SelectedIndex != 3)
            {
                //在一个图层中查询,获取要查询的图层名
                QueryLayerParam queryLayerParam = new QueryLayerParam();
                queryLayerParam.Name = QueriedComboBox.SelectionBoxItem.ToString();

                //查询图层参数列表
                queryLayerParams = new List<QueryLayerParam>() { queryLayerParam };
            }
            else
            {
                //在三个图层中查询,获取要查询的图层名
                QueryLayerParam queryLayerParamLine = new QueryLayerParam();
                queryLayerParamLine.Name = SchoolLayerName;
                QueryLayerParam queryLayerParamPolygon = new QueryLayerParam();
                queryLayerParamPolygon.Name = RailLayerName;
                QueryLayerParam queryLayerParamPoint = new QueryLayerParam();
                queryLayerParamPoint.Name = ResidentialLayerName;

                //查询图层参数列表
                queryLayerParams = new List<QueryLayerParam>()
                    {   queryLayerParamPoint,
                        queryLayerParamLine,
                        queryLayerParamPolygon
                    };
            }

            //缓冲区参数类
            BufferAnalystParam param = new BufferAnalystParam
            {
                LeftDistance = 100,
                SemicircleLineSegment = 10,
            };

            //如果为缓冲区查询,则设置缓冲区查询参数
            if (BufferQuery.IsChecked == true)
            {
                BufferQueryParameters parameters = new BufferQueryParameters
                {
                    BufferParam = param,
                    Geometry = geo,
                    QueryMode = SpatialQueryMode.Intersect,
                    MapName = "Changchun",
                    QueryParam = new QueryParam { QueryLayerParams = queryLayerParams, ExpectCount = 0 }
                };
                BufferQueryService query = new BufferQueryService("http://localhost:7080/demo/");
                query.ProcessAsync(parameters);
                query.ProcessCompleted += new EventHandler<BufferQueryEventArgs>(query_ProcessCompleted);
                query.Failed += new EventHandler<ServiceFailedEventArgs>(query_Failed);
            }

            //如果为地物缓冲区查询,则设置地物缓冲区查询参数
            else
            {
                EntityBufferQueryParameters parameters = new EntityBufferQueryParameters
                {
                    BufferParam = param,
                    Geometry = geo,
                    QueryMode = SpatialQueryMode.Intersect,
                    MapName = "Changchun",
                    QueryParam = new QueryParam { QueryLayerParams = queryLayerParams, ExpectCount = 0 },
                    FromLayer = QueryComboBox.SelectionBoxItem.ToString()
                };
                EntityBufferQueryService query = new EntityBufferQueryService("http://localhost:7080/demo/");
                query.ProcessAsync(parameters);
                query.ProcessCompleted += new EventHandler<BufferQueryEventArgs>(query_ProcessCompleted);
                query.Failed += new EventHandler<ServiceFailedEventArgs>(query_Failed);
            }
        }