-
Convenience method that returns the
camera optionsobject for given parameters.Declaration
Objective-C
- (nonnull MBMCameraOptions *) cameraForCoordinateBoundsForBounds:(nonnull MBMCoordinateBounds *)bounds padding:(nonnull MBMEdgeInsets *)padding bearing:(nullable NSNumber *)bearing pitch:(nullable NSNumber *)pitch;Swift
func cameraForCoordinateBounds(for bounds: MBMCoordinateBounds, padding: MBMEdgeInsets, bearing: NSNumber?, pitch: NSNumber?) -> MBMCameraOptionsParameters
boundsThe
coordinate boundsof the camera.paddingThe
edge insetsof the camera.bearingThe bearing of the camera.
pitchThe pitch of the camera.
Return Value
The
camera optionsobject representing the provided parameters. -
Convenience method that returns the
camera optionsobject for given parameters.Declaration
Objective-C
- (nonnull MBMCameraOptions *) cameraForCoordinatesForCoordinates: (nonnull NSArray<CLLocation *> *)coordinates padding:(nonnull MBMEdgeInsets *)padding bearing:(nullable NSNumber *)bearing pitch:(nullable NSNumber *)pitch;Swift
func cameraForCoordinates(forCoordinates coordinates: [CLLocation], padding: MBMEdgeInsets, bearing: NSNumber?, pitch: NSNumber?) -> MBMCameraOptionsParameters
coordinatesThe
coordinatesrepresenting the bounds of the camera.paddingThe
edge insetsof the camera.bearingThe bearing of the camera.
pitchThe pitch of the camera.
Return Value
The
camera optionsobject representing the provided parameters. -
Convenience method that adjusts the provided
camera optionsobject for given parameters.Returns the provided
cameraoptions with zoom adjusted to fitcoordinatesinto thebox, so thatcoordinateson the left, top, right, and bottom of the effectivecameracenter at the principal point of the projection (defined bypadding) fit into thebox. Returns the providedcameraoptions object unchanged upon an error.The method fails if the principal point is positioned outside of the
boxor if there is no sufficient screen space, defined by principal point and thebox, to fit the geometry. Additionally, in cases when the principal point is positioned exactly on one of the edges of thebox, any geometry point that spans further than that edge on the same axis cannot possibly be framed and is ignored for zoom level calculation purposes.This API isn’t supported by Globe projection.
Declaration
Objective-C
- (nonnull MBMCameraOptions *) cameraForCoordinatesForCoordinates: (nonnull NSArray<CLLocation *> *)coordinates camera:(nonnull MBMCameraOptions *)camera box:(nonnull MBMScreenBox *)box;Swift
func cameraForCoordinates(forCoordinates coordinates: [CLLocation], camera: MBMCameraOptions, box: MBMScreenBox) -> MBMCameraOptionsParameters
coordinatesThe
coordinatesrepresenting the bounds of the camera.cameraThe
camera optionsfor which zoom should be adjusted. Note that thecamera.center, andcamera.zoom(as fallback) is required.boxThe
screen boxinto whichcoordinatesshould fit.Return Value
The
camera optionsobject with the zoom level adjusted to fitcoordinatesinto thebox. -
Convenience method that returns the
camera optionsobject for given parameters.Declaration
Objective-C
- (nonnull MBMCameraOptions *) cameraForGeometryForGeometry:(nonnull MBXGeometry *)geometry padding:(nonnull MBMEdgeInsets *)padding bearing:(nullable NSNumber *)bearing pitch:(nullable NSNumber *)pitch;Swift
func cameraForGeometry(for geometry: MBXGeometry, padding: MBMEdgeInsets, bearing: NSNumber?, pitch: NSNumber?) -> MBMCameraOptionsParameters
geometryThe
geometryrepresenting the bounds of the camera.paddingThe
edge insetsof the camera.bearingThe bearing of the camera.
pitchThe pitch of the camera.
Return Value
The
camera optionsobject representing the provided parameters. -
Returns the
coordinate boundsfor a given camera.Note that if the given
camerashows the antimeridian, the returned wrappedcoordinate boundsmight not represent the minimum bounding box.Declaration
Objective-C
- (nonnull MBMCoordinateBounds *)coordinateBoundsForCameraForCamera: (nonnull MBMCameraOptions *)camera;Swift
func coordinateBoundsForCamera(forCamera camera: MBMCameraOptions) -> MBMCoordinateBoundsParameters
cameraThe
camera optionsto use for calculatingcoordinate bounds.Return Value
The
coordinate boundsobject representing a givencamera. -
Returns the
coordinate boundsfor a given camera.This method is useful if the
camerashows the antimeridian.Declaration
Objective-C
- (nonnull MBMCoordinateBounds *)coordinateBoundsForCameraUnwrappedForCamera: (nonnull MBMCameraOptions *)camera;Swift
func coordinateBoundsForCameraUnwrapped(forCamera camera: MBMCameraOptions) -> MBMCoordinateBoundsParameters
cameraThe
camera optionsto use for calculatingcoordinate bounds.Return Value
The
coordinate boundsobject representing a givencamera. -
Returns the
coordinate boundsand thezoomfor a givencamera.Note that if the given
camerashows the antimeridian, the returned wrappedcoordinate boundsmight not represent the minimum bounding box.Declaration
Objective-C
- (nonnull MBMCoordinateBoundsZoom *)coordinateBoundsZoomForCameraForCamera: (nonnull MBMCameraOptions *)camera;Swift
func coordinateBoundsZoomForCamera(forCamera camera: MBMCameraOptions) -> MBMCoordinateBoundsZoomParameters
cameraThe
camera optionsto use for calculatingcoordinate boundsandzoom.Return Value
The object representing
coordinate boundsandzoomfor a givencamera. -
Returns the unwrapped
coordinate boundsandzoomfor a givencamera.This method is useful if the
camerashows the antimeridian.Declaration
Objective-C
- (nonnull MBMCoordinateBoundsZoom *) coordinateBoundsZoomForCameraUnwrappedForCamera: (nonnull MBMCameraOptions *)camera;Swift
func coordinateBoundsZoomForCameraUnwrapped(forCamera camera: MBMCameraOptions) -> MBMCoordinateBoundsZoomParameters
cameraThe
camera optionsto use for calculatingcoordinate boundsandzoom.Return Value
The object representing
coordinate boundsandzoomfor a givencamera. -
Calculates a
screen coordinatethat corresponds to a geographical coordinate (i.e., longitude-latitude pair).The
screen coordinateis inplatform pixelsrelative to the top left corner of the map (not of the whole screen).Declaration
Objective-C
- (nonnull MBMScreenCoordinate *)pixelForCoordinateForCoordinate: (CLLocationCoordinate2D)coordinate;Swift
func pixelForCoordinate(for coordinate: CLLocationCoordinate2D) -> MBMScreenCoordinateParameters
coordinateA geographical
coordinateon the map to convert to ascreen coordinate.Return Value
A
screen coordinateon the screen inplatform pixels. -
Calculates a geographical
coordinate(i.e., longitude-latitude pair) that corresponds to ascreen coordinate.The screen coordinate is in
platform pixelsrelative to the top left corner of the map (not of the whole screen).Declaration
Objective-C
- (CLLocationCoordinate2D)coordinateForPixelForPixel: (nonnull MBMScreenCoordinate *)pixel;Swift
func coordinateForPixel(forPixel pixel: MBMScreenCoordinate) -> CLLocationCoordinate2DParameters
pixelA
screen coordinateon the screen inplatform pixels.Return Value
A geographical
coordinatecorresponding to a givenscreen coordinate. -
Calculates
screen coordinatesthat correspond to geographicalcoordinates(i.e., longitude-latitude pairs).The
screen coordinatesare inplatform pixelsrelative to the top left corner of the map (not of the whole screen).Declaration
Objective-C
- (nonnull NSArray<MBMScreenCoordinate *> *)pixelsForCoordinatesForCoordinates: (nonnull NSArray<CLLocation *> *)coordinates;Swift
func pixelsForCoordinates(forCoordinates coordinates: [CLLocation]) -> [MBMScreenCoordinate]Parameters
coordinatesA geographical
coordinateson the map to convert toscreen coordinates.Return Value
A
screen coordinatesinplatform pixelsfor a given geographicalcoordinates. -
Calculates geographical
coordinates(i.e., longitude-latitude pairs) that correspond toscreen coordinates.The screen coordinates are in
platform pixelsrelative to the top left corner of the map (not of the whole screen).Declaration
Objective-C
- (nonnull NSArray<CLLocation *> *)coordinatesForPixelsForPixels: (nonnull NSArray<MBMScreenCoordinate *> *)pixels;Swift
func coordinatesForPixels(forPixels pixels: [MBMScreenCoordinate]) -> [CLLocation]Parameters
pixelsA
screen coordinatesinplatform pixels.Return Value
A
geographical coordinatesthat correspond to a givenscreen coordinates. -
Changes the map view by any combination of center, zoom, bearing, and pitch, without an animated transition. The map will retain its current values for any details not passed via the camera options argument. It is not guaranteed that the provided
camera optionswill be set, the map may apply constraints resulting in a differentcamera state.Declaration
Objective-C
- (void)setCameraForCameraOptions:(nonnull MBMCameraOptions *)cameraOptions;Swift
func setCameraFor(_ cameraOptions: MBMCameraOptions)Parameters
cameraOptionsThe new
camera optionsto be set. -
Returns the current
camera state.Declaration
Objective-C
- (nonnull MBMCameraState *)getCameraState;Swift
func getCameraState() -> MBMCameraStateReturn Value
The current
camera state. -
Sets the map view with the free camera options.
The
free camera optionsprovides more direct access to the underlying camera entity. For backwards compatibility the state set using this API must be representable withcamera optionsas well. Parameters are clamped to a valid range or discarded as invalid if the conversion to the pitch and bearing presentation is ambiguous. For example orientation can be invalid if it leads to the camera being upside down or the quaternion has zero length.Declaration
Objective-C
- (void)setCameraForFreeCameraOptions: (nonnull MBMFreeCameraOptions *)freeCameraOptions;Swift
func setCameraFor(_ freeCameraOptions: MBMFreeCameraOptions)Parameters
freeCameraOptionsThe
free camera optionsto set. -
Gets the map’s current free camera options. After mutation, it should be set back to the map.
Declaration
Objective-C
- (nonnull MBMFreeCameraOptions *)getFreeCameraOptions;Swift
func getFreeCameraOptions() -> MBMFreeCameraOptionsReturn Value
The current
free camera options. -
Returns the
camera boundsof the map.Declaration
Objective-C
- (nonnull MBMCameraBounds *)getBounds;Swift
func getBounds() -> MBMCameraBoundsReturn Value
A
camera boundsof the map. -
Prepares the drag gesture to use the provided screen coordinate as a pivot
point. This function should be called each time when user starts a dragging action (e.g. by clicking on the map). The following dragging will be relative to the pivot.Declaration
Objective-C
- (void)dragStartForPoint:(nonnull MBMScreenCoordinate *)point;Swift
func dragStart(forPoint point: MBMScreenCoordinate)Parameters
pointThe pivot
screen coordinate, measured inplatform pixelsfrom top to bottom and from left to right. -
Calculates target point where camera should move after drag. The method should be called after
dragStartand beforedragEnd.Declaration
Objective-C
- (nonnull MBMCameraOptions *) getDragCameraOptionsForFromPoint:(nonnull MBMScreenCoordinate *)fromPoint toPoint:(nonnull MBMScreenCoordinate *)toPoint;Swift
func getDragCameraOptionsFor(fromPoint: MBMScreenCoordinate, toPoint: MBMScreenCoordinate) -> MBMCameraOptionsParameters
fromPointThe
screen coordinateto drag the map from, measured inplatform pixelsfrom top to bottom and from left to right.toPointThe
screen coordinateto drag the map to, measured inplatform pixelsfrom top to bottom and from left to right.Return Value
The
camera optionsobject showing the end point. -
Ends the ongoing drag gesture. This function should be called always after the user has ended a drag gesture initiated by
dragStart.Declaration
Objective-C
- (void)dragEnd;Swift
func dragEnd() -
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected<NSNull *, NSString *> *)setBoundsForOptions:(nonnull MBMCameraBoundsOptions *)options __attribute((ns_returns_retained));Swift
func setBoundsFor(_ options: MBMCameraBoundsOptions) -> MBXExpected
MBMCameraManager Class Reference