예제 #1
0
        public async Task GeteRedlineCountAsync_CountFeatures_FiveFeaturesFound()
        {
            QueryCountResult results = null;
            Map map = null;

            var table = new ServiceFeatureTable(
                new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Water_Network/FeatureServer/2"));

            await table.InitializeAsync();

            map = new Map();
            map.Layers.Add(new FeatureLayer(table)
            {
                ID = "test"
            });


            var queryTask = new QueryTask(new Uri(table.ServiceUri));

            results = await queryTask.ExecuteCountAsync(new Query("1=1"));

            Assert.IsNotNull(map);
            Assert.IsNotNull(results);
            Assert.AreEqual(5, results.Count);
        }
예제 #2
0
        public async Task GetRedlineCountAsync_CountFeatures_FiveFeaturesFound()
        {
            await ThreadHelper.Run(async() =>
            {
                QueryCountResult results = null;
                Map map = null;

                var table = new ServiceFeatureTable(
                    new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Water_Network/FeatureServer/2"));

                await table.InitializeAsync();

                map = new Map();
                map.Layers.Add(new FeatureLayer(table)
                {
                    ID = "test"
                });

                var queryTask = new QueryTask(new Uri(table.ServiceUri));
                results       = await queryTask.ExecuteCountAsync(new Query("1=1"));

                //Assert.IsNotNull(map);
                //Assert.IsNotNull(results);
                Assert.AreEqual(5, results.Count);
                System.Diagnostics.Debug.WriteLine("Results count: " + results.Count.ToString());
            });
        }
예제 #3
0
        public async Task GetRedlineCountAsync_CountFeatures_FiveFeaturesFound()
        {
            QueryCountResult results = null;
            Map map = null;

            var table = new ServiceFeatureTable(
                new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Water_Network/FeatureServer/2"));

            await table.InitializeAsync();
            map = new Map();
            map.Layers.Add(new FeatureLayer(table) { ID = "test" });

            var queryTask = new QueryTask(new Uri(table.ServiceUri));
            results = await queryTask.ExecuteCountAsync(new Query("1=1"));

            //Assert.IsNotNull(map);
            //Assert.IsNotNull(results);
            Assert.AreEqual(5, results.Count);
        }
예제 #4
0
        /// <summary>
        /// 创建本地要素服务,并加载底图
        /// </summary>
        /// <param name="myMapView"></param>
        public async void CreateLocalFeatureService(MapView myMapView)
        {
            try
            {
                //读取配置文件路径
                var localFeatureLocation = ConfigurationSettings.AppSettings["LocalFeatureLocation"];
                var featureLayersCount   = Convert.ToInt32(ConfigurationSettings.AppSettings["FeatureLayersCount"]);
                //启动本地要素服务
                var localFeatureService = new LocalFeatureService(localFeatureLocation);
                await localFeatureService.StartAsync();

                //保存LocalFeatureUrl
                Global.LocalFeatureUrl = localFeatureService.UrlFeatureService;
                //加载Layers
                for (var i = 0; i < featureLayersCount; i++)
                {
                    var featureTable = new ServiceFeatureTable
                    {
                        ServiceUri = localFeatureService.UrlFeatureService + string.Format("/{0}", i)
                    };
                    await featureTable.InitializeAsync(myMapView.SpatialReference);

                    if (featureTable.IsInitialized)
                    {
                        var flayer = new FeatureLayer
                        {
                            ID           = featureTable.Name, //table.Name,
                            FeatureTable = featureTable,
                            DisplayName  = featureTable.Name
                        };
                        myMapView.Map.Layers.Add(flayer);
                        var extent = featureTable.ServiceInfo.Extent;
                        await myMapView.SetViewAsync(extent.Expand(1.10));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #5
0
        public async Task GetRedlineCountAsync_CountFeatures_FiveFeaturesFound()
        {
            await ThreadHelper.Run(async () =>
            {
                QueryCountResult results = null;
                Map map = null;

                var table = new ServiceFeatureTable(
                    new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Water_Network/FeatureServer/2"));

                await table.InitializeAsync();

                map = new Map();
                map.Layers.Add(new FeatureLayer(table) { ID = "test" });
                
                var queryTask = new QueryTask(new Uri(table.ServiceUri));
                results = await queryTask.ExecuteCountAsync(new Query("1=1"));

                //Assert.IsNotNull(map);
                //Assert.IsNotNull(results);
                Assert.AreEqual(5, results.Count);
                System.Diagnostics.Debug.WriteLine("Results count: " + results.Count.ToString());
            });
        }