MBMMap


@interface MBMMap : MBMCameraManager

Map class provides map rendering functionality.

  • Unavailable

    Undocumented

    Declaration

    Objective-C

    - (nonnull instancetype)init NS_UNAVAILABLE;
  • Unavailable

    Undocumented

    Declaration

    Objective-C

    + (nonnull instancetype)new NS_UNAVAILABLE;
  • Initializes the map object.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithClient:(nonnull id<MBMMapClient>)client
                                mapOptions:(nonnull MBMMapOptions *)mapOptions
                           resourceOptions:
                               (nonnull MBMResourceOptions *)resourceOptions;

    Parameters

    client

    The map client of the map

    mapOptions

    The map options that the map adheres to

    resourceOptions

    The resource options that the map adheres to

  • Creates the infrastructure needed for rendering the map. It should be called before any call to render(). Must be called on the render thread.

    Declaration

    Objective-C

    - (void)createRenderer;

    Swift

    func createRenderer()
  • Destroys the infrastructure needed for rendering the map, releasing resources. Must be called on the render thread.

    Declaration

    Objective-C

    - (void)destroyRenderer;

    Swift

    func destroyRenderer()
  • Renders the map

    Declaration

    Objective-C

    - (void)render;

    Swift

    func render()
  • Sets the size of the map

    Declaration

    Objective-C

    - (void)setSizeForSize:(nonnull MBMSize *)size;

    Swift

    func setSizeFor(_ size: MBMSize)

    Parameters

    size

    The new size of the map in \link MapOptions#size platform pixels \endlink

  • Gets the size of the map.

    Declaration

    Objective-C

    - (nonnull MBMSize *)getSize;

    Swift

    func getSize() -> MBMSize

    Return Value

    size The size of the map in \link MapOptions#size platform pixels \endlink

  • Triggers a repaint of the map

    Declaration

    Objective-C

    - (void)triggerRepaint;

    Swift

    func triggerRepaint()
  • Tells the map rendering engine that there is currently a gesture in progress. This affects how the map renders labels, as it will use different texture filters if a gesture is ongoing.

    Declaration

    Objective-C

    - (void)setGestureInProgressForInProgress:(BOOL)inProgress;

    Swift

    func setGestureInProgressForInProgress(_ inProgress: Bool)

    Parameters

    inProgress

    Bool representing if a gesture is in progress

  • Returns TRUE if a gesture is currently in progress.

    Declaration

    Objective-C

    - (BOOL)isGestureInProgress;

    Swift

    func isGestureInProgress() -> Bool
  • Tells the map rendering engine that the animation is currently performed by the user (e.g. with a jumpTo() calls series). It adjusts the engine for the animation use case. In particular, it brings more stability to symbol placement and rendering.

    Declaration

    Objective-C

    - (void)setUserAnimationInProgressForInProgress:(BOOL)inProgress;

    Swift

    func setUserAnimationInProgressForInProgress(_ inProgress: Bool)

    Parameters

    inProgress

    Bool representing if user animation is in progress

  • Returns TRUE if user animation is currently in progress.

    Declaration

    Objective-C

    - (BOOL)isUserAnimationInProgress;

    Swift

    func isUserAnimationInProgress() -> Bool
  • When loading a map, if PrefetchZoomDelta is set to any number greater than 0, the map will first request a tile at zoom level lower than zoom - delta, with requested zoom level a multiple of delta, in an attempt to display a full map at lower resolution as quick as possible.

    Declaration

    Objective-C

    - (void)setPrefetchZoomDeltaForDelta:(uint8_t)delta;

    Swift

    func setPrefetchZoomDeltaForDelta(_ delta: UInt8)

    Parameters

    delta

    The new prefetch zoom delta

  • Returns the map’s prefetch zoom delta.

    Declaration

    Objective-C

    - (uint8_t)getPrefetchZoomDelta;

    Swift

    func getPrefetchZoomDelta() -> UInt8
  • Sets the north orientation mode.

    Declaration

    Objective-C

    - (void)setNorthOrientationForOrientation:(MBMNorthOrientation)orientation;

    Swift

    func setNorthOrientationFor(_ orientation: NorthOrientation)
  • Sets the map constrain mode.

    Declaration

    Objective-C

    - (void)setConstrainModeForMode:(MBMConstrainMode)mode;

    Swift

    func setConstrainModeFor(_ mode: ConstrainMode)
  • Sets the viewport mode.

    Declaration

    Objective-C

    - (void)setViewportModeForMode:(MBMViewportMode)mode;

    Swift

    func setViewportModeFor(_ mode: ViewportMode)
  • Returns the map’s options

    Declaration

    Objective-C

    - (nonnull MBMMapOptions *)getMapOptions;

    Swift

    func getOptions() -> MBMMapOptions
  • Returns the map’s debug options.

    Declaration

    Objective-C

    - (nonnull NSArray<NSNumber *> *)getDebug;

    Swift

    func getDebug() -> [NSNumber]
  • Sets the map’s debug options and enables debug mode based on the passed value.

    Declaration

    Objective-C

    - (void)setDebugForDebugOptions:(nonnull NSArray<NSNumber *> *)debugOptions
                              value:(BOOL)value;

    Swift

    func setDebugForDebugOptions(_ debugOptions: [NSNumber], value: Bool)
  • Returns true when the map is completely rendered, false otherwise. A partially rendered map ranges from nothing rendered at all to only labels missing.

    Declaration

    Objective-C

    - (BOOL)isMapLoaded;

    Swift

    func isMapLoaded() -> Bool
  • Updates the state map of a feature within a style source.

    Update entries in the state map of a given feature within a style source. Only entries listed in the \p state map will be updated. An entry in the feature state map that is not listed in \p state will retain its previous value.

    Note that updates to feature state are asynchronous, so changes made by this method migth not be immediately visible using getStateFeature().

    Declaration

    Objective-C

    - (void)setFeatureStateForSourceId:(nonnull NSString *)sourceId
                         sourceLayerId:(nullable NSString *)sourceLayerId
                             featureId:(nonnull NSString *)featureId
                                 state:(nonnull id)state;

    Swift

    func setFeatureStateForSourceId(_ sourceId: String, sourceLayerId: String?, featureId: String, state: Any)

    Parameters

    sourceId

    Style source identifier.

    sourceLayerId

    Style source layer identifier (for multi-layer sources such as vector sources).

    featureId

    Identifier of the feature whose state should be updated.

    state

    Map of entries to update with their respective new values.

  • Removes entries from a feature state map.

    Remove a specified entry or all entries from a feature’s state map, depending on the value of \p stateKey.

    Note that updates to feature state are asynchronous, so changes made by this method migth not be immediately visible using getStateFeature().

    Declaration

    Objective-C

    - (void)removeFeatureStateForSourceId:(nonnull NSString *)sourceId
                            sourceLayerId:(nullable NSString *)sourceLayerId
                                featureId:(nonnull NSString *)featureId
                                 stateKey:(nullable NSString *)stateKey;

    Swift

    func removeFeatureState(forSourceId sourceId: String, sourceLayerId: String?, featureId: String, stateKey: String?)

    Parameters

    sourceId

    Style source identifier.

    sourceLayerId

    Style source layer identifier (for multi-layer sources such as vector sources).

    featureId

    Identifier of the feature whose state should be removed.

    stateKey

    Key of the entry to remove. If empty, the entire state is removed.

  • Reduces memory use. Useful to call when the application gets paused or sent to background.

    Declaration

    Objective-C

    - (void)reduceMemoryUse;

    Swift

    func reduceMemoryUse()
  • Gets the resource options for the map.

    All optional fields of the retuned object are initialized with the actual values.

    Note that result of this method is different from the ResourceOptions that were provided to the map’s constructor.

    Declaration

    Objective-C

    - (nonnull MBMResourceOptions *)getResourceOptions;

    Swift

    func getResourceOptions() -> MBMResourceOptions

    Return Value

    ResourceOptions for the map.

  • Gets elevation for the given coordinate. Note: Elevation is only available for the visible region on the screen.

    Declaration

    Objective-C

    - (nullable NSNumber *)getElevationForCoordinate:
        (CLLocationCoordinate2D)coordinate;

    Swift

    func getElevationFor(_ coordinate: CLLocationCoordinate2D) -> NSNumber?

    Parameters

    coordinate

    defined as longitude-latitude pair.

    Return Value

    Elevation (in meters) multiplied by current terrain exaggeration, or empty if elevation for the coordinate is not available.

  • Enables or disables the experimental render cache feature.

    Render cache is an experimental feature aiming to reduce resource usage of map rendering by caching intermediate rendering results of tiles into specific cache textures for reuse between frames. Performance benefit of the cache depends on the style as not all layers are cacheable due to e.g. viewport aligned features. Render cache always prefers quality over performance.

    Declaration

    Objective-C

    - (void)setRenderCacheOptionsForOptions:
        (nonnull MBMRenderCacheOptions *)options;

    Swift

    func setRenderCacheOptionsFor(_ options: MBMRenderCacheOptions)

    Parameters

    options

    Options defining the render cache behavior

  • Declaration

    Objective-C

    - (nonnull MBMRenderCacheOptions *)getRenderCacheOptions;

    Swift

    func getRenderCacheOptions() -> MBMRenderCacheOptions

    Return Value

    Size of the render cache in megabytes. Returned value is zero if the feature is disabled.

  • Undocumented

    Declaration

    Objective-C

    - (void)queryRenderedFeaturesForShape:(nonnull NSArray<MBMScreenCoordinate *> *)shape
                                  options:(nonnull MBMRenderedQueryOptions *)options
                                 callback:(nonnull MBMQueryFeaturesCallback)callback;

    Swift

    func queryRenderedFeatures(forShape shape: [MBMScreenCoordinate], options: MBMRenderedQueryOptions, callback: @escaping QueryFeaturesCallback)
  • Undocumented

    Declaration

    Objective-C

    - (void)queryRenderedFeaturesForBox:(nonnull MBMScreenBox *)box
                                options:(nonnull MBMRenderedQueryOptions *)options
                               callback:(nonnull MBMQueryFeaturesCallback)callback;

    Swift

    func queryRenderedFeatures(for box: MBMScreenBox, options: MBMRenderedQueryOptions, callback: @escaping QueryFeaturesCallback)
  • Undocumented

    Declaration

    Objective-C

    - (void)queryRenderedFeaturesForPixel:(nonnull MBMScreenCoordinate *)pixel
                                  options:(nonnull MBMRenderedQueryOptions *)options
                                 callback:(nonnull MBMQueryFeaturesCallback)callback;

    Swift

    func queryRenderedFeatures(forPixel pixel: MBMScreenCoordinate, options: MBMRenderedQueryOptions, callback: @escaping QueryFeaturesCallback)
  • Undocumented

    Declaration

    Objective-C

    - (void)querySourceFeaturesForSourceId:(nonnull NSString *)sourceId
                                   options:(nonnull MBMSourceQueryOptions *)options
                                  callback:(nonnull MBMQueryFeaturesCallback)callback;

    Swift

    func querySourceFeatures(forSourceId sourceId: String, options: MBMSourceQueryOptions, callback: @escaping QueryFeaturesCallback)
  • Undocumented

    Declaration

    Objective-C

    - (void)queryFeatureExtensionsForSourceIdentifier:(nonnull NSString *)sourceIdentifier
                                              feature:(nonnull MBXFeature *)feature
                                            extension:(nonnull NSString *)extension
                                       extensionField:(nonnull NSString *)extensionField
                                                 args:(nullable NSDictionary<NSString *, id> *)args
                                             callback:(nonnull MBMQueryFeatureExtensionCallback)callback;

    Swift

    func queryFeatureExtensions(forSourceIdentifier sourceIdentifier: String, feature: MBXFeature, extension: String, extensionField: String, args: [String : Any]?, callback: @escaping QueryFeatureExtensionCallback)
  • Undocumented

    Declaration

    Objective-C

    - (void)getFeatureStateForSourceId:(nonnull NSString *)sourceId
                         sourceLayerId:(nullable NSString *)sourceLayerId
                             featureId:(nonnull NSString *)featureId
                              callback:(nonnull MBMQueryFeatureStateCallback)callback;

    Swift

    func getFeatureState(forSourceId sourceId: String, sourceLayerId: String?, featureId: String, callback: @escaping QueryFeatureStateCallback)