Example #1
0
        public static void InitializeTile(Tile tile)
        {
            bool loaded = false;

            while (!loaded && TileCache.running)
            {
                WaitingTileQueueMutex.WaitOne();

                if (CountToLoad > 0)
                {
                    CountToLoad--;
                    CountToLoad = Math.Max(0, CountToLoad);
                    // CountToLoad = 0;
                    loaded = true;
                }

                WaitingTileQueueMutex.ReleaseMutex();

                if (loaded)
                {
                    if (tile != null)
                    {
                        tile.CreateGeometry(Earth3d.MainWindow.RenderContext11, false);
                        tilesLoadedThisFrame++;
                    }
                }
                else
                {
                    WaitingTileQueueEvent.WaitOne();
                }
            }
        }
Example #2
0
 public static void ClearCache()
 {
     if (Earth3d.Logging)
     {
         Earth3d.WriteLogMessage("Clear Cache");
     }
     tileMutex.WaitOne();
     queueMutex.WaitOne();
     WaitingTileQueueMutex.WaitOne();
     try
     {
         WaitingTileQueue = new Queue <Tile>();
         foreach (Tile t in tiles.Values)
         {
             try
             {
                 t.CleanUp(true);
             }
             catch
             {
             }
         }
         tiles.Clear();
     }
     finally
     {
         tileMutex.ReleaseMutex();
         queueMutex.ReleaseMutex();
         WaitingTileQueueMutex.ReleaseMutex();
     }
     return;
 }