-
Convenience method that returns the camera options object for given arguments
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?) -> MBMCameraOptions
Parameters
bounds
The coordinate bounds of the map
padding
The edge padding of the map
bearing
The bearing of the map
pitch
The pitch of the map
Return Value
Returns the camera options object representing the provided params
-
Convenience method that returns the camera options object for given arguments
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?) -> MBMCameraOptions
Parameters
coordinates
The coordinates representing the bounds of the map
padding
The edge padding of the map
bearing
The bearing of the map
pitch
The pitch of the map
Return Value
Returns the camera options object representing the provided params
-
Convenience method that adjusts the provided camera options object for given arguments
Returns the provided \p camera with zoom adjusted to fit \p coordinates into \p box, so that coordinates on the left, top and right of the effective camera center at the principal point of the projection (defined by padding) fit into \p box. Returns the provided camera options object unchanged upon error. Note that this method may fail if the principal point of the projection is not inside \p box or if there is no sufficient screen space, defined by principal point and box, to fit the geometry.
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) -> MBMCameraOptions
Parameters
coordinates
The coordinates representing the bounds of the map
box
The box into which \p coordinates should fit
camera
The camera for which zoom should be adjusted. Note that \p camera.center is required.
Return Value
Returns the camera options object with the zoom level adjusted to fit \p coordinates into \p box.
-
Convenience method that returns the camera options object for given arguments
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?) -> MBMCameraOptions
Parameters
geometry
The geometry of the map
padding
The edge padding of the map
bearing
The bearing of the map
pitch
The pitch of the map
Return Value
Returns the camera options object representing the provided params
-
Returns the coordinate bounds for a given camera.
Note that if the given camera shows the antimeridian, the returned wrapped bounds might not represent the minimum bounding box.
Declaration
Objective-C
- (nonnull MBMCoordinateBounds *)coordinateBoundsForCameraForCamera: (nonnull MBMCameraOptions *)camera;
Swift
func coordinateBoundsForCamera(forCamera camera: MBMCameraOptions) -> MBMCoordinateBounds
Parameters
camera
The camera information to use
Return Value
Returns the CoordinateBounds object representing the provided params
-
Returns the coordinate bounds and zoom for a given camera.
Note that if the given camera shows the antimeridian, the returned wrapped bounds might not represent the minimum bounding box. @sa coordinateBoundsZoomForCameraUnwrapped()
Declaration
Objective-C
- (nonnull MBMCoordinateBoundsZoom *)coordinateBoundsZoomForCameraForCamera: (nonnull MBMCameraOptions *)camera;
Swift
func coordinateBoundsZoomForCamera(forCamera camera: MBMCameraOptions) -> MBMCoordinateBoundsZoom
Parameters
camera
The camera information to use
Return Value
Returns the CoordinateBoundsZoom object representing the provided params
-
Returns the unwrapped coordinate bounds and zoom for a given camera.
This method is particularly useful, if the camera shows the antimeridian.
Declaration
Objective-C
- (nonnull MBMCoordinateBoundsZoom *) coordinateBoundsZoomForCameraUnwrappedForCamera: (nonnull MBMCameraOptions *)camera;
Swift
func coordinateBoundsZoomForCameraUnwrapped(forCamera camera: MBMCameraOptions) -> MBMCoordinateBoundsZoom
Parameters
camera
The camera information to use
Return Value
Returns the CoordinateBoundsZoom object representing the provided params
-
Calculates a screen coordinate that corresponds to a geographical coordinate (i.e., longitude-latitude pair).
The screen coordinate is in \link MapOptions#size platform pixels \endlink relative to the top left of the map (not of the whole screen).
Declaration
Objective-C
- (nonnull MBMScreenCoordinate *)pixelForCoordinateForCoordinate: (CLLocationCoordinate2D)coordinate;
Swift
func pixelForCoordinate(for coordinate: CLLocationCoordinate2D) -> MBMScreenCoordinate
Return Value
Returns a screen coordinate on the screen in \link MapOptions#size platform pixels \endlink.
-
Calculates a geographical coordinate(i.e., longitude-latitude pair) that corresponds to a screen coordinate.
The screen coordinate is in \link MapOptions#size platform pixels \endlink relative to the top left of the map (not of the whole screen).
Declaration
Objective-C
- (CLLocationCoordinate2D)coordinateForPixelForPixel: (nonnull MBMScreenCoordinate *)pixel;
Swift
func coordinateForPixel(forPixel pixel: MBMScreenCoordinate) -> CLLocationCoordinate2D
Return Value
Returns a geographical coordinate corresponding to the ScreenCoordinate on the screen.
-
Calculates screen coordinates that corresponds to geographical coordinates (i.e., longitude-latitude pair).
The screen coordinates are in \link MapOptions#size platform pixels \endlink relative to the top left 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]
Return Value
Returns a batch of screen coordinates on the screen in \link MapOptions#size platform pixels \endlink.
-
Calculates geographical coordinates(i.e., longitude-latitude pair) that corresponds to screen coordinates.
The screen coordinates are in \link MapOptions#size platform pixels \endlink relative to the top left 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]
Return Value
Returns a batch of geographical coordinates corresponding to the screen coordinates on the screen.
-
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 CameraOptions will be set, the map may apply constraints resulting in a different CameraState.
Declaration
Objective-C
- (void)setCameraForCameraOptions:(nonnull MBMCameraOptions *)cameraOptions;
Swift
func setCameraFor(_ cameraOptions: MBMCameraOptions)
Parameters
cameraOptions
New camera options
-
Returns the current camera state
Declaration
Objective-C
- (nonnull MBMCameraState *)getCameraState;
Swift
func getCameraState() -> MBMCameraState
-
Sets the map view with the free camera options.
FreeCameraOptions provides more direct access to the underlying camera entity. For backwards compatibility the state set using this API must be representable with
CameraOptions
as 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
camera
The free camera options to 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() -> MBMFreeCameraOptions
Return Value
The current free camera options.
-
Returns the bounds of the map.
Declaration
Objective-C
- (nonnull MBMCameraBounds *)getBounds;
Swift
func getBounds() -> MBMCameraBounds
-
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
point
The pivot coordinate, measured in \link MapOptions#size platform pixels \endlink from top to bottom and from left to right.
-
Calculates target point where camera should move after drag. The method should be called after
dragStart
and beforedragEnd
.Declaration
Objective-C
- (nonnull MBMCameraOptions *) getDragCameraOptionsForFromPoint:(nonnull MBMScreenCoordinate *)fromPoint toPoint:(nonnull MBMScreenCoordinate *)toPoint;
Swift
func getDragCameraOptionsFor(fromPoint: MBMScreenCoordinate, toPoint: MBMScreenCoordinate) -> MBMCameraOptions
Parameters
fromPoint
The point to drag the map from, measured in \link MapOptions#size platform pixels \endlink from top to bottom and from left to right.
Return Value
Returns the camera options object showing 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 *)setBoundsForOptions:(nonnull MBMCameraBoundsOptions *)options __attribute((ns_returns_retained));
Swift
func setBoundsFor(_ options: MBMCameraBoundsOptions) -> MBXExpected