MSFPersistentCacheTileDataSource
Objective-C
@interface MSFPersistentCacheTileDataSource : MSFCacheTileDataSource
Swift
class MSFPersistentCacheTileDataSource : MSFCacheTileDataSource
A tile data source that loads tiles from another tile data source and caches them in an offline sqlite database. Tiles will remain in the database even after the application is closed. The database contains table “persistent_cache” with the following fields: “tileId” (tile id), “compressed” (compressed tile image), “time” (the time the tile was cached in milliseconds from epoch), “metaData” (the tile’s meta data map as JSON). Default cache capacity is 50MB.
-
Constructs a PersistentCacheTileDataSource object from tile data source and a sqlite database. The sqlite database must be writable, if it doesn’t exist, an empty one will be created instead.
Declaration
Objective-C
- (id)initWithDataSource:(MSFTileDataSource *)dataSource databasePath:(NSString *)databasePath;Swift
init!(dataSource: MSFTileDataSource!, databasePath: String!)Parameters
dataSourceThe datasource to be cached.
databasePathThe path to the sqlite database, where the tiles will be cached.
-
Returns the state of cache only mode.
Declaration
Objective-C
- (BOOL)isCacheOnlyMode;Swift
func isCacheOnlyMode() -> BoolReturn Value
True when cache only mode is enabled, false otherwise.
-
Switches the datasource to ‘cache only’ mode or switches back from the mode. If enabled, tiles are loaded from the cache only and the original data source is not used. By default, cache only mode is off.
Declaration
Objective-C
- (void)setCacheOnlyMode:(BOOL)enabled;Swift
func setCacheOnlyMode(_ enabled: Bool)Parameters
enabledTrue when the mode should be enabled, false otherwise.
-
Starts downloading the specified area. The area will be stored in the cache. Note that is the area is too big or cache is already filled, subsequent downloaded tiles may push existing tile out of the cache.
Declaration
Objective-C
- (void)startDownloadArea:(MSFMapBounds *)mapBounds minZoom:(int)minZoom maxZoom:(int)maxZoom fetchDelay:(int)fetchDelay tileDownloadListener:(MSFTileDownloadListener *)tileDownloadListener;Swift
func startDownloadArea(_ mapBounds: MSFMapBounds!, minZoom: Int32, maxZoom: Int32, fetchDelay: Int32, tileDownloadListener: MSFTileDownloadListener!)Parameters
mapBoundsThe bounds of the area to download. The coordinate system of the bounds must be the same as specified in the data source projection.
minZoomThe minimum zoom of the tiles to load.
maxZoomThe maximum zoom of the tiles to load.
fetchDelaydelay between tiles requests. Used to be easy on the servers
tileDownloadListenerThe tile download listener to use that will receive download related callbacks.
-
Stops all background downloader processes.
Declaration
Objective-C
- (void)stopAllDownloads;Swift
func stopAllDownloads() -
Returns the status of the cache database.
Declaration
Objective-C
- (BOOL)isOpen;Swift
func isOpen() -> BoolReturn Value
True if the persistent cache database is open and working, false otherwise.
-
Closes the cache database. The datasource will still work afterwards, but all requests will be directed to the original datasource.
Declaration
Objective-C
- (void)close;Swift
func close() -
Undocumented
Declaration
Objective-C
- (MSFTileData *)loadTile:(MSFMapTile *)mapTile;Swift
func load(_ mapTile: MSFMapTile!) -> MSFTileData! -
Undocumented
Declaration
Objective-C
-(MSFTileData*)loadTileSwigExplicitMSFPersistentCacheTileDataSource: (MSFMapTile*)mapTile;Swift
func loadTileSwigExplicitMSFPersistentCacheTileDataSource(_ mapTile: MSFMapTile!) -> MSFTileData! -
Undocumented
Declaration
Objective-C
- (void)clear;Swift
func clear() -
Undocumented
Declaration
Objective-C
-(void)clearSwigExplicitMSFPersistentCacheTileDataSource;Swift
func clearSwigExplicitMSFPersistentCacheTileDataSource() -
Undocumented
Declaration
Objective-C
- (unsigned long)getCapacity;Swift
func getCapacity() -> UInt -
Undocumented
Declaration
Objective-C
-(unsigned long)getCapacitySwigExplicitMSFPersistentCacheTileDataSource;Swift
func getCapacitySwigExplicitMSFPersistentCacheTileDataSource() -> UInt -
Undocumented
Declaration
Objective-C
- (void)setCapacity:(unsigned long)capacityInBytes;Swift
func setCapacity(_ capacityInBytes: UInt) -
Undocumented
Declaration
Objective-C
-(void)setCapacitySwigExplicitMSFPersistentCacheTileDataSource: (unsigned long)capacityInBytes;Swift
func setCapacitySwigExplicit(_ capacityInBytes: UInt) -
Undocumented
Declaration
Objective-C
-(void)dealloc;Swift
func dealloc()