public override IResource CreateItem(string startPoint, OSGeo.MapGuide.MaestroAPI.IServerConnection conn) { var cmd = (IGetTileProviders)conn.CreateCommand((int)CommandType.GetTileProviders); var providers = cmd.Execute(); var item = GenericItemSelectionDialog.SelectItem(Strings.SelectTileProvider, Strings.SelectTileProvider, providers.TileProvider, "DisplayName", "Name"); if (item != null) { ITileSetDefinition tsd = ObjectFactory.CreateTileSetDefinition(new Version(3, 0, 0)); switch (item.Name) { case "Default": tsd.SetDefaultProviderParameters(300, 300, string.Empty, new double[0]); break; case "XYZ": tsd.SetXYZProviderParameters(); break; default: return(null); } return(tsd); } return(null); }
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()); }