method
AttributeValue(value)
calcPosition(camera,geometry,screenArea,tilt,bearing,size)
fun calcPosition(
camera: BaseCamera,
geometry: Geometry,
screenArea: Padding? = null,
tilt: Tilt? = null,
bearing: Bearing? = null,
size: ScreenSize? = null
): CameraPosition
Calculates the camera position so that a geometric object on the map is completely fit into the screen area defined
by the screen_area parameter.<p>If the original camera settings do not need to be changed,
then the camera copied through IBaseCamera::clone() can be used.</p>
Parameters
camera
The camera used to calculate the position.
geometry
A geometric object to fit into the screen area specified by the screen_area parameter.
screenArea
Area of the screen to fit the geometry into.
If not specified, the camera's padding is used for calculation.
tilt
Map tilt.
If not specified, the current camera tilt is used.
bearing
Map rotation.
If not specified, then the current camera rotation is used.
size
The size of the viewing area.
If not specified, the value from ICamera::size() is used.
Returns
calcPosition(camera,objects,screenArea,tilt,bearing,size)
fun calcPosition(
camera: BaseCamera,
objects: List<SimpleMapObject>,
screenArea: Padding? = null,
tilt: Tilt? = null,
bearing: Bearing? = null,
size: ScreenSize? = null
): CameraPosition
Calculation of the camera position so that the map objects are completely inscribed in the screen area
specified by the screen_area parameter.
Parameters
camera
The camera used to calculate the position.
objects
Map objects to fit into the screen area specified by the screen_area parameter.
screenArea
Area of the screen to fit into the geometry
If not specified, the camera's padding is used for calculation.
tilt
Map tilt.
If not specified, the current camera tilt is used.
bearing
Map rotation.
If not specified, then the current camera rotation is used.
size
The size of the viewing area.
If not specified, the value from ICamera::size() is used.
Returns
Color(red,green,blue,alpha)
fun Color(
red: Int,
green: Int,
blue: Int,
alpha: Int = 255
): Color
Parameters
createRasterTileDataSource(context,sublayerName,urlTemplate)
fun createRasterTileDataSource(
context: Context,
sublayerName: String,
urlTemplate: String
): Source
Create a source that obtains raster tiles.
Parameters
context
Context.
sublayerName
The name that is used when generating objects.\nThis name must be specified in the styles as filter condition in the raster layer for the db_sublayer attribute.\nExample: ["match", <a href="#">get, db_sublayer</a>, <a href="#">NAME</a>, true, false]\nFor more information, see the specification: https://docs.2gis.com/en/mapgl/stylespecification
urlTemplate
The URL template for requesting tiles must contain the substrings {x}, {y} and {z}.
When they are substituted with numeric values, they form a valid URL
to which the request for the tile data is sent.
Returns
createRawMyLocationController()
fun createRawMyLocationController(): MyLocationController
Uses platform data. Geolocation marker
coordinates and orientation change instantly when data is received.
Returns
createSmoothMyLocationController()
fun createSmoothMyLocationController(): MyLocationController
Uses map data. Geolocation marker
coordinates and orientation change smoothly. When using tracking mode, marker changes
are synchronized with the camera position changes.
Returns
createStyleZoomToTiltRelation(points)
fun createStyleZoomToTiltRelation(points: Map): StyleZoomToTiltRelation
Creating a dependency of the camera tilt angle on the style zoom level.
Parameters
points
Points on which the dependency is built.
Returns
StyleZoomToTiltRelationDependency of the camera tilt angle on the style zoom level, if the dependency could
not be created - throw an exception.
<p>The dependency must be a monotonic continuous function.
If a dependency that does not satisfy the conditions is specified by the points, then the function throws an exception .
A dependency, similar to 2GIS, can be specified by a sequence of points <a href="#">17,0,19,15,20,25</a> in map mode
and <a href="# ">15,0,16,34,17,48</a> in navigator mode.
Let's get the camera tilt angle T for the Z style zoom level, so that Z0
<
= Z
<
Z1 and
dependency is given by the points <a href="#">Z0,T0,Z1,T1</a>. Then the desired value is calculated by the formula
T = T0 + k * (T1 - T0), where k = (Z - Z0) / (Z1 - Z0).If Z
<
Z0, then T = T0. If Z >= Z1, then T = T1.</p>
GeoPoint(latitude,longitude)
fun GeoPoint(latitude: Double, longitude: Double): GeoPoint
Parameters
GeoPointWithElevation(latitude,longitude,elevation)
fun GeoPointWithElevation(
latitude: Double,
longitude: Double,
elevation: Elevation = Elevation(0.0f)
): GeoPointWithElevation
Parameters
GeoPointWithElevation(point,elevation)
fun GeoPointWithElevation(point: GeoPoint, elevation: Elevation = Elevation(0.0f)): GeoPointWithElevation
Parameters
getHttpCacheManager(context)
fun getHttpCacheManager(context: Context): HttpCacheManager?
HTTP cache management interface. Null, if HTTP cache is not used.
Parameters
getInstructionManeuver(extraInstructionInfo)
fun getInstructionManeuver(extraInstructionInfo: ExtraInstructionInfo): InstructionManeuver
Get the maneuver to be performed to move along the route.
Parameters
getLanesControlImages(laneSign,maxCount,ignoreActiveManeuver)
fun getLanesControlImages(
laneSign: RouteLaneSign,
maxCount: Int,
ignoreActiveManeuver: Boolean
): List<LanesControlImage>
Get a list of images to display in the lanes control.
The number of images (excluding separators and ellipsis) is limited by maxCount,
if it is exceeded, images from one or both sides are cropped so that
there are as many images of active maneuvers as possible. On the side where the deletion occurred,
an ellipsis is displayed.
If the ignoreActiveManeuver parameter is set to true, the active maneuver is ignored,
and an image corresponding to all allowed directions of movement is returned.
Parameters
getLocaleManager(context)
fun getLocaleManager(context: Context): LocaleManager
Application locale management interface.
Parameters
getPackageManager(context)
fun getPackageManager(context: Context): PackageManager
Getting an object for working with packages from the context.
Parameters
getRoadMacroGraph(context)
fun getRoadMacroGraph(context: Context): RoadMacroGraph
Getting an object to manage the global road graph from the context.
Parameters
getSystemMemoryManager(context)
fun getSystemMemoryManager(context: Context): SystemMemoryManager
Getting an object to manage the system memory usage.
Parameters
getTerritoriesAlongRouteProvider(context)
fun getTerritoriesAlongRouteProvider(context: Context): TerritoriesAlongRouteProvider
Getting an object to get a list of territories along the route from the context.
Parameters
getTerritoryManager(context)
fun getTerritoryManager(context: Context): TerritoryManager
Getting an object for working with territories from the context.
Parameters
getVoiceManager(context)
fun getVoiceManager(context: Context): VoiceManager
Getting an object to manage voices from the context.
Parameters
imageFromAsset(context,assetName,size)
fun imageFromAsset(
context: Context,
assetName: String,
size: Size? = null
): Image
context - Android context
assetName - image file
size - target image size (ignored for SVG and Lottie).
Parameters
imageFromBitmap(context,bitmap)
fun imageFromBitmap(context: Context, bitmap: Bitmap): Image
Parameters
imageFromBitmap(context,loader)
fun imageFromBitmap(context: Context, loader: Function0<Bitmap>): Image
Parameters
imageFromCanvas(context,size,block)
fun imageFromCanvas(
context: Context,
size: Size,
block: Function1
): Image
Parameters
imageFromLottieJSON(context,data)
fun imageFromLottieJSON(context: Context, data: ByteArray): Image
Parameters
imageFromLottieJSON(context,loader)
fun imageFromLottieJSON(context: Context, loader: Function0<ByteArray>): Image
Parameters
imageFromResource(context,resourceId,size)
fun imageFromResource(
context: Context,
resourceId: Int,
size: Size? = null
): Image
Context - Android context
resourceId - Android resource
size - target image size (ignored for SVG and Lottie).
Parameters
imageFromSvg(context,data)
fun imageFromSvg(context: Context, data: ByteArray): Image
Parameters
imageFromSvg(context,loader)
fun imageFromSvg(context: Context, loader: Function0<ByteArray>): Image
Parameters
isBetterLocation(location,currentBestLocation)
fun isBetterLocation(location: Location, currentBestLocation: Location?): Boolean
Parameters
kilometersPerHourToMetersPerSecond(kilometersPerHour)
fun kilometersPerHourToMetersPerSecond(kilometersPerHour: Double): Double
Convert speed in kilometers per hour to speed in meters per second.
Parameters
max(a,b)
metersPerSecondToKilometersPerHour(metersPerSecond)
fun metersPerSecondToKilometersPerHour(metersPerSecond: Double): Double
Convert speed in meters per second to speed in kilometers per hour.
Parameters
metersToUiString(meters,context)
fun metersToUiString(meters: Int, context: Context): String
Converting the size in meters to a string for displaying in navigator UI controls.
Parameters
min(a,b)
MutableChannel()
fun MutableChannel(): MutableChannel<T>
Returns
MutableStatefulChannel(initialValue)
fun MutableStatefulChannel(initialValue: T): MutableStatefulChannel<T>
Parameters
parseGeoJson(geoJsonData)
fun parseGeoJson(geoJsonData: String): List<GeometryMapObject>
Parameters
parseGeoJsonFile(fsPath)
fun parseGeoJsonFile(fsPath: String): List<GeometryMapObject>
Parameters
projectionZToStyleZ(projectionZ,latitude)
fun projectionZToStyleZ(projectionZ: Zoom, latitude: Latitude): StyleZoom
Parameters
registerPlatformLocationSource(context,source)
fun registerPlatformLocationSource(context: Context, source: LocationSource?): Unit
Registering a geolocation source. You can use DefaultLocationSource as the default source.
Parameters
registerPlatformMagneticSource(context,source)
fun registerPlatformMagneticSource(context: Context, source: MagneticHeadingSource?): Unit
Parameters
remainingRouteGeometry(fullRouteGeometry,currentRoutePoint)
fun remainingRouteGeometry(fullRouteGeometry: GeoPointRouteAttribute, currentRoutePoint: RoutePoint): GeoPointRouteAttribute
Calculates the geometry of the remainder of the route, i.e. the geometry starting at the point
corresponding to the current waypoint and continuing to the end of the route. If the route is
completely passed or the current point is outside the route, an empty geometry
is returned.
Parameters
fullRouteGeometry
Full geometry of the entire route
currentRoutePoint
Current position on the route
Returns
GeoPointRouteAttributeGeometry of the rest of the route
<p>Operation complexity O(N), where N = full_route_geometry.size()</p>
routeMatchesTruckPassZonePasses(truckPassZoneIds,passZonePasses)
fun routeMatchesTruckPassZonePasses(truckPassZoneIds: TruckPassZoneIdRouteLongAttribute, passZonePasses: List<TruckPassZonePass>): Boolean
Checks if the provided list of passes is sufficient to pass the truck traffic areas
through which the route passes.<p>If the route does not pass through any truck traffic areas, the function returns true.</p>
Parameters
truckPassZoneIds
Attribute of a route with identifiers of access zones for trucks.
passZonePasses
Pass for passage through the truck checkpoints.
Returns
BooleanA sign of the sufficiency of passes to travel along the route.
styleZToProjectionZ(styleZ,latitude)
fun styleZToProjectionZ(styleZ: StyleZoom, latitude: Latitude): Zoom
Parameters
toMapGeometry(geometry)
fun toMapGeometry(geometry: GeoPointRouteAttribute): Geometry
Convert route geometry to IGeometryPtr.
Parameters
zoomOutToFit(camera,geometry,size)
fun zoomOutToFit(
camera: BaseCamera,
geometry: Geometry,
size: ScreenSize? = null
): CameraPosition
Calculates the camera position so that a geometric object on the map, located at a fixed camera installation point,
fits into the screen area defined by the camera padding.<p>If the original camera settings do not need to be changed,
then the camera copied through IBaseCamera::clone() can be used.</p>
Parameters
camera
the camera used to calculate the position.
geometry
A geometric object to fit into the screen area specified by the camera's padding.
size
The size of the viewing area.
If not specified, the value from ICamera::size() is used.
Returns
zoomOutToFit(camera,objects,size)
fun zoomOutToFit(
camera: BaseCamera,
objects: List<SimpleMapObject>,
size: ScreenSize? = null
): CameraPosition
Calculation of the camera position so that with the camera's installation point unchanged, the geometric object
located on the map fits into the screen area specified by the camera's padding.
Parameters
camera
The camera used to calculate the position.
objects
Map objects to fit into the screen area specified by the camera's padding.
size
Size of the viewving area.\nIf not specified, ICamera::size() value is used.
Returns