${iServerJava6R_QueryByDistanceParameters_Tile}

${iServerJava6R_QueryByDistanceParameters_Description}

Inheritance: QueryParameters
コード例 #1
0
        private void distanceQuery_Click(object sender, RoutedEventArgs e)
        {
            QueryByDistanceParameters param = new QueryByDistanceParameters
            {
                Geometry = new GeoPoint(10, 10),
                Distance = 100,
                FilterParameters = new List<FilterParameter>()
                {
                    new FilterParameter(){
                        Name = "World@World",
                    },

                },
                QueryOption = QueryOption.GEOMETRY
            };

            QueryByDistanceService dqs = new QueryByDistanceService(url);

            dqs.ProcessAsync(param);
            dqs.ProcessCompleted += new EventHandler<QueryEventArgs>(service_ProcessCompleted);
            dqs.Failed += service_Failed;
        }
        //几何对象绘制结束触发事件
        private void drawCompleted(object sender, DrawEventArgs e)
        {
            double tolerance;

            //隐藏 FeatureDataGrid 控件
            MyDataGrid.Visibility = Visibility.Collapsed;

            //如果距离值为空时,默认为1地图单位
            if (!double.TryParse(MyTextBox.Text, out tolerance))
            {
                tolerance = 1;
            }

            //如果查找最近地物,只返回一个期望地物
            if ((bool)FindNearest.IsChecked)
            {
                count = 1;
            }
            else
            {
                count = 100000;
            }

            //设置距离查询参数,FilterParameters和Geometry为必设属性
            QueryByDistanceParameters param = new QueryByDistanceParameters
            {
                Geometry = e.Geometry,
                ExpectCount = count,
                Distance = tolerance,
                IsNearest = (bool)FindNearest.IsChecked,
                FilterParameters = new List<FilterParameter>() 
                { 
                    new FilterParameter(){Name = "Countries@World",}, 
                },

                //设置是返回查询结果资源(false)还是返回查询结果记录集(true)
                ReturnContent = notHighlight
            };

            //与服务器交互
            QueryByDistanceService service = new QueryByDistanceService(url);
            service.ProcessAsync(param);
            service.ProcessCompleted += new EventHandler<QueryEventArgs>(service_ProcessCompleted);
            service.Failed += service_Failed;

            //当在 FeaturesLayer 上通过鼠标左键点击触发的事件
            flayer.MouseLeftButtonDown +=flayer_MouseLeftButtonDown;
        }