Exemplo n.º 1
0
        /// <summary>
        /// Creates a new tiles layer.
        /// </summary>
        /// <param name="connection">The SQLite connection to the MBTiles.</param>
        /// <param name="tileCacheSize">The size of tiles to cache.</param>
        public LayerMBTile(SQLiteConnectionBase connection, int tileCacheSize)
        {
            _nativeImageCache = NativeImageCacheFactory.Create();
            _connection       = connection;

            _cache           = new LRUCache <Tile, Image2D>(tileCacheSize);
            _cache.OnRemove += OnRemove;
            _projection      = new WebMercator();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new tiles layer.
        /// </summary>
        /// <param name="tilesURL">The tiles URL.</param>
        /// <param name="tileCacheSize">The tile cache size.</param>
        public LayerTile(string tilesURL, int tileCacheSize)
        {
            _nativeImageCache = NativeImageCacheFactory.Create();
            _tilesURL         = tilesURL;
            _cache            = new LRUCache <Tile, Image2D>(tileCacheSize);
            _cache.OnRemove  += OnRemove;
            _stack            = new LimitedStack <Tile>(tileCacheSize, tileCacheSize);
            _timer            = new Timer(this.LoadQueuedTiles, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
            _attempts         = new Dictionary <Tile, int>();
            _suspended        = false;

            _projection = new WebMercator();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Diposes of all resources associated with this object.
        /// </summary>
        /// <param name="disposing"></param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing == true)
            {
                //someone want the deterministic release of all resources
                //Let us release all the managed resources
            }
            else
            {
                // Do nothing, no one asked a dispose, the object went out of
                // scope and finalized is called so lets next round of GC
                // release these resources
            }

            // Release the unmanaged resource in any case as they will not be
            // released by GC
            if (this._nativeImageCache != null)
            { // dispose of the native image.
                this._nativeImageCache.Flush();
                this._nativeImageCache = null;
            }
        }