cameraForCoordinates

open override fun cameraForCoordinates(coordinates: List<Point>, camera: CameraOptions, coordinatesPadding: EdgeInsets?, maxZoom: Double?, offset: ScreenCoordinate?): CameraOptions

Convenience method that returns the CameraOptions object for given parameters.

Important: if the render thread did not yet calculate the size of the map (due to initialization or map resizing) - empty CameraOptions will be returned. Emptiness could be checked with CameraOptions.isEmpty. Consider using asynchronous overloaded method: `` fun cameraForCoordinates( coordinates: List<Point>, camera: CameraOptions, coordinatesPadding: EdgeInsets?, maxZoom: Double?, offset: ScreenCoordinate?, result: (CameraOptions) -> Unit ) `` Consider using this synchronous method ONLY when you are absolutely sure that map is fully ready.

Return

The CameraOptions object representing the provided parameters if the map size was calculated and empty CameraOptions otherwise, see CameraOptions.isEmpty. Also empty CameraOptions are returned in case of an internal error.

Parameters

coordinates

The coordinates representing the bounds of the camera.

camera

The CameraOptions which will be applied before calculating the camera for the coordinates. If any of the fields in CameraOptions are not provided then the current value from the map for that field will be used.

coordinatesPadding

The amount of padding in pixels to add to the given coordinates. Note: This padding is not applied to the map but to the coordinates provided. If you want to apply padding to the map use param camera.

maxZoom

The maximum zoom level allowed in the returned camera options.

offset

The center of the given bounds relative to map center in pixels.


open override fun cameraForCoordinates(coordinates: List<Point>, camera: CameraOptions, coordinatesPadding: EdgeInsets?, maxZoom: Double?, offset: ScreenCoordinate?, result: (CameraOptions) -> Unit)

Convenience method that returns the CameraOptions object for given parameters.

Parameters

coordinates

The coordinates representing the bounds of the camera.

camera

The CameraOptions which will be applied before calculating the camera for the coordinates. If any of the fields in CameraOptions are not provided then the current value from the map for that field will be used.

coordinatesPadding

The amount of padding in pixels to add to the given coordinates. Note: This padding is not applied to the map but to the coordinates provided. If you want to apply padding to the map use param camera.

maxZoom

The maximum zoom level allowed in the returned camera options.

offset

The center of the given bounds relative to map center in pixels.

result

Callback returning the CameraOptions object representing the provided parameters. Those CameraOptions always take into account actual MapView size and may return empty (CameraOptions.isEmpty) options only if an internal error has occurred.


open override fun cameraForCoordinates(coordinates: List<Point>, coordinatesPadding: EdgeInsets?, bearing: Double?, pitch: Double?): CameraOptions

Deprecated

Deprecated

Replace with

cameraForCoordinates(coordinates, camera, coordinatesPadding, maxZoom, offset, result)

Convenience method that returns the CameraOptions object for given parameters. This method takes into account the current map padding in addition to the padding provided in parameters.

Return

The CameraOptions object representing the provided parameters. Padding is absent in the returned CameraOptions as the zoom level already accounts for the padding.

Parameters

coordinates

The coordinates representing the bounds of the camera.

coordinatesPadding

The amount of padding in pixels to add to the given coordinates.

bearing

The bearing of the camera.

pitch

The pitch of the camera.


open override fun cameraForCoordinates(coordinates: List<Point>, camera: CameraOptions, box: ScreenBox): CameraOptions

Deprecated

Deprecated

Replace with

cameraForCoordinates(coordinates, camera, coordinatesPadding, maxZoom, offset, result)

Convenience method that adjusts the provided CameraOptions object for given parameters.

Returns the provided camera options with zoom adjusted to fit coordinates into the box, so that coordinates on the left, top, right, and bottom of the effective camera center at the principal point of the projection (defined by padding) fit into the box. Returns the provided camera options object unchanged upon an error.

The method fails if the principal point is positioned outside of the box or if there is no sufficient screen space, defined by principal point and the box, to fit the geometry. Additionally, in cases when the principal point is positioned exactly on one of the edges of the box, 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.

Return

The CameraOptions object with the zoom level adjusted to fit coordinates into the box.

Parameters

coordinates

The coordinates representing the bounds of the camera.

camera

The CameraOptions for which zoom should be adjusted. Note that the camera.center, and camera.zoom (as fallback) is required.

box

The ScreenBox into which coordinates should fit.