public static Tile GetCachedTile(int level, int x, int y, IImageSet dataset, Tile parent) { if (level < dataset.BaseLevel) { return(null); } Tile retTile = null; long tileKey = ImageSetHelper.GetTileKey(dataset, level, x, y); try { if (!tiles.ContainsKey(tileKey)) { return(null); } else { retTile = tiles[tileKey]; } } catch { if (Earth3d.Logging) { Earth3d.WriteLogMessage("Tile Initialize: Exception"); } } return(retTile); }
public static Tile GetTileNow(int level, int x, int y, IImageSet dataset, Tile parent) { if (level < dataset.BaseLevel) { return(null); } Tile retTile = null; long tileKey = ImageSetHelper.GetTileKey(dataset, level, x, y); try { if (!tiles.ContainsKey(tileKey)) { retTile = ImageSetHelper.GetNewTile(dataset, level, x, y, parent); tileMutex.WaitOne(); tiles.Add(tileKey, retTile); tileMutex.ReleaseMutex(); } else { retTile = tiles[tileKey]; } } catch { if (Earth3d.Logging) { Earth3d.WriteLogMessage("GetTile: Exception"); } } finally { //todoperf get rid of this write for GC retTile.AccessCount = AccessID++; } // Create if not ready to render if (!retTile.ReadyToRender) { TileCache.GetTileFromWeb(retTile, false); retTile.CreateGeometry(Earth3d.MainWindow.RenderContext11, false); } return(retTile); }
public static Tile GetTile(int level, int x, int y, IImageSet dataset, Tile parent) { if (level < dataset.BaseLevel) { return(null); } Tile retTile = null; long tileKey = ImageSetHelper.GetTileKey(dataset, level, x, y); try { if (!tiles.ContainsKey(tileKey)) { retTile = ImageSetHelper.GetNewTile(dataset, level, x, y, parent); tileMutex.WaitOne(); tiles.Add(tileKey, retTile); tileMutex.ReleaseMutex(); } else { retTile = tiles[tileKey]; } } catch { if (Earth3d.Logging) { Earth3d.WriteLogMessage("GetTile: Exception"); } } finally { //todoperf get rid of this write for GC retTile.AccessCount = AccessID++; } return(retTile); }