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;
  • Creates the infrastructure needed for rendering the map. It should be called before any call to render method. 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 platform pixels.

  • Gets the size of the map.

    Declaration

    Objective-C

    - (nonnull MBMSize *)getSize;

    Swift

    func getSize() -> MBMSize

    Return Value

    The size of the map in platform pixels.

  • 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

    The boolean value 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

    Return Value

    true if a gesture is currently in progress, false otherwise.

  • Tells the map rendering engine that the animation is currently performed by the user (e.g. with a setCamera 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

    The boolean value 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

    Return Value

    true if a user animation is currently in progress, false otherwise.

  • When loading a map, if prefetch zoom delta 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

    Return Value

    The map’s prefetch zoom delta.

  • 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 options.

    Declaration

    Objective-C

    - (nonnull MBMMapOptions *)getMapOptions;

    Swift

    func getOptions() -> MBMMapOptions

    Return Value

    The map’s map options.

  • Returns the map debug options.

    Declaration

    Objective-C

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

    Swift

    func getDebug() -> [NSNumber]

    Return Value

    An array of map debug options flags currently set to the map.

  • Sets the map 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)

    Parameters

    debugOptions

    An array of map debug options to be set.

    value

    A boolean value representing the state for a given map debug options.

  • 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

    Return Value

    true when the map is completely rendered, false otherwise.

  • Updates the state object of a feature within a style source.

    Update entries in the state object of a given feature within a style source. Only properties of the state object will be updated. A property in the feature state object that is not listed in state will retain its previous value. The properties must be paint properties, layout properties are not supported.

    Note that updates to feature state are asynchronous, so changes made by this method migth not be immediately visible using getStateFeature. And the corresponding source needs to be in use to ensure the feature data it contains can be successfully updated.

    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

    The style source identifier.

    sourceLayerId

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

    featureId

    The feature identifier of the feature whose state should be updated.

    state

    The state object with properties to update with their respective new values.

  • Removes entries from a feature state object.

    Remove a specified property or all property from a feature’s state object, depending on the value of 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

    The style source identifier.

    sourceLayerId

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

    featureId

    The feature identifier of the feature whose state should be removed.

    stateKey

    The key of the property to remove. If null, all feature’s state object properties are 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 resource options that were provided to the map’s constructor.

    Declaration

    Objective-C

    - (nonnull MBMResourceOptions *)getResourceOptions;

    Swift

    func getResourceOptions() -> MBMResourceOptions

    Return Value

    The resource options 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

    The coordinate defined as longitude-latitude pair.

    Return Value

    The 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

    The render cache options defining the render cache behavior.

  • Returns the render cache options used by the map.

    Declaration

    Objective-C

    - (nonnull MBMRenderCacheOptions *)getRenderCacheOptions;

    Swift

    func getRenderCacheOptions() -> MBMRenderCacheOptions

    Return Value

    The render cache options currently used by the map.

  • Undocumented

    Declaration

    Objective-C

    - (nonnull instancetype)initWithClient:(nonnull id<MBMMapClient>)client
                                mapOptions:(nonnull MBMMapOptions *)mapOptions
                           resourceOptions:(nonnull MBMResourceOptions *)resourceOptions;
  • 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

    - (nonnull MBXCancelable *)queryRenderedFeaturesForGeometry:(nonnull MBMRenderedQueryGeometry *)geometry
                                                        options:(nonnull MBMRenderedQueryOptions *)options
                                                       callback:(nonnull MBMQueryFeaturesCallback)callback __attribute((ns_returns_retained)) NS_REFINED_FOR_SWIFT;
  • 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)
  • Undocumented

    Declaration

    Objective-C

    - (void)setMemoryBudgetForMemoryBudget:(nullable MBMMapMemoryBudget *)memoryBudget NS_REFINED_FOR_SWIFT;
  • Undocumented

    Declaration

    Objective-C

    + (void)clearDataForResourceOptions:(nonnull MBMResourceOptions *)resourceOptions
                               callback:(nonnull MBMAsyncOperationResultCallback)callback;

    Swift

    class func clearData(for resourceOptions: MBMResourceOptions, callback: @escaping AsyncOperationResultCallback)
  • Undocumented

    Declaration

    Objective-C

    - (void)setViewAnnotationPositionsUpdateListenerForListener:(nullable id<MBMViewAnnotationPositionsUpdateListener>)listener;
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)addViewAnnotationForIdentifier:(nonnull NSString *)identifier
                                                                          options:(nonnull MBMViewAnnotationOptions *)options __attribute((ns_returns_retained));

    Swift

    func addViewAnnotation(forIdentifier identifier: String, options: MBMViewAnnotationOptions) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)updateViewAnnotationForIdentifier:(nonnull NSString *)identifier
                                                                             options:(nonnull MBMViewAnnotationOptions *)options __attribute((ns_returns_retained));

    Swift

    func updateViewAnnotation(forIdentifier identifier: String, options: MBMViewAnnotationOptions) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<NSNull *, NSString *> *)removeViewAnnotationForIdentifier:(nonnull NSString *)identifier __attribute((ns_returns_retained));

    Swift

    func removeViewAnnotation(forIdentifier identifier: String) -> MBXExpected
  • Undocumented

    Declaration

    Objective-C

    - (nonnull MBXExpected<MBMViewAnnotationOptions *, NSString *> *)getViewAnnotationOptionsForIdentifier:(nonnull NSString *)identifier __attribute((ns_returns_retained));

    Swift

    func getViewAnnotationOptions(forIdentifier identifier: String) -> MBXExpected