${iServer2_Query_QueryByCenterService_Title}

${iServer2_Query_QueryByCenterService_Description}

Inheritance: SuperMap.Web.Service.ServiceBase
 private void point_DrawCompleted(object sender, DrawEventArgs e)
 {
     QueryByCenterParameters parameters = new QueryByCenterParameters
                 {
                     CenterPoint = e.Geometry.Bounds.Center,
                     Tolerance = 5,
                     MapName = "Changchun",
                     QueryParam = new QueryParam { QueryLayerParams = new List<QueryLayerParam>() { qlpVegetable } }
                 };
     QueryByCenterService query = new QueryByCenterService("http://localhost:7080/demo");
     query.ProcessAsync(parameters);
     query.Failed += (s, args) => { MessageBox.Show(args.Error.ToString()); };
     query.ProcessCompleted += new EventHandler<QueryEventArgs>(query_ProcessCompleted);
 }
        private void selectEntity_DrawCompleted(object sender, DrawEventArgs e)
        {
            //如果存在编辑过的地物,则不显示编辑过的地物
            if (Editflag == true)
            {
                drawLayer.ClearFeatures();
                dgVegetable.Visibility = Visibility.Collapsed;
                Editflag = false;
            }

            //查询鼠标点击处地物
            QueryByCenterParameters parameters = new QueryByCenterParameters
            {
                CenterPoint = e.Geometry.Bounds.Center,
                Tolerance = 5,
                MapName = "Changchun",
                IsNearest = true,
                QueryParam = new QueryParam { QueryLayerParams = new List<QueryLayerParam>() { qureyLayerParam } }
            };
            QueryByCenterService selectQuery = new QueryByCenterService("http://localhost:7080/demo");
            selectQuery.ProcessAsync(parameters);
            selectQuery.Failed += (s, args) => { MessageBox.Show(args.Error.ToString()); };
            selectQuery.ProcessCompleted += new EventHandler<QueryEventArgs>(selectQuery_ProcessCompleted);
        }
 //中心点查询功能查询地物
 private void queryEntity(SuperMap.Web.Core.Geometry entity)
 {
     QueryByCenterParameters parameters = new QueryByCenterParameters
     {
         CenterPoint = entity.Bounds.Center,
         Tolerance = 5,
         MapName = "Changchun",
         IsNearest = true,
         QueryParam = new QueryParam { QueryLayerParams = new List<QueryLayerParam>() { qureyLayerParam } }
     };
     QueryByCenterService query = new QueryByCenterService("http://localhost:7080/demo");
     query.ProcessAsync(parameters);
     query.Failed += (s, args) => { MessageBox.Show(args.Error.ToString()); };
     query.ProcessCompleted += new EventHandler<QueryEventArgs>(query_ProcessCompleted);
 }
 private void residential_Click(object sender, RoutedEventArgs e)
 {
     DrawPoint point = new DrawPoint(MyMap);
     MyMap.Action = point;
     point.DrawCompleted += (s2, e2) =>
     {
         QueryByCenterParameters parameters = new QueryByCenterParameters
         {
             CenterPoint = e2.Geometry.Bounds.Center,
             Tolerance = 5,
             MapName = "Changchun",
             QueryParam = new QueryParam { QueryLayerParams = new List<QueryLayerParam>() { qlpResidentialArea } }
         };
         QueryByCenterService query = new QueryByCenterService("http://localhost:7080/demo");
         query.ProcessAsync(parameters);
         query.Failed += (s, args) => { MessageBox.Show(args.Error.ToString()); };
         query.ProcessCompleted += (s3, e3) =>
         {
             if (e3.ResultSet == null)
             {
                 MessageBox.Show("No Result!");
                 return;
             }
             sgResidentialArea = e3.ResultSet.RecordSets[0].Records[0].Shape;
             FeatureCollection fc = e3.ResultSet.RecordSets[0].ToFeatureSet();
             Feature f = new Feature { Geometry = fc[0].Geometry, Style = this.RedFillStyle };
             paramLayer.Features.Add(f);
         };
     };
 }
Ejemplo n.º 5
0
        //中心点查询
        private void point_DrawCompleted(object sender, DrawEventArgs e)
        {
            List<QueryLayerParam> queryLayerParams = new List<QueryLayerParam>();
            if (comboBox.SelectedIndex != 3)
            {   //在一个图层中查询,获取要查询的图层名
                QueryLayerParam queryLayerParam = new QueryLayerParam();
                queryLayerParam.Name = comboBox.SelectionBoxItem.ToString();

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

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

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

            //设置中心点查询参数,其中四个属性都为必设属性
            QueryByCenterParameters parameters = new QueryByCenterParameters
            {
                CenterPoint = e.Geometry.Bounds.Center,
                Tolerance = tolerance,
                MapName = "Changchun",

                // ExceptCount属性小于等于0时表示返回全部查询结果
                QueryParam = new QueryParam { QueryLayerParams = queryLayerParams, ExpectCount =1000 }
            };

            //是否查找最近地物
            if (FindNearest.IsChecked == true)
            {
                parameters.IsNearest = true;
            }

            //与指定服务器交互
            QueryByCenterService queryByCenterService = new QueryByCenterService("http://localhost:7080/demo");
            queryByCenterService.ProcessAsync(parameters);
            queryByCenterService.Failed += new System.EventHandler<ServiceFailedEventArgs>(queryByCenterService_Failed);
            queryByCenterService.ProcessCompleted += new System.EventHandler<QueryEventArgs>(queryByCenterService_ProcessCompleted);
        }