示例#1
0
        /// <summary>
        /// Gets the image format of this tile set
        /// </summary>
        /// <param name="tileSet">The tile set</param>
        /// <returns>The image format</returns>
        public static string GetTileFormat(this ITileSetDefinition tileSet)
        {
            Check.ArgumentNotNull(tileSet, nameof(tileSet));
            var p = tileSet.GetParameter("TileFormat"); //NOXLATE

            if (p != null)
            {
                return(p.Value);
            }
            return(null);
        }
示例#2
0
        /// <summary>
        /// Gets the height of this tile set. Must be using the default tile provider.
        /// </summary>
        /// <param name="tileSet">The tile set</param>
        /// <returns>The height of this tile set</returns>
        public static int?GetDefaultTileHeight(this ITileSetDefinition tileSet)
        {
            Check.ArgumentNotNull(tileSet, nameof(tileSet));
            var p = tileSet.GetParameter("TileHeight"); //NOXLATE

            if (p != null)
            {
                return(Convert.ToInt32(p.Value));
            }
            return(null);
        }
示例#3
0
        /// <summary>
        /// Gets the finite scale list of this tile set. Must be using the default tile provider.
        /// </summary>
        /// <param name="tileSet">The tile set</param>
        /// <returns>The array of finite scales</returns>
        public static double[] GetDefaultFiniteScaleList(this ITileSetDefinition tileSet)
        {
            Check.ArgumentNotNull(tileSet, nameof(tileSet));
            var p = tileSet.GetParameter("FiniteScaleList"); //NOXLATE

            if (p != null && !string.IsNullOrEmpty(p.Value))
            {
                return(p.Value.Split(',').Select(x => x.Trim()).Select(x => Convert.ToDouble(x)).OrderBy(s => s).ToArray());
            }
            return(new double[0]);
        }
        public void CreateTest()
        {
            var res = ObjectFactory.CreateTileSetDefinition(new Version(3, 0, 0));

            Assert.IsAssignableFrom <ITileSetDefinition>(res);
            ITileSetDefinition tsd = (ITileSetDefinition)res;

            Assert.Equal("Default", tsd.TileStoreParameters.TileProvider);
            tsd.SetXYZProviderParameters();
            Assert.Equal("XYZ", tsd.TileStoreParameters.TileProvider);
            var p = tsd.GetParameter("TileFormat");

            Assert.NotNull(p);
            Assert.Equal("PNG", p.Value);
            Assert.Equal("PNG", tsd.GetTileFormat());
            p = tsd.GetParameter("TilePath");
            Assert.NotNull(p);
            Assert.Equal("%MG_TILE_CACHE_PATH%", p.Value);
            Assert.Equal("%MG_TILE_CACHE_PATH%", tsd.GetTilePath());

            tsd.SetDefaultProviderParameters(256, 256, "coordsys", new double[] { 100.5, 200.5, 300.5 });
            p = tsd.GetParameter("TileWidth");
            Assert.NotNull(p);
            Assert.Equal("256", p.Value);
            Assert.Equal(256, tsd.GetDefaultTileWidth());
            p = tsd.GetParameter("TileHeight");
            Assert.NotNull(p);
            Assert.Equal("256", p.Value);
            Assert.Equal(256, tsd.GetDefaultTileHeight());
            p = tsd.GetParameter("CoordinateSystem");
            Assert.NotNull(p);
            Assert.Equal("coordsys", p.Value);
            Assert.Equal("coordsys", tsd.GetDefaultCoordinateSystem());
            p = tsd.GetParameter("FiniteScaleList");
            Assert.NotNull(p);
            Assert.Equal("300.5,200.5,100.5", p.Value);
            var value = tsd.GetDefaultFiniteScaleList();

            Assert.Equal(3, value.Length);
            Assert.Contains(100.5, value);
            Assert.Contains(200.5, value);
            Assert.Contains(300.5, value);
            p = tsd.GetParameter("TileFormat");
            Assert.NotNull(p);
            Assert.Equal("PNG", p.Value);
            Assert.Equal("PNG", tsd.GetTileFormat());
            p = tsd.GetParameter("TilePath");
            Assert.NotNull(p);
            Assert.Equal("%MG_TILE_CACHE_PATH%", p.Value);
            Assert.Equal("%MG_TILE_CACHE_PATH%", tsd.GetTilePath());
        }
示例#5
0
        /// <summary>
        /// Gets the coordinate system of this tile set. Must be using the default tile provider
        /// </summary>
        /// <param name="tileSet">The tile set</param>
        /// <returns>The coordinate system</returns>
        public static string GetDefaultCoordinateSystem(this ITileSetDefinition tileSet)
        {
            Check.ArgumentNotNull(tileSet, nameof(tileSet));

            var p = tileSet.GetParameter("CoordinateSystem"); //NOXLATE

            if (p != null)
            {
                return(p.Value);
            }
            return(null);
        }