MapProjectionDelegate

Definition of a map projection delegate.

interface MapProjectionDelegate

Functions

cameraForCoordinateBounds
Link copied to clipboard

Convert to a camera options from a given LatLngBounds, padding, bearing and pitch values.

In order for this method to produce correct results MapView must be already measured and inflated to have correct width and height values. Calling this method in Activity.onCreate will lead to incorrect results.

abstract fun cameraForCoordinateBounds(coordinateBounds: CoordinateBounds, padding: EdgeInsets, bearing: Double?, pitch: Double?): CameraOptions
cameraForCoordinates
Link copied to clipboard

Convenience method that returns the camera options object for given arguments

In order for this method to produce correct results MapView must be already measured and inflated to have correct width and height values. Calling this method in Activity.onCreate will lead to incorrect results.

Returns the camera options object for given arguments with zoom adjusted to fit \p coordinates into \p box, so that coordinates on the left, top and right of \p camera.center fit into \p box. Returns the provided camera options object unchanged upon error.

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

Convert to a camera options from a given list of points, padding, bearing and pitch values.

In order for this method to produce correct results MapView must be already measured and inflated to have correct width and height values. Calling this method in Activity.onCreate will lead to incorrect results.

abstract fun cameraForCoordinates(coordinates: List<Point>, padding: EdgeInsets, bearing: Double?, pitch: Double?): CameraOptions
cameraForGeometry
Link copied to clipboard

Convert to a camera options from a given geometry, padding, bearing and pitch values.

In order for this method to produce correct results MapView must be already measured and inflated to have correct width and height values. Calling this method in Activity.onCreate will lead to incorrect results.

abstract fun cameraForGeometry(geometry: Geometry, padding: EdgeInsets, bearing: Double?, pitch: Double?): CameraOptions
coordinateBoundsForCamera
Link copied to clipboard

Convert to a LatLngBounds from a given camera options.

In order for this method to produce correct results MapView must be already measured and inflated to have correct width and height values. Calling this method in Activity.onCreate will lead to incorrect results.

abstract fun coordinateBoundsForCamera(cameraOptions: CameraOptions): CoordinateBounds
coordinateBoundsZoomForCamera
Link copied to clipboard

Returns the coordinate bounds and zoom for a given camera.

In order for this method to produce correct results MapView must be already measured and inflated to have correct width and height values. Calling this method in Activity.onCreate will lead to incorrect results.

Note that if the given camera shows the antimeridian, the returned wrapped bounds might not represent the minimum bounding box.

See also {@link #coordinateBoundsZoomForCameraUnwrapped}

abstract fun coordinateBoundsZoomForCamera(cameraOptions: CameraOptions): CoordinateBoundsZoom
coordinateBoundsZoomForCameraUnwrapped
Link copied to clipboard

Returns the unwrapped coordinate bounds and zoom for a given camera.

In order for this method to produce correct results MapView must be already measured and inflated to have correct width and height values. Calling this method in Activity.onCreate will lead to incorrect results.

This method is particularly useful, if the camera shows the antimeridian.

abstract fun coordinateBoundsZoomForCameraUnwrapped(cameraOptions: CameraOptions): CoordinateBoundsZoom
coordinateForPixel
Link copied to clipboard

Calculate a geographical coordinate(i.e., longitude-latitude pair) that corresponds to a screen coordinate.

The screen coordinate is in MapOptions.size platform pixels relative to the top left of the map (not of the whole screen).

Map must be fully loaded for getting an altitude-compliant result if using 3D terrain.

abstract fun coordinateForPixel(screenCoordinate: ScreenCoordinate): Point
coordinateForProjectedMeters
Link copied to clipboard

Calculate a longitude-latitude pair for a Spherical Mercator projected meters.

abstract fun coordinateForProjectedMeters(projectedMeters: ProjectedMeters): Point
coordinatesForPixels
Link copied to clipboard

Calculate geographical coordinates(i.e., longitude-latitude pair) that corresponds to screen coordinates.

The screen coordinates are in MapOptions.size platform pixels relative to the top left of the map (not of the whole screen).

Map must be fully loaded for getting an altitude-compliant result if using 3D terrain.

abstract fun coordinatesForPixels(pixels: List<ScreenCoordinate>): List<Point>
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
getMetersPerPixelAtLatitude
Link copied to clipboard

Calculate distance spanned by one pixel at the specified latitude at current zoom level.

abstract fun getMetersPerPixelAtLatitude(latitude: Double): Double

Calculate distance spanned by one pixel at the specified latitude and zoom level.

abstract fun getMetersPerPixelAtLatitude(latitude: Double, zoom: Double): Double
hashCode
Link copied to clipboard
open override fun hashCode(): Int
pixelForCoordinate
Link copied to clipboard

Calculate a screen coordinate that corresponds to a geographical coordinate (i.e., longitude-latitude pair).

The screen coordinate is in MapOptions.size platform pixels relative to the top left of the map (not of the whole screen).

Map must be fully loaded for getting an altitude-compliant result if using 3D terrain.

abstract fun pixelForCoordinate(point: Point): ScreenCoordinate
pixelsForCoordinates
Link copied to clipboard

Calculate screen coordinates that corresponds to geographical coordinates (i.e., longitude-latitude pair).

The screen coordinates are in MapOptions.size platform pixels relative to the top left of the map (not of the whole screen).

Map must be fully loaded for getting an altitude-compliant result if using 3D terrain.

abstract fun pixelsForCoordinates(coordinates: List<Point>): List<ScreenCoordinate>
project
Link copied to clipboard

Calculate a point on the map in Mercator Projection for a given coordinate at the specified zoom scale.

abstract fun project(point: Point, zoomScale: Double): MercatorCoordinate
projectedMetersForCoordinate
Link copied to clipboard

Calculate Spherical Mercator ProjectedMeters coordinates.

abstract fun projectedMetersForCoordinate(point: Point): ProjectedMeters
toString
Link copied to clipboard
open override fun toString(): String
unproject
Link copied to clipboard

Calculate a coordinate for a given point on the map in Mercator Projection.

abstract fun unproject(coordinate: MercatorCoordinate, zoomScale: Double): Point

Inheritors

MapboxMap
Link copied to clipboard