コード例 #1
0
 public Bitmap GenerateBitmap(TileTreeNodeFiller filler)
 {
     if (_bitmap != null)
     {
         return(_bitmap);
     }
     if (_isFilling)
     {
         return(null);  // This is a small window where a race could occur
     }
     _isFilling = true;
     Task.Run(() =>
     {
         Console.WriteLine($"Filling {Address}");
         if (File.Exists(Path))
         {
             SetBitmap((Bitmap)Image.FromFile(Path));
             InvalidateMapView();
         }
         else if (Terrain != null)
         {
             var bitmap = filler.Fill(this);
             bitmap.Save(Path, ImageFormat.Png);
             SetBitmap(bitmap);
             _isFilling = false;
             InvalidateMapView();
         }
     });
     return(null);
 }
コード例 #2
0
        public static TileTree MakeTree(TileTreeNodeFiller filler, string cache_root)
        {
            var t = new TileTree {
                Filler = filler, CacheRoot = cache_root
            };

            t.EnsureCacheDirectoryExists();
            return(t);
        }