Class: Toybox.WatchUi.MapView

Overview

A View for rendering a map on the screen.

The map is rendered statically and focused on the bounding box and/or a MapMarker point or MapPolyline drawn on the map. The map can be rendered in MAP_MODE_BROWSE or MAP_MODE_PREVIEW mode.

Since:

API Level 3.0.0

Supported Devices:

Direct Known Subclasses

WatchUi.MapTrackView

Instance Method Summary collapse

Instance Method Details

clear() as Void

Clear all the objects from the map.

Removes all MapPolyline and MapMarker objects.

Since:

API Level 3.0.0

getMapMode() as WatchUi.MapMode

Get the current mode for the map in this MapView.

Returns:

Since:

API Level 3.0.0

initialize()

Constructor

Since:

API Level 3.0.0

setMapMarker(markers as WatchUi.MapMarker or Lang.Array<WatchUi.MapMarker>) as Void

Add a MapMarker object or an Array of MapMarker objects to be rendered on the map.

Parameters:

Since:

API Level 3.0.0

Throws:

setMapMode(mode as WatchUi.MapMode) as Void

Set the mode for the map in this MapView.

Parameters:

Since:

API Level 3.0.0

setMapVisibleArea(topLeft as Position.Location, bottomRight as Position.Location) as Void

Select the area of the map to render on the screen with a bounding box. A redraw of the current underlying map data will occur, so calling this function inside of onUpdate() is discouraged as it could lead to map flicker.

Parameters:

  • topLeft(Position.Location)

    The top left point of the visible area of the map

  • bottomRight(Position.Location)

    The bottom right point of the visible area of the map

See Also:

Since:

API Level 3.0.0

Throws:

setPolyline(polyline as WatchUi.MapPolyline) as Void

Add MapPolyline object to be rendered on the map.

Parameters:

Since:

API Level 3.0.0

Throws:

setScreenVisibleArea(topLeftX as Lang.Number, topLeftY as Lang.Number, bottomRightX as Lang.Number, bottomRightY as Lang.Number) as Void

Set the area on the screen to focus the map.

Parameters:

  • topLeftX(Lang.Number)

    The x location of the top-left visible pixel on the screen

  • topLeftY(Lang.Number)

    The y location of the top-left visible pixel on the screen

  • bottomRightX(Lang.Number)

    The x location of the bottom-right visible pixel on the screen

  • bottomRightY(Lang.Number)

    The y location of the bottom-right visible pixel on the screen

See Also:

Since:

API Level 3.0.0

Throws:


Generated Jun 6, 2024 10:31:54 AM