MMKMap

@interface MMKMap : NSObject

The object that is used to interact with the map.

Summary

Instance methods

- (nonnull MMKCameraPosition *)cameraPositionWithGeometry:
    (nonnull MMKGeometry *)geometry;

Calculates the camera position that projects the specified geometry into the current focusRect, or the full view if the focusRect is not set

- (nonnull MMKCameraPosition *)
    cameraPositionWithGeometry:(nonnull MMKGeometry *)geometry
                     focusRect:(nonnull MMKScreenRect *)focusRect;

Calculates the camera position that projects the specified geometry into the custom focusRect

- (nonnull MMKCameraPosition *)
    cameraPositionWithGeometry:(nonnull MMKGeometry *)geometry
                       azimuth:(float)azimuth
                          tilt:(float)tilt
                     focusRect:(nullable MMKScreenRect *)focusRect;

- (nonnull MMKVisibleRegion *)visibleRegionWithCameraPosition:
    (nonnull MMKCameraPosition *)cameraPosition;

- (void)moveWithCameraPosition:(nonnull MMKCameraPosition *)cameraPosition
                     animation:(nonnull MMKAnimation *)animation
                cameraCallback:(nullable MMKMapCameraCallback)cameraCallback;

Changes camera position

- (void)moveWithCameraPosition:(nonnull MMKCameraPosition *)cameraPosition;
Immediately changes the camera position

- (void)addInputListenerWithInputListener:
    (nonnull id<MMKMapInputListener>)inputListener;

Adds input listeners

- (void)removeInputListenerWithInputListener:
    (nonnull id<MMKMapInputListener>)inputListener;

Removes input listeners

- (void)addCameraListenerWithCameraListener:
    (nonnull id<MMKMapCameraListener>)cameraListener;

Adds camera listeners

- (void)removeCameraListenerWithCameraListener:
    (nonnull id<MMKMapCameraListener>)cameraListener;

Removes camera listeners

- (void)setMapLoadedListenerWithMapLoadedListener:
    (nullable id<MMKMapLoadedListener>)mapLoadedListener;

Sets a map loaded listener

- (void)addTapListenerWithTapListener:
    (nonnull id<MMKLayersGeoObjectTapListener>)tapListener;

Adds a tap listener that is used to obtain brief geo object info

- (void)removeTapListenerWithTapListener:
    (nonnull id<MMKLayersGeoObjectTapListener>)tapListener;

Removes a tap listener that is used to obtain brief geo object info

- (void)deselectGeoObject;
Resets the currently selected geo object

- (void)selectGeoObjectWithSelectionMetaData:
    (nonnull MMKGeoObjectSelectionMetadata *)selectionMetaData;

Selects a geo object with the specified objectId in the specified layerId

- (BOOL)setMapStyleWithStyle:(nonnull NSString *)style;
Applies JSON style transformations to the map

- (BOOL)setMapStyleWithId:(NSInteger)id style:(nonnull NSString *)style;
Applies JSON style transformations to the map

- (void)resetMapStyles;
Resets all JSON style transformations applied to the map

- (void)set2DModeWithEnable:(BOOL)enable;
Forces the map to be flat

- (nonnull MMKProjection *)projection;
Provides map projection

- (void)wipe;
Erases tiles, caches, etc

- (nonnull MMKLayer *)
    addTileLayerWithLayerId:(nonnull NSString *)layerId
               layerOptions:(nonnull MMKLayerOptions *)layerOptions
       createTileDataSource:
           (nonnull MMKCreateTileDataSource)createTileDataSource;

Adds tile layer

Properties

@property (nonatomic, readonly, nonnull) MMKCameraPosition *cameraPosition;

@property (nonatomic, readonly, nonnull) MMKVisibleRegion *visibleRegion;

@property (nonatomic, readonly, nonnull) MMKCameraBounds *cameraBounds;
Undocumented

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isNightModeEnabled) BOOL nightModeEnabled;

If enabled, night mode will reduce map brightness and improve contrast

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isZoomGesturesEnabled) BOOL zoomGesturesEnabled;

Enable/disable zoom gestures, for example: - pinch - double tap (zoom in) - tap with two fingers (zoom out)

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isScrollGesturesEnabled) BOOL scrollGesturesEnabled;

Enable/disable scroll gestures, such as the pan gesture

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isTiltGesturesEnabled) BOOL tiltGesturesEnabled;

Enable/disable tilt gestures, such as parallel pan with two fingers

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isRotateGesturesEnabled) BOOL rotateGesturesEnabled;

Enable/disable rotation gestures, such as rotation with two fingers

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isFastTapEnabled) BOOL fastTapEnabled;

Removes the 300 ms delay in emitting a tap gesture

@property (nonatomic, assign, unsafe_unretained, readwrite) MMKMapType mapType;
Sets the base map type

@property (nonatomic, readonly, nonnull) MMKMapObjectCollection *mapObjects;

@property (nonatomic, readonly, nonnull) MMKLogo *logo;
Mappable logo object

@property (nonatomic, assign, unsafe_unretained, readwrite, nullable)
    NSNumber *poiLimit;

Limits the number of visible basemap POIs

@property (nonatomic, assign, unsafe_unretained, readwrite) MMKMapMode mode;
Selects one of predefined map style modes optimized for particular use case(transit, driving, etc)

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isHdModeEnabled) BOOL hdModeEnabled;

Enables hd mode of displayed content

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isAwesomeModelsEnabled) BOOL awesomeModelsEnabled;

Enables rich textured 3d content on basemap

@property (nonatomic, readonly, getter=isValid) BOOL valid;
Tells if this object is valid or no

Instance methods

cameraPositionWithGeometry:

- (nonnull MMKCameraPosition *)cameraPositionWithGeometry:
    (nonnull MMKGeometry *)geometry;

Calculates the camera position that projects the specified geometry into the current focusRect, or the full view if the focusRect is not set.


cameraPositionWithGeometry:focusRect:

- (nonnull MMKCameraPosition *)
    cameraPositionWithGeometry:(nonnull MMKGeometry *)geometry
                     focusRect:(nonnull MMKScreenRect *)focusRect;

Calculates the camera position that projects the specified geometry into the custom focusRect.


cameraPositionWithGeometry:azimuth:tilt:focusRect:

- (nonnull MMKCameraPosition *)
    cameraPositionWithGeometry:(nonnull MMKGeometry *)geometry
                       azimuth:(float)azimuth
                          tilt:(float)tilt
                     focusRect:(nullable MMKScreenRect *)focusRect;

Returns

Camera position that projects the specified geometry into the
custom focusRect, with custom azimuth and tilt camera parameters. If
focus rect is not provided, current focus rect is used.


visibleRegionWithCameraPosition:

- (nonnull MMKVisibleRegion *)visibleRegionWithCameraPosition:
    (nonnull MMKCameraPosition *)cameraPosition;

Returns

The map region that is visible from the given camera
position. Region IS bounded by latitude limits [-90, 90] and IS NOT
bounded by longitude limits [-180, 180]. If the longitude exceeds its
limits, we see the world's edge and another instance of the world
beyond this edge.


moveWithCameraPosition:animation:cameraCallback:

- (void)moveWithCameraPosition:(nonnull MMKCameraPosition *)cameraPosition
                     animation:(nonnull MMKAnimation *)animation
                cameraCallback:(nullable MMKMapCameraCallback)cameraCallback;

Changes camera position. Can cancel a previous unfinished movement.

@see mapkit.Animation for more details. - parameter: cameraCallback A function that takes the bool argument marking the camera action complete. Invoked when:

  • A camera action is cancelled (for example, as a result of a subsequent request for camera movement), passing false as an argument.
  • A camera action finished successfully, passing true as an argument.

Parameters

animation

Required. Defines animation parameters.

cameraCallback

A function that takes the bool argument marking the camera action complete. Invoked when: A camera action is cancelled (for example, as a result of a subsequent request for camera movement), passing false as an argument. A camera action finished successfully, passing true as an argument.


moveWithCameraPosition:

- (void)moveWithCameraPosition:(nonnull MMKCameraPosition *)cameraPosition;

Immediately changes the camera position. Can cancel a previous unfinished movement.


addInputListenerWithInputListener:

- (void)addInputListenerWithInputListener:
    (nonnull id<MMKMapInputListener>)inputListener;

Adds input listeners.

The class does not retain the object in the 'inputListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


removeInputListenerWithInputListener:

- (void)removeInputListenerWithInputListener:
    (nonnull id<MMKMapInputListener>)inputListener;

Removes input listeners.


addCameraListenerWithCameraListener:

- (void)addCameraListenerWithCameraListener:
    (nonnull id<MMKMapCameraListener>)cameraListener;

Adds camera listeners.

The class does not retain the object in the 'cameraListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


removeCameraListenerWithCameraListener:

- (void)removeCameraListenerWithCameraListener:
    (nonnull id<MMKMapCameraListener>)cameraListener;

Removes camera listeners.


setMapLoadedListenerWithMapLoadedListener:

- (void)setMapLoadedListenerWithMapLoadedListener:
    (nullable id<MMKMapLoadedListener>)mapLoadedListener;

Sets a map loaded listener.

The class does not retain the object in the 'mapLoadedListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


addTapListenerWithTapListener:

- (void)addTapListenerWithTapListener:
    (nonnull id<MMKLayersGeoObjectTapListener>)tapListener;

Adds a tap listener that is used to obtain brief geo object info.

The class does not retain the object in the 'tapListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


removeTapListenerWithTapListener:

- (void)removeTapListenerWithTapListener:
    (nonnull id<MMKLayersGeoObjectTapListener>)tapListener;

Removes a tap listener that is used to obtain brief geo object info.


deselectGeoObject

- (void)deselectGeoObject;

Resets the currently selected geo object.


selectGeoObjectWithSelectionMetaData:

- (void)selectGeoObjectWithSelectionMetaData:
    (nonnull MMKGeoObjectSelectionMetadata *)selectionMetaData;

Selects a geo object with the specified objectId in the specified layerId. If the object is not currently on the screen, it is selected anyway, but the user will not actually see that. You need to move the camera in addition to this call to be sure that the selected object is visible for the user. GeoObjectSelectionMetadata can be extracted from the geo object's metadata container when the user taps on a geo object.


setMapStyleWithStyle:

- (BOOL)setMapStyleWithStyle:(nonnull NSString *)style;

Applies JSON style transformations to the map. Same as setMapStyle(0, style). Affects VectorMap and Hybrid map types. Set to empty string to clear previous styling. Returns true if the style was successfully parsed, and false otherwise. If the returned value is false, the current map style remains unchanged.


setMapStyleWithId:style:

- (BOOL)setMapStyleWithId:(NSInteger)id style:(nonnull NSString *)style;

Applies JSON style transformations to the map. Replaces previous styling with the specified ID (if such exists). Stylings are applied in an ascending order. Affects VectorMap and Hybrid map types. Set to empty string to clear previous styling with the specified ID. Returns true if the style was successfully parsed, and false otherwise. If the returned value is false, the current map style remains unchanged.


resetMapStyles

- (void)resetMapStyles;

Resets all JSON style transformations applied to the map.


set2DModeWithEnable:

- (void)set2DModeWithEnable:(BOOL)enable;

Forces the map to be flat. true - All loaded tiles start showing the "flatten out" animation; all new tiles do not start 3D animation. false - All tiles start showing the "rise up" animation.


projection

- (nonnull MMKProjection *)projection;

Provides map projection


wipe

- (void)wipe;

Erases tiles, caches, etc. Does not trigger the next frame generation.


addTileLayerWithLayerId:layerOptions:createTileDataSource:

- (nonnull MMKLayer *)
    addTileLayerWithLayerId:(nonnull NSString *)layerId
               layerOptions:(nonnull MMKLayerOptions *)layerOptions
       createTileDataSource:
           (nonnull MMKCreateTileDataSource)createTileDataSource;

Adds tile layer.


Properties

cameraPosition

@property (nonatomic, readonly, nonnull) MMKCameraPosition *cameraPosition;

Returns

Current camera position. Target position must be within
latitude [-90, 90] and longitude [-180, 180].


visibleRegion

@property (nonatomic, readonly, nonnull) MMKVisibleRegion *visibleRegion;

Returns

The map region that is currently visible. Region IS bounded
by latitude limits [-90, 90] and IS NOT bounded by longitude limits
[-180, 180]. If the longitude exceeds its limits, we see the world's
edge and another instance of the world beyond this edge.


cameraBounds

@property (nonatomic, readonly, nonnull) MMKCameraBounds *cameraBounds;

Undocumented


nightModeEnabled

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isNightModeEnabled) BOOL nightModeEnabled;

If enabled, night mode will reduce map brightness and improve contrast.


zoomGesturesEnabled

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isZoomGesturesEnabled) BOOL zoomGesturesEnabled;

Enable/disable zoom gestures, for example: - pinch - double tap (zoom in) - tap with two fingers (zoom out)


scrollGesturesEnabled

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isScrollGesturesEnabled) BOOL scrollGesturesEnabled;

Enable/disable scroll gestures, such as the pan gesture.


tiltGesturesEnabled

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isTiltGesturesEnabled) BOOL tiltGesturesEnabled;

Enable/disable tilt gestures, such as parallel pan with two fingers.


rotateGesturesEnabled

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isRotateGesturesEnabled) BOOL rotateGesturesEnabled;

Enable/disable rotation gestures, such as rotation with two fingers.


fastTapEnabled

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isFastTapEnabled) BOOL fastTapEnabled;

Removes the 300 ms delay in emitting a tap gesture. However, a double-tap will emit a tap gesture along with a double-tap.


mapType

@property (nonatomic, assign, unsafe_unretained, readwrite) MMKMapType mapType;

Sets the base map type.


mapObjects

@property (nonatomic, readonly, nonnull) MMKMapObjectCollection *mapObjects;

Returns

List of map objects associated with the map. The layerId for
this collection can be retrieved via LayerIds.mapObjectsLayerId


@property (nonatomic, readonly, nonnull) MMKLogo *logo;

Mappable logo object.


poiLimit

@property (nonatomic, assign, unsafe_unretained, readwrite, nullable)
    NSNumber *poiLimit;

Limits the number of visible basemap POIs.

Optional property, can be nil.


mode

@property (nonatomic, assign, unsafe_unretained, readwrite) MMKMapMode mode;

Selects one of predefined map style modes optimized for particular use case(transit, driving, etc). Resets json styles set with setMapStyle. MapMode.Map by deafult.


hdModeEnabled

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isHdModeEnabled) BOOL hdModeEnabled;

Enables hd mode of displayed content


awesomeModelsEnabled

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isAwesomeModelsEnabled) BOOL awesomeModelsEnabled;

Enables rich textured 3d content on basemap.


valid

@property (nonatomic, readonly, getter=isValid) BOOL valid;

Tells if this object is valid or no. Any method called on an invalid object will throw an exception. The object becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.