예제 #1
0
        public void World()
#endif
        {
            var map = new Map <VectorTile>(_fs);

            map.Vector2dBounds = Vector2dBounds.World();
            map.Zoom           = 3;

            var mapObserver = new Utils.VectorMapObserver();

            map.Subscribe(mapObserver);
            map.Update();

#if UNITY_5_6_OR_NEWER
            IEnumerator enumerator = _fs.WaitForAllRequests();
            while (enumerator.MoveNext())
            {
                yield return(null);
            }
#else
            _fs.WaitForAllRequests();
#endif

            Assert.AreEqual(64, mapObserver.Tiles.Count);

            map.Unsubscribe(mapObserver);
        }
예제 #2
0
        public void ParseSuccess()
#endif
        {
            var map = new Map <VectorTile>(_fs);

            var mapObserver = new Utils.VectorMapObserver();

            map.Subscribe(mapObserver);

            // Helsinki city center.
            map.Center = new Vector2d(60.163200, 24.937700);

            for (int zoom = 15; zoom > 0; zoom--)
            {
                map.Zoom = zoom;
                map.Update();
#if UNITY_5_6_OR_NEWER
                IEnumerator enumerator = _fs.WaitForAllRequests();
                while (enumerator.MoveNext())
                {
                    yield return(null);
                }
#else
                _fs.WaitForAllRequests();
#endif
            }

            // We must have all the tiles for Helsinki from 0-15.
            Assert.AreEqual(15, mapObserver.Tiles.Count);

            foreach (var tile in mapObserver.Tiles)
            {
                Assert.Greater(tile.LayerNames().Count, 0, "Tile contains at least one layer");
                Mapbox.VectorTile.VectorTileLayer layer = tile.GetLayer("water");
                Assert.NotNull(layer, "Tile contains 'water' layer. Layers: {0}", string.Join(",", tile.LayerNames().ToArray()));
                Assert.Greater(layer.FeatureCount(), 0, "Water layer has features");
                Mapbox.VectorTile.VectorTileFeature feature = layer.GetFeature(0);
                Assert.Greater(feature.Geometry <long>().Count, 0, "Feature has geometry");
                Assert.Greater(tile.GeoJson.Length, 1000);
            }

            map.Unsubscribe(mapObserver);
        }