Package world.mappable.mapkit.map

Interface Map

interface Map

The object that is used to interact with the map.

Summary

Methods

Type and modifiers

Method and Description

CameraPosition

getCameraPosition()

CameraPosition

cameraPosition(@NonNull Geometry geometry)
Calculates the camera position that projects the specified geometry into the current focusRect, or the full view if the focusRect is not set.

CameraPosition

cameraPosition(@NonNull Geometry geometry,
               @NonNull ScreenRect focusRect)

Calculates the camera position that projects the specified geometry into the custom focusRect.

CameraPosition

cameraPosition(@NonNull Geometry geometry,
               float azimuth,
               float tilt,
               @Nullable ScreenRect focusRect)

VisibleRegion

getVisibleRegion()

VisibleRegion

visibleRegion(@NonNull CameraPosition cameraPosition)

void

move(@NonNull CameraPosition cameraPosition,
     @NonNull Animation animation,
     @Nullable CameraCallback cameraCallback)

Changes camera position.

void

move(@NonNull CameraPosition cameraPosition)
Immediately changes the camera position.

CameraBounds

getCameraBounds()

boolean

isNightModeEnabled()
If enabled, night mode will reduce map brightness and improve contrast.

void

setNightModeEnabled(boolean nightModeEnabled)

boolean

isZoomGesturesEnabled()
Enable/disable zoom gestures, for example: - pinch - double tap (zoom in) - tap with two fingers (zoom out)

void

setZoomGesturesEnabled(boolean zoomGesturesEnabled)

boolean

isScrollGesturesEnabled()
Enable/disable scroll gestures, such as the pan gesture.

void

setScrollGesturesEnabled(boolean scrollGesturesEnabled)

boolean

isTiltGesturesEnabled()
Enable/disable tilt gestures, such as parallel pan with two fingers.

void

setTiltGesturesEnabled(boolean tiltGesturesEnabled)

boolean

isRotateGesturesEnabled()
Enable/disable rotation gestures, such as rotation with two fingers.

void

setRotateGesturesEnabled(boolean rotateGesturesEnabled)

boolean

isFastTapEnabled()
Removes the 300 ms delay in emitting a tap gesture.

void

setFastTapEnabled(boolean fastTapEnabled)

MapType

getMapType()
Sets the base map type.

void

setMapType(@NonNull MapType mapType)

void

addInputListener(@NonNull InputListener inputListener)
Adds input listeners.

void

removeInputListener(@NonNull InputListener inputListener)
Removes input listeners.

void

addCameraListener(@NonNull CameraListener cameraListener)
Adds camera listeners.

void

removeCameraListener(@NonNull CameraListener cameraListener)
Removes camera listeners.

void

setMapLoadedListener(@Nullable MapLoadedListener mapLoadedListener)
Sets a map loaded listener.

MapObjectCollection

getMapObjects()

void

addTapListener(@NonNull GeoObjectTapListener tapListener)
Adds a tap listener that is used to obtain brief geo object info.

void

removeTapListener(@NonNull GeoObjectTapListener tapListener)
Removes a tap listener that is used to obtain brief geo object info.

void

deselectGeoObject()
Resets the currently selected geo object.

void

selectGeoObject(@NonNull GeoObjectSelectionMetadata selectionMetaData)
Selects a geo object with the specified objectId in the specified layerId.

Logo

getLogo()
Mappable logo object.

java.lang.Integer

getPoiLimit()
Limits the number of visible basemap POIs.

void

setPoiLimit(@Nullable java.lang.Integer poiLimit)

boolean

setMapStyle(@NonNull java.lang.String style)
Applies JSON style transformations to the map.

boolean

setMapStyle(int id,
            @NonNull java.lang.String style)

Applies JSON style transformations to the map.

void

resetMapStyles()
Resets all JSON style transformations applied to the map.

void

set2DMode(boolean enable)
Forces the map to be flat.

Projection

projection()
Provides map projection

MapMode

getMode()
Selects one of predefined map style modes optimized for particular use case(transit, driving, etc).

void

setMode(@NonNull MapMode mode)

boolean

isHdModeEnabled()
Enables hd mode of displayed content

void

setHdModeEnabled(boolean hdModeEnabled)

void

wipe()
Erases tiles, caches, etc.

boolean

isAwesomeModelsEnabled()
Enables rich textured 3d content on basemap.

void

setAwesomeModelsEnabled(boolean awesomeModelsEnabled)

Layer

addTileLayer(@NonNull java.lang.String layerId,
             @NonNull LayerOptions layerOptions,
             @NonNull CreateTileDataSource createDataSource)

Adds tile layer.

boolean

isValid()
Tells if this Map is valid or not.

Methods

getCameraPosition

@NonNull
CameraPosition getCameraPosition()

Returns

Current camera position. Target position must be within latitude [-90, 90] and longitude [-180, 180].


cameraPosition

@NonNull
CameraPosition cameraPosition(@NonNull Geometry geometry)

Calculates the camera position that projects the specified geometry into the current focusRect, or the full view if the focusRect is not set.


cameraPosition

@NonNull
CameraPosition cameraPosition(@NonNull Geometry geometry,
                              @NonNull ScreenRect focusRect)

Calculates the camera position that projects the specified geometry into the custom focusRect.


cameraPosition

@NonNull
CameraPosition cameraPosition(@NonNull Geometry geometry,
                              float azimuth,
                              float tilt,
                              @Nullable ScreenRect focusRect)

Returns

Camera position that projects the specified geometry into the custom focusRect, with custom azimuth and tilt camera parameters. If focus rect is not provided, current focus rect is used.


getVisibleRegion

@NonNull
VisibleRegion getVisibleRegion()

Returns

The map region that is currently visible. Region IS bounded by latitude limits [-90, 90] and IS NOT bounded by longitude limits [-180, 180]. If the longitude exceeds its limits, we see the world's edge and another instance of the world beyond this edge.


visibleRegion

@NonNull
VisibleRegion visibleRegion(@NonNull CameraPosition cameraPosition)

Returns

The map region that is visible from the given camera position. Region IS bounded by latitude limits [-90, 90] and IS NOT bounded by longitude limits [-180, 180]. If the longitude exceeds its limits, we see the world's edge and another instance of the world beyond this edge.


move

void move(@NonNull CameraPosition cameraPosition,
          @NonNull Animation animation,
          @Nullable CameraCallback cameraCallback)

Changes camera position.

Can cancel a previous unfinished movement.

Parameters

animation

Required. Defines animation parameters. @see mapkit.Animation for more details.

cameraCallback

A function that takes the bool argument marking the camera action complete. Invoked when:

  • A camera action is cancelled (for example, as a result of a subsequent request for camera movement), passing false as an argument.
  • A camera action finished successfully, passing true as an argument.


move

void move(@NonNull CameraPosition cameraPosition)

Immediately changes the camera position.

Can cancel a previous unfinished movement.


getCameraBounds

@NonNull
CameraBounds getCameraBounds()


isNightModeEnabled

boolean isNightModeEnabled()

If enabled, night mode will reduce map brightness and improve contrast.


setNightModeEnabled

void setNightModeEnabled(boolean nightModeEnabled)


isZoomGesturesEnabled

boolean isZoomGesturesEnabled()

Enable/disable zoom gestures, for example: - pinch - double tap (zoom in) - tap with two fingers (zoom out)


setZoomGesturesEnabled

void setZoomGesturesEnabled(boolean zoomGesturesEnabled)


isScrollGesturesEnabled

boolean isScrollGesturesEnabled()

Enable/disable scroll gestures, such as the pan gesture.


setScrollGesturesEnabled

void setScrollGesturesEnabled(boolean scrollGesturesEnabled)


isTiltGesturesEnabled

boolean isTiltGesturesEnabled()

Enable/disable tilt gestures, such as parallel pan with two fingers.


setTiltGesturesEnabled

void setTiltGesturesEnabled(boolean tiltGesturesEnabled)


isRotateGesturesEnabled

boolean isRotateGesturesEnabled()

Enable/disable rotation gestures, such as rotation with two fingers.


setRotateGesturesEnabled

void setRotateGesturesEnabled(boolean rotateGesturesEnabled)


isFastTapEnabled

boolean isFastTapEnabled()

Removes the 300 ms delay in emitting a tap gesture.

However, a double-tap will emit a tap gesture along with a double-tap.


setFastTapEnabled

void setFastTapEnabled(boolean fastTapEnabled)


getMapType

@NonNull
MapType getMapType()

Sets the base map type.


setMapType

void setMapType(@NonNull MapType mapType)


addInputListener

void addInputListener(@NonNull InputListener inputListener)

Adds input listeners.

The class does not retain the object in the 'inputListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


removeInputListener

void removeInputListener(@NonNull InputListener inputListener)

Removes input listeners.


addCameraListener

void addCameraListener(@NonNull CameraListener cameraListener)

Adds camera listeners.

The class does not retain the object in the 'cameraListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


removeCameraListener

void removeCameraListener(@NonNull CameraListener cameraListener)

Removes camera listeners.


setMapLoadedListener

void setMapLoadedListener(@Nullable MapLoadedListener mapLoadedListener)

Sets a map loaded listener.

The class does not retain the object in the 'mapLoadedListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


getMapObjects

@NonNull
MapObjectCollection getMapObjects()

Returns

List of map objects associated with the map. The layerId for this collection can be retrieved via LayerIds.mapObjectsLayerId


addTapListener

void addTapListener(@NonNull GeoObjectTapListener tapListener)

Adds a tap listener that is used to obtain brief geo object info.

The class does not retain the object in the 'tapListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


removeTapListener

void removeTapListener(@NonNull GeoObjectTapListener tapListener)

Removes a tap listener that is used to obtain brief geo object info.


deselectGeoObject

void deselectGeoObject()

Resets the currently selected geo object.


selectGeoObject

void selectGeoObject(@NonNull GeoObjectSelectionMetadata selectionMetaData)

Selects a geo object with the specified objectId in the specified layerId.

If the object is not currently on the screen, it is selected anyway, but the user will not actually see that. You need to move the camera in addition to this call to be sure that the selected object is visible for the user. GeoObjectSelectionMetadata can be extracted from the geo object's metadata container when the user taps on a geo object.


@NonNull
Logo getLogo()

Mappable logo object.


getPoiLimit

@Nullable
java.lang.Integer getPoiLimit()

Limits the number of visible basemap POIs.

Optional property, can be null.


setPoiLimit

void setPoiLimit(@Nullable java.lang.Integer poiLimit)


setMapStyle

boolean setMapStyle(@NonNull java.lang.String style)

Applies JSON style transformations to the map.

Same as setMapStyle(0, style). Affects VectorMap and Hybrid map types. Set to empty string to clear previous styling. Returns true if the style was successfully parsed, and false otherwise. If the returned value is false, the current map style remains unchanged.


setMapStyle

boolean setMapStyle(int id,
                    @NonNull java.lang.String style)

Applies JSON style transformations to the map.

Replaces previous styling with the specified ID (if such exists). Stylings are applied in an ascending order. Affects VectorMap and Hybrid map types. Set to empty string to clear previous styling with the specified ID. Returns true if the style was successfully parsed, and false otherwise. If the returned value is false, the current map style remains unchanged.


resetMapStyles

void resetMapStyles()

Resets all JSON style transformations applied to the map.


set2DMode

void set2DMode(boolean enable)

Forces the map to be flat.

true - All loaded tiles start showing the "flatten out" animation; all new tiles do not start 3D animation. false - All tiles start showing the "rise up" animation.


projection

@NonNull
Projection projection()

Provides map projection


getMode

@NonNull
MapMode getMode()

Selects one of predefined map style modes optimized for particular use case(transit, driving, etc).

Resets json styles set with setMapStyle. MapMode.Map by deafult.


setMode

void setMode(@NonNull MapMode mode)


isHdModeEnabled

boolean isHdModeEnabled()

Enables hd mode of displayed content


setHdModeEnabled

void setHdModeEnabled(boolean hdModeEnabled)


wipe

void wipe()

Erases tiles, caches, etc.

Does not trigger the next frame generation.


isAwesomeModelsEnabled

boolean isAwesomeModelsEnabled()

Enables rich textured 3d content on basemap.


setAwesomeModelsEnabled

void setAwesomeModelsEnabled(boolean awesomeModelsEnabled)


addTileLayer

@NonNull
Layer addTileLayer(@NonNull java.lang.String layerId,
                   @NonNull LayerOptions layerOptions,
                   @NonNull CreateTileDataSource createDataSource)

Adds tile layer.


isValid

boolean isValid()

Tells if this Map is valid or not.

Any other method (except for this one) called on an invalid Map will throw java.lang.RuntimeException. An instance becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.