void CacheTileClass(GeoStar.Core.TMSTileClass tms) { GeoStar.Core.ConnectProperties connn = new GeoStar.Core.ConnectProperties(); connn.Server = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TileCache"); if (!System.IO.Directory.Exists(connn.Server)) { System.IO.Directory.CreateDirectory(connn.Server); } GeoStar.Core.SqliteDatabaseFactory fac = new GeoStar.Core.SqliteDatabaseFactory(); GeoStar.Core.GeoDatabase gdb = fac.Open(connn); GeoStar.Core.TileClass tileclass = gdb.OpenTileClass(tms.Name) as GeoStar.Core.TileClass; if (null == tileclass) { tileclass = gdb.CreateTileClass(tms.Name, tms.SpatialReference, tms.Pyramid, tms.TileColumnInfo) as GeoStar.Core.TileClass; } tms.Cache = tileclass; }
void LoadTMS(string strName, string str) { GeoStar.Core.WebGeoDatabaseFactory fac = new GeoStar.Core.WebGeoDatabaseFactory(); GeoStar.Core.GeoDatabase gdb = fac.Open(new GeoStar.Core.ConnectProperties()); GeoStar.Core.SpatialReference sr = new GeoStar.Core.SpatialReference(GeoStar.Core.WellKnownSpatialReference.eWebMercator); GeoStar.Core.Pyramid pyramid = GeoStar.Core.Pyramid.WellknownedPyramid(GeoStar.Core.WellknownPyramid.eWebMercatorPyramid); GeoStar.Core.TileColumnInfo col = new GeoStar.Core.TileColumnInfo(); col.FeatureType = GeoStarCore.geoFEATURETYPE.GEO_FT_TILE_DYNVECTOR; col.ValidTopLevel = 0; col.ValidBottomLevel = 20; col.XYDomain = new GeoStar.Core.Box(pyramid.XMin, pyramid.YMin, pyramid.XMax, pyramid.YMax); GeoStar.Core.TMSTileClass tileclass = gdb.CreateTileClass(strName, sr, pyramid, col) as GeoStar.Core.TMSTileClass; tileclass.UrlTemplate = str; CacheTileClass(tileclass); GeoStar.Core.Control.WPF.TileClassGraphicsLayer tilelayer = new GeoStar.Core.Control.WPF.TileClassGraphicsLayer(tileclass); m_GeoSpace.LayerBox.AddLayer(tilelayer); }