GLMapManager


@interface GLMapManager : NSObject

Map manager used to work with list of offline maps

  • Plain -init is disabled

    Declaration

    Objective-C

    - (instancetype _Nonnull)init;
  • Allows to download map tiles one by one

    By default tileDownloadingAllowed = NO. GLMapView checks tile in world offline map first, then in embed and downloaded offline maps, then in downloaded earlier tiles and at last step if tile downloading is allowed it tries to download map tile.

    Declaration

    Objective-C

    @property (assign, readwrite, atomic) BOOL tileDownloadingAllowed;
  • Cached tile will be refreshed if it will stay in cache more than given time. Time interval is measured in seconds.

    By default tileRefreshTimeInterval = -1. If tileRefreshTimeInterval < 0 no tile refreshing will be triggered.

    Declaration

    Objective-C

    @property (assign, readwrite, atomic) int64_t tileRefreshTimeInterval;
  • Number of donwloded maps

    Declaration

    Objective-C

    @property (readonly, atomic) uint64_t downloadedMapsCount;
  • Blocks what will called on the main thread when subtask is completed or cancelled.

    Declaration

    Objective-C

    @property (readwrite, strong, atomic)
        GLMapDownloadStatsBlock _Nullable downloadStatsBlock;
  • An API key used to download vector maps and tiles

    Declaration

    Objective-C

    @property (readwrite, strong, atomic) NSString *_Nullable apiKey;
  • Singleton manager object

    Declaration

    Objective-C

    @property (readonly, nonatomic, class) GLMapManager *_Nonnull sharedManager;
  • Declaration

    Objective-C

    - (NSArray<GLMapInfo *> *_Nullable)cachedMapList;

    Return Value

    Returns array of GLMapInfo objects downloaded earlier and cached by GLMapManager

  • Declaration

    Objective-C

    - (NSDictionary<NSNumber *, GLMapInfo *> *_Nullable)cachedMaps;

    Return Value

    Returns dictionary of all GLMapInfo objects (including submaps) downloaded earlier and cached by GLMapManager

  • Updates map list

    Declaration

    Objective-C

    - (void)updateMapListWithCompletionBlock:(GLMapListUpdateBlock _Nullable)block;

    Parameters

    block

    A block called when map list is downloaded

  • Sorts maps by distance from border.

    Declaration

    Objective-C

    - (void)sortMaps:(NSMutableArray<GLMapInfo *> *_Nonnull)maps
           fromPoint:(GLMapPoint)point;

    Parameters

    maps

    maps to sort

    point

    point to meashure distance *

  • Deletes downloaded map data sets

    Declaration

    Objective-C

    - (void)deleteDataSets:(GLMapInfoDataSetMask)dataSets
                    forMap:(GLMapInfo *_Nonnull)map;

    Parameters

    dataSets

    data sets to delete

    map

    map object

  • Starts download task

    It’s up to you save download task or not. Active map download task could be received later from -downloadTaskForMap:.

    Declaration

    Objective-C

    - (GLMapDownloadTask *_Nullable)
       downloadDataSets:(GLMapInfoDataSetMask)dataSets
                 forMap:(GLMapInfo *_Nonnull)map
    withCompletionBlock:(GLMapDownloadCompletionBlock _Nullable)completionBlock;

    Parameters

    dataSets

    data sets to download

    map

    map object

    completionBlock

    completion block

    Return Value

    A new download task object

  • Used to check if there is a download task for a given map

    Declaration

    Objective-C

    - (GLMapDownloadTask *_Nullable)downloadTaskForMap:(GLMapInfo *_Nonnull)map;

    Parameters

    map

    A map info object

    Return Value

    Returns GLMapDownloadTask previously created for a map

  • Map download task is removed from array when map downloading is finished

    Declaration

    Objective-C

    - (NSArray<GLMapDownloadTask *> *_Nullable)allDownloadTasks;

    Return Value

    Returns all tasks created by [GLMapManager downloadMap:withCompletionBlock]

  • Adds vector map. Could be used for maps embed into the app resources.

    When map is added, it becomes available for all GLMapView objects.

    Declaration

    Objective-C

    - (BOOL)addMap:(NSString *_Nonnull)path;

    Parameters

    path

    Path to the vector map

    Return Value

    YES if file exists and was added to list of custom maps.

  • Removes vector map from map manager. When removed is safe to delete map file.

    Declaration

    Objective-C

    - (void)removeMap:(NSString *_Nonnull)path;

    Parameters

    path

    Path to the embed map

  • Returns downloaded map at given point

    Declaration

    Objective-C

    - (GLMapInfo *_Nullable)downloadedMapAtPoint:(GLMapPoint)point;

    Parameters

    point

    Some point in internal format

    Return Value

    GLMapInfo of downloaded map

  • Returns map at given point

    Declaration

    Objective-C

    - (GLMapInfo *_Nullable)mapAtPoint:(GLMapPoint)point;

    Parameters

    point

    Some point in internal format

    Return Value

    GLMapInfo of map

  • Removes GLMap cached objects and closes opened databases

    clearCaches called automatically on UIApplicationDidEnterBackgroundNotification

    Declaration

    Objective-C

    - (void)clearCaches;
  • Saves state for downloading tasks. It allows to resume downloads in case of crash or unexpected behavior

    Called automatically when app is minimized

    Declaration

    Objective-C

    - (void)saveDownloadsState;
  • Returns vector tiles that bbox contains or intersects

    Declaration

    Objective-C

    - (NSArray<NSNumber *> *_Nonnull)vectorTilesAtBBox:(GLMapBBox)bbox;

    Parameters

    bbox

    bbox of area

    Return Value

    Returns vector tiles array contained or intersected by bbox

  • Returns not cached vector tiles that bbox contains or intersects

    Declaration

    Objective-C

    - (NSArray<NSNumber *> *_Nonnull)notCachedVectorTilesAtBBox:(GLMapBBox)bbox;

    Parameters

    bbox

    bbox of area

    Return Value

    Returns not cached vector tiles contained or intersected by bbox

  • Check if tiles cached. If not tile will be downloaded.

    Declaration

    Objective-C

    - (void)cacheTiles:(NSArray<NSNumber *> *_Nonnull)tiles
         progressBlock:(GLMapTileDownloadProgressBlock _Nullable)progressBlock;

    Parameters

    tiles

    tiles to check

    progressBlock

    block that will be called when one tile is checked.

  • Returns bbox for given tile

    Declaration

    Objective-C

    - (GLMapBBox)bboxForTile:(uint64_t)tile;

    Parameters

    tile

    tile to calculate bbox

    Return Value

    Returns bbox of tile