AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.Map Class Reference
Inheritance diagram for com.google.appinventor.components.runtime.Map:
com.google.appinventor.components.runtime.MapFeatureContainerBase com.google.appinventor.components.runtime.util.MapFactory.MapEventListener com.google.appinventor.components.runtime.AndroidViewComponent com.google.appinventor.components.runtime.util.MapFactory.MapFeatureContainer com.google.appinventor.components.runtime.VisibleComponent com.google.appinventor.components.runtime.ComponentContainer com.google.appinventor.components.runtime.Component

Public Member Functions

 Map (final ComponentContainer container)
 
View getView ()
 
void CenterFromString (String center)
 
double Latitude ()
 
double Longitude ()
 
void ZoomLevel (int zoom)
 
int ZoomLevel ()
 
void EnableZoom (boolean zoom)
 
boolean EnableZoom ()
 
void Rotation (float rotation)
 
float Rotation ()
 
void MapType (int type)
 
int MapType ()
 
void ShowCompass (boolean compass)
 
boolean ShowCompass ()
 
void ShowZoom (boolean zoom)
 
boolean ShowZoom ()
 
void ShowUser (boolean user)
 
boolean ShowUser ()
 
void EnableRotation (boolean rotation)
 
boolean EnableRotation ()
 
void EnablePan (boolean pan)
 
boolean EnablePan ()
 
void BoundingBox (YailList boundingbox)
 
YailList BoundingBox ()
 
YailList Features ()
 
void LocationSensor (LocationSensor sensor)
 
LocationSensor LocationSensor ()
 
void ShowScale (boolean show)
 
boolean ShowScale ()
 
void ScaleUnits (int units)
 
int ScaleUnits ()
 
double UserLatitude ()
 
double UserLongitude ()
 
void PanTo (double latitude, double longitude, int zoom)
 
Marker CreateMarker (double latitude, double longitude)
 
void Save (final String path)
 
void Ready ()
 
void BoundsChange ()
 
void ZoomChange ()
 
void InvalidPoint (String message)
 
void TapAtPoint (double latitude, double longitude)
 
void DoubleTapAtPoint (double latitude, double longitude)
 
void LongPressAtPoint (double latitude, double longitude)
 
MapController getController ()
 
void onReady (MapController map)
 
void onBoundsChanged ()
 
void onZoom ()
 
void onSingleTap (final double latitude, final double longitude)
 
void onDoubleTap (final double latitude, final double longitude)
 
void onLongPress (final double latitude, final double longitude)
 
void onFeatureClick (final MapFeature feature)
 
void onFeatureLongPress (final MapFeature feature)
 
void onFeatureStartDrag (final MapFeature feature)
 
void onFeatureDrag (final MapFeature feature)
 
void onFeatureStopDrag (final MapFeature feature)
 
Map getMap ()
 
void removeFeature (MapFeature feature)
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.MapFeatureContainerBase
void Features (YailList features)
 
void FeatureClick (MapFactory.MapFeature feature)
 
void FeatureLongClick (MapFactory.MapFeature feature)
 
void FeatureStartDrag (MapFactory.MapFeature feature)
 
void FeatureDrag (MapFactory.MapFeature feature)
 
void FeatureStopDrag (MapFactory.MapFeature feature)
 
void LoadFromURL (final String url)
 
Object FeatureFromDescription (YailList description)
 
void GotFeatures (String url, YailList features)
 
void LoadError (String url, int responseCode, String errorMessage)
 
Activity $context ()
 
Form $form ()
 
void $add (AndroidViewComponent component)
 
void setChildWidth (AndroidViewComponent component, int width)
 
void setChildHeight (AndroidViewComponent component, int height)
 
void removeFeature (MapFactory.MapFeature feature)
 
Iterator< MapFeatureiterator ()
 
void addFeature (MapFactory.MapFeature feature)
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.AndroidViewComponent
boolean Visible ()
 
void Visible (boolean visibility)
 
int Width ()
 
void Width (int width)
 
void WidthPercent (int pCent)
 
void setLastWidth (int width)
 
int getSetWidth ()
 
void setLastHeight (int height)
 
int getSetHeight ()
 
void CopyWidth (AndroidViewComponent sourceComponent)
 
int Height ()
 
void Height (int height)
 
void HeightPercent (int pCent)
 
void CopyHeight (AndroidViewComponent sourceComponent)
 
int Column ()
 
void Column (int column)
 
int Row ()
 
void Row (int row)
 
HandlesEventDispatching getDispatchDelegate ()
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.util.MapFactory.MapFeatureContainer
void FeatureClick (MapFeature feature)
 
void FeatureLongClick (MapFeature feature)
 
void FeatureStartDrag (MapFeature feature)
 
void FeatureDrag (MapFeature feature)
 
void FeatureStopDrag (MapFeature feature)
 
void addFeature (MapFeature feature)
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.ComponentContainer
int Width ()
 
int Height ()
 

Additional Inherited Members

- Static Public Attributes inherited from com.google.appinventor.components.runtime.Component
static final String ASSET_DIRECTORY = "component"
 
static final int ALIGNMENT_NORMAL = 0
 
static final int ALIGNMENT_CENTER = 1
 
static final int ALIGNMENT_OPPOSITE = 2
 
static final int ACCELEROMETER_SENSITIVITY_WEAK = 1
 
static final int ACCELEROMETER_SENSITIVITY_MODERATE = 2
 
static final int ACCELEROMETER_SENSITIVITY_STRONG = 3
 
static final int BUTTON_SHAPE_DEFAULT = 0
 
static final int BUTTON_SHAPE_ROUNDED = 1
 
static final int BUTTON_SHAPE_RECT = 2
 
static final int BUTTON_SHAPE_OVAL = 3
 
static final int COLOR_NONE = 0x00FFFFFF
 
static final int COLOR_BLACK = 0xFF000000
 
static final int COLOR_BLUE = 0xFF0000FF
 
static final int COLOR_CYAN = 0xFF00FFFF
 
static final int COLOR_DKGRAY = 0xFF444444
 
static final int COLOR_GRAY = 0xFF888888
 
static final int COLOR_GREEN = 0xFF00FF00
 
static final int COLOR_LTGRAY = 0xFFCCCCCC
 
static final int COLOR_MAGENTA = 0xFFFF00FF
 
static final int COLOR_ORANGE = 0xFFFFC800
 
static final int COLOR_PINK = 0xFFFFAFAF
 
static final int COLOR_RED = 0xFFFF0000
 
static final int COLOR_WHITE = 0xFFFFFFFF
 
static final int COLOR_YELLOW = 0xFFFFFF00
 
static final int COLOR_DEFAULT = 0x00000000
 
static final String DEFAULT_VALUE_COLOR_NONE = "&H00FFFFFF"
 
static final String DEFAULT_VALUE_COLOR_BLACK = "&HFF000000"
 
static final String DEFAULT_VALUE_COLOR_BLUE = "&HFF0000FF"
 
static final String DEFAULT_VALUE_COLOR_CYAN = "&HFF00FFFF"
 
static final String DEFAULT_VALUE_COLOR_DKGRAY = "&HFF444444"
 
static final String DEFAULT_VALUE_COLOR_GRAY = "&HFF888888"
 
static final String DEFAULT_VALUE_COLOR_GREEN = "&HFF00FF00"
 
static final String DEFAULT_VALUE_COLOR_LTGRAY = "&HFFCCCCCC"
 
static final String DEFAULT_VALUE_COLOR_MAGENTA = "&HFFFF00FF"
 
static final String DEFAULT_VALUE_COLOR_ORANGE = "&HFFFFC800"
 
static final String DEFAULT_VALUE_COLOR_PINK = "&HFFFFAFAF"
 
static final String DEFAULT_VALUE_COLOR_RED = "&HFFFF0000"
 
static final String DEFAULT_VALUE_COLOR_WHITE = "&HFFFFFFFF"
 
static final String DEFAULT_VALUE_COLOR_YELLOW = "&HFFFFFF00"
 
static final String DEFAULT_VALUE_COLOR_DEFAULT = "&H00000000"
 
static final float FONT_DEFAULT_SIZE = 14
 
static final int LAYOUT_ORIENTATION_HORIZONTAL = ComponentConstants.LAYOUT_ORIENTATION_HORIZONTAL
 
static final int LAYOUT_ORIENTATION_VERTICAL = ComponentConstants.LAYOUT_ORIENTATION_VERTICAL
 
static final int SCALING_SCALE_PROPORTIONALLY = 0
 
static final int SCALING_SCALE_TO_FIT = 1
 
static final int TYPEFACE_DEFAULT = 0
 
static final int TYPEFACE_SANSSERIF = 1
 
static final int TYPEFACE_SERIF = 2
 
static final int TYPEFACE_MONOSPACE = 3
 
static final int LENGTH_PREFERRED = -1
 
static final int LENGTH_FILL_PARENT = -2
 
static final int LENGTH_UNKNOWN = -3
 
static final int LENGTH_PERCENT_TAG = -1000
 
static final int TOAST_LENGTH_SHORT = 0
 
static final int TOAST_LENGTH_LONG = 1
 
static final int DIRECTION_NORTH = 1
 
static final int DIRECTION_NORTHEAST = 2
 
static final int DIRECTION_EAST = 3
 
static final int DIRECTION_SOUTHEAST = 4
 
static final int DIRECTION_SOUTH = -1
 
static final int DIRECTION_SOUTHWEST = -2
 
static final int DIRECTION_WEST = -3
 
static final int DIRECTION_NORTHWEST = -4
 
static final int DIRECTION_NONE = 0
 
static final int DIRECTION_MIN = -4
 
static final int DIRECTION_MAX = 4
 
static float SLIDER_MIN_VALUE = 10
 
static float SLIDER_MAX_VALUE = 50
 
static float SLIDER_THUMB_VALUE = (SLIDER_MIN_VALUE + SLIDER_MAX_VALUE) / 2.0f
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY = ""
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE = ""
 
- Protected Member Functions inherited from com.google.appinventor.components.runtime.MapFeatureContainerBase
 MapFeatureContainerBase (ComponentContainer container)
 
void processGeoJSON (final String url, final String content) throws JSONException
 
- Protected Member Functions inherited from com.google.appinventor.components.runtime.AndroidViewComponent
 AndroidViewComponent (ComponentContainer container)
 
- Protected Member Functions inherited from com.google.appinventor.components.runtime.VisibleComponent
 VisibleComponent ()
 
- Protected Attributes inherited from com.google.appinventor.components.runtime.MapFeatureContainerBase
List< MapFeaturefeatures = new CopyOnWriteArrayList<MapFeature>()
 
- Protected Attributes inherited from com.google.appinventor.components.runtime.AndroidViewComponent
final ComponentContainer container
 

Detailed Description

A two-dimensional container that renders map tiles in the background and allows for multiple Marker elements to identify points on the map. Map tiles are supplied by OpenStreetMap contributors and the the United States Geological Survey.

The Map component provides three utilities for manipulating its boundaries with App Inventor. First, a locking mechanism is provided to allow the map to be moved relative to other components on the Screen. Second, when unlocked, the user can pan the Map to any location. At this new location, the "Set Initial Boundary" button can be pressed to save the current Map coordinates to its properties. Lastly, if the Map is moved to a different location, for example to add Markers off-screen, then the "Reset Map to Initial Bounds" button can be used to re-center the Map at the starting location.

Author
ewpat.nosp@m.ton@.nosp@m.mit.e.nosp@m.du (Evan W. Patton)

Definition at line 84 of file Map.java.

Constructor & Destructor Documentation

◆ Map()

com.google.appinventor.components.runtime.Map.Map ( final ComponentContainer  container)

Construct a new map to be rendered within the given container.

Parameters
containerComponent or form containing the map view

Definition at line 103 of file Map.java.

Member Function Documentation

◆ BoundingBox() [1/2]

YailList com.google.appinventor.components.runtime.Map.BoundingBox ( )

Sets or gets the current boundary for the map's drawn view. The value is a list of lists containing the northwest and southeast coordinates of the current view in the form ((North West) (South East)).

Definition at line 455 of file Map.java.

◆ BoundingBox() [2/2]

void com.google.appinventor.components.runtime.Map.BoundingBox ( YailList  boundingbox)

Definition at line 440 of file Map.java.

◆ BoundsChange()

void com.google.appinventor.components.runtime.Map.BoundsChange ( )

The BoundsChange event runs when the user changes the map bounds, either by zooming, panning, or rotating the view.

Definition at line 607 of file Map.java.

◆ CenterFromString()

void com.google.appinventor.components.runtime.Map.CenterFromString ( String  center)

Set the initial center coordinate of the map. The value is specified as a comma-separated pair of decimal latitude and longitude coordinates, for example, 42.359144, -71.093612.

In blocks code, it is recommended for performance reasons to use PanTo(double, double, int) with numerical latitude and longitude rather than convert to the string representation for use with this property.

Parameters
centerA comma-separated string containing the latitude and longitude of the map center.

Definition at line 151 of file Map.java.

◆ CreateMarker()

Marker com.google.appinventor.components.runtime.Map.CreateMarker ( double  latitude,
double  longitude 
)

Creates a new Marker on the Map at the specified latitude and longitude.

Parameters
latitudeLatitude of the new Marker
longitudeLongitude of the new Marker
Returns
a freshly created Marker instance

Definition at line 562 of file Map.java.

◆ DoubleTapAtPoint()

void com.google.appinventor.components.runtime.Map.DoubleTapAtPoint ( double  latitude,
double  longitude 
)

The DoubleTapAtPoint runs when the user double taps at a point on the map. The tapped location will be reported in map coordinates via the latitude{:.variable.block} and longitude{:.variable.block} parameters.

Definition at line 652 of file Map.java.

◆ EnablePan() [1/2]

boolean com.google.appinventor.components.runtime.Map.EnablePan ( )

Enables or disables the ability of the user to move the Map.

Definition at line 435 of file Map.java.

◆ EnablePan() [2/2]

void com.google.appinventor.components.runtime.Map.EnablePan ( boolean  pan)

Definition at line 426 of file Map.java.

◆ EnableRotation() [1/2]

boolean com.google.appinventor.components.runtime.Map.EnableRotation ( )

Enables or disables the two-finger rotation gesture to rotate the Map.

Returns
True if the map is drawn based on orientation, otherwise false.

Definition at line 420 of file Map.java.

◆ EnableRotation() [2/2]

void com.google.appinventor.components.runtime.Map.EnableRotation ( boolean  rotation)

Enable rotating the map based on the user's orientation.

Parameters
rotationTrue if the map should be rotated based on user orientation, otherwise false.

Definition at line 408 of file Map.java.

◆ EnableZoom() [1/2]

boolean com.google.appinventor.components.runtime.Map.EnableZoom ( )

Enables or disables the two-finger pinch gesture to zoom the Map.

Returns
Returns whether multitouch zoom gestures are enabled for the map.

Definition at line 267 of file Map.java.

◆ EnableZoom() [2/2]

void com.google.appinventor.components.runtime.Map.EnableZoom ( boolean  zoom)

Set whether the user can zoom the map using touch gestures. This value does not affect whether the user can zoom using the zoom controls provided by ShowZoom.

Parameters
zoomIf true, then the user can use pinch/expand gestures to change the map zoom level.

Definition at line 254 of file Map.java.

◆ Features()

YailList com.google.appinventor.components.runtime.Map.Features ( )

Gets the list of features attached to the type% (without regard to the value of the feature's Visible{:.getter.block} property). This list also includes any features created on the type% by calls to FeatureFromDescription(YailList).

Returns
A YailList of map features, e.g., Marker, LineString

Reimplemented from com.google.appinventor.components.runtime.MapFeatureContainerBase.

Definition at line 464 of file Map.java.

◆ getController()

MapController com.google.appinventor.components.runtime.Map.getController ( )

Definition at line 667 of file Map.java.

◆ getMap()

Map com.google.appinventor.components.runtime.Map.getMap ( )

Gets the map containing the feature collection.

Returns
the feature collection's map

Implements com.google.appinventor.components.runtime.util.MapFactory.MapFeatureContainer.

Definition at line 783 of file Map.java.

◆ getView()

View com.google.appinventor.components.runtime.Map.getView ( )

Returns the View that is displayed in the UI.

Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.

Definition at line 123 of file Map.java.

◆ InvalidPoint()

void com.google.appinventor.components.runtime.Map.InvalidPoint ( String  message)

The InvalidPoint event runs when the program encounters an invalid point while processing geographical data. Points are considered invalid when the latitude or longitude for the point is outside the acceptable range ([-90, 90] and [-180, 180], respectively). The message parameter will contain an explanation for the error.

Parameters
message

Definition at line 630 of file Map.java.

◆ Latitude()

double com.google.appinventor.components.runtime.Map.Latitude ( )

Gets the latitude of the center of the Map. To change the latitude, use the PanTo(double, double, int) method.

Returns
Returns the latitude of the center of the map

Definition at line 193 of file Map.java.

◆ LocationSensor() [1/2]

LocationSensor com.google.appinventor.components.runtime.Map.LocationSensor ( )

Definition at line 487 of file Map.java.

◆ LocationSensor() [2/2]

void com.google.appinventor.components.runtime.Map.LocationSensor ( LocationSensor  sensor)

Uses the provided LocationSensor for user location data rather than the built-in location provider.

Definition at line 476 of file Map.java.

◆ Longitude()

double com.google.appinventor.components.runtime.Map.Longitude ( )

Gets the longitude of the center of the Map. To change the longitude, use the PanTo(double, double, int) method.

Returns
Returns the longitude of the center of the map

Definition at line 206 of file Map.java.

◆ LongPressAtPoint()

void com.google.appinventor.components.runtime.Map.LongPressAtPoint ( double  latitude,
double  longitude 
)

The LongPressAtPoint runs when the user long-presses at a point on the map without moving their finger (which would trigger a drag). The location of the long-press will be reported in map coordinates via the latitude{:.variable.block} and longitude{:.variable.block} parameters.

Definition at line 663 of file Map.java.

◆ MapType() [1/2]

int com.google.appinventor.components.runtime.Map.MapType ( )

Sets or gets the tile layer used to draw the Map background. Defaults to Roads. Valid values are:

  1. Roads
  2. Aerial
  3. Terrain

Note: Road layers are provided by OpenStreetMap and aerial and terrain layers are provided by the U.S. Geological Survey.

Returns
Returns an integer identifying the base tile layer in use by the map.

Definition at line 319 of file Map.java.

◆ MapType() [2/2]

void com.google.appinventor.components.runtime.Map.MapType ( int  type)

Set the type of map tile used for the base tile layer. Valid values are:

  1. Roads
  2. Aerial
  3. Terrain
Parameters
typeInteger identifying the tile set to use for the map's base layer.

Definition at line 298 of file Map.java.

◆ onBoundsChanged()

void com.google.appinventor.components.runtime.Map.onBoundsChanged ( )

The Map's bounds were changed, for example due to a user-initiated zoom or pan event. Users can check Map#BoundingBox() for the updated bounds.

Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.

Definition at line 683 of file Map.java.

◆ onDoubleTap()

void com.google.appinventor.components.runtime.Map.onDoubleTap ( final double  latitude,
final double  longitude 
)

onDoubleTap is raised when the user double-taps on the Map but no feature is present at the location to handle the double-tap event.

Parameters
latitudeLatitude of the double-tap event
longitudeLongitude of the double-tap event

Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.

Definition at line 713 of file Map.java.

◆ onFeatureClick()

void com.google.appinventor.components.runtime.Map.onFeatureClick ( final MapFeature  feature)

onFeatureClick is raised when the user single-taps on a MapFeature.

Parameters
featureThe map feature clicked by the user.

Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.

Definition at line 733 of file Map.java.

◆ onFeatureDrag()

void com.google.appinventor.components.runtime.Map.onFeatureDrag ( final MapFeature  feature)

onFeatureDrag is raised as the user drags the map feature. Handlers for this event should run quickly because they block the UI thread and will make the dragging behavior appear sluggish.

Parameters
featureThe map feature the user is dragging.

Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.

Definition at line 763 of file Map.java.

◆ onFeatureLongPress()

void com.google.appinventor.components.runtime.Map.onFeatureLongPress ( final MapFeature  feature)

onFeatureLongPress is raised when the user long-presses on a MapFeature without moving their location significantly enough to trigger a dragging gesture.

Parameters
featureThe map feature long-pressed by the user.

Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.

Definition at line 743 of file Map.java.

◆ onFeatureStartDrag()

void com.google.appinventor.components.runtime.Map.onFeatureStartDrag ( final MapFeature  feature)

onFeatureStartDrag is raised when the user starts dragging a MapFeature.

Parameters
featureThe map feature the user has started dragging.

Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.

Definition at line 753 of file Map.java.

◆ onFeatureStopDrag()

void com.google.appinventor.components.runtime.Map.onFeatureStopDrag ( final MapFeature  feature)

onFeatureStopDrag is raised when the user completes a dragging motion by releasing their touch from the screen.

Parameters
featureThe map feature the user has released from dragging.

Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.

Definition at line 773 of file Map.java.

◆ onLongPress()

void com.google.appinventor.components.runtime.Map.onLongPress ( final double  latitude,
final double  longitude 
)

onLongPress is raised when the user long-presses on the Map without moving their location significantly enough to trigger a panning gesture.

Parameters
latitudeLatitude of the long-press event
longitudeLongitude of the long-press event

Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.

Definition at line 723 of file Map.java.

◆ onReady()

void com.google.appinventor.components.runtime.Map.onReady ( MapController  map)

The Map is ready for user interaction.

Parameters
mapThe MapController for the underlying Map implementation.

Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.

Definition at line 673 of file Map.java.

◆ onSingleTap()

void com.google.appinventor.components.runtime.Map.onSingleTap ( final double  latitude,
final double  longitude 
)

onSingleTap is raised when the user taps on the Map but no feature is present at the location to handle the tap event.

Parameters
latitudeLatitude of the tap event
longitudeLongitude of the tap event

Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.

Definition at line 703 of file Map.java.

◆ onZoom()

void com.google.appinventor.components.runtime.Map.onZoom ( )

The Map's zoom level has changed, for example due to a user-initiated zoom event. Users can check Map#ZoomLevel() for the updated zoom level.

Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.

Definition at line 693 of file Map.java.

◆ PanTo()

void com.google.appinventor.components.runtime.Map.PanTo ( double  latitude,
double  longitude,
int  zoom 
)

Definition at line 549 of file Map.java.

◆ Ready()

void com.google.appinventor.components.runtime.Map.Ready ( )

The Ready event runs once the Map has been initialized and is ready for user interaction.

Definition at line 598 of file Map.java.

◆ removeFeature()

void com.google.appinventor.components.runtime.Map.removeFeature ( MapFeature  feature)

Removes a feature from the feature collection.

Parameters
featurethe feature to remove

Implements com.google.appinventor.components.runtime.util.MapFactory.MapFeatureContainer.

Definition at line 825 of file Map.java.

◆ Rotation() [1/2]

float com.google.appinventor.components.runtime.Map.Rotation ( )

Specifies the rotation of the map in decimal degrees, if any.

Definition at line 281 of file Map.java.

◆ Rotation() [2/2]

void com.google.appinventor.components.runtime.Map.Rotation ( float  rotation)

Definition at line 273 of file Map.java.

◆ Save()

void com.google.appinventor.components.runtime.Map.Save ( final String  path)

Saves the features on the Map as a GeoJSON file at the specified path.

Definition at line 572 of file Map.java.

◆ ScaleUnits() [1/2]

int com.google.appinventor.components.runtime.Map.ScaleUnits ( )

Definition at line 524 of file Map.java.

◆ ScaleUnits() [2/2]

void com.google.appinventor.components.runtime.Map.ScaleUnits ( int  units)

Specifies the units used for the scale overlay. 1 (the default) will give metric units (km, m) whereas 2 will give imperial units (mi, ft).

Definition at line 514 of file Map.java.

◆ ShowCompass() [1/2]

boolean com.google.appinventor.components.runtime.Map.ShowCompass ( )

Specifies whether to a compass overlay on the Map. The compass will be rotated based on the device's orientation if a digital compass is present in hardware.

Returns
True if the compass is enabled, otherwise false.

Definition at line 344 of file Map.java.

◆ ShowCompass() [2/2]

void com.google.appinventor.components.runtime.Map.ShowCompass ( boolean  compass)

Show a compass on the map. If the device provides a digital compass, orientation changes will be used to rotate the compass icon.

Parameters
compassTrue if the compass should be enabled, otherwise false.

Definition at line 332 of file Map.java.

◆ ShowScale() [1/2]

boolean com.google.appinventor.components.runtime.Map.ShowScale ( )

Definition at line 503 of file Map.java.

◆ ShowScale() [2/2]

void com.google.appinventor.components.runtime.Map.ShowScale ( boolean  show)

Shows or hides a scale overlay on the Map. The scale will change with the zoom level and its units can be controlled by the ScaleUnits(int) property.

Definition at line 497 of file Map.java.

◆ ShowUser() [1/2]

boolean com.google.appinventor.components.runtime.Map.ShowUser ( )

Get whether the user's location is shown on the map.

@suppressdoc

Returns
True if the user's location is being shown on the map, otherwise false.

Definition at line 396 of file Map.java.

◆ ShowUser() [2/2]

void com.google.appinventor.components.runtime.Map.ShowUser ( boolean  user)

Shows or hides an icon indicating the user's current location on the Map. The availability and accuracy of this feature will depend on whether the user has location services enabled and which location providers are available.

Parameters
userTrue if the user's location should be shown, otherwise false.

Definition at line 384 of file Map.java.

◆ ShowZoom() [1/2]

boolean com.google.appinventor.components.runtime.Map.ShowZoom ( )

Get whether the zoom controls are displayed on the map.

@suppressdoc

Returns
True if the controls should be shown, otherwise false.

Definition at line 370 of file Map.java.

◆ ShowZoom() [2/2]

void com.google.appinventor.components.runtime.Map.ShowZoom ( boolean  zoom)

Shows or hides an icon indicating the user's current location on the Map. The availability and accuracy of this feature will depend on whether the user has location services enabled and which location providers are available.

Parameters
zoomTrue if the controls should be shown, otherwise false.

Definition at line 358 of file Map.java.

◆ TapAtPoint()

void com.google.appinventor.components.runtime.Map.TapAtPoint ( double  latitude,
double  longitude 
)

The TapAtPoint runs when the user taps at a point on the map. The tapped location will be reported in map coordinates via the latitude{:.variable.block} and longitude{:.variable.block} parameters.

Definition at line 640 of file Map.java.

◆ UserLatitude()

double com.google.appinventor.components.runtime.Map.UserLatitude ( )

Definition at line 537 of file Map.java.

◆ UserLongitude()

double com.google.appinventor.components.runtime.Map.UserLongitude ( )

Definition at line 543 of file Map.java.

◆ ZoomChange()

void com.google.appinventor.components.runtime.Map.ZoomChange ( )

The ZoomChange event runs when the user has changed the zoom level of the map, such as by pinching or double-tapping to zoom.

Definition at line 616 of file Map.java.

◆ ZoomLevel() [1/2]

int com.google.appinventor.components.runtime.Map.ZoomLevel ( )

Get the zoom level of the map.

@suppressdoc

Returns
Returns the current zoom level of the map.

Definition at line 240 of file Map.java.

◆ ZoomLevel() [2/2]

void com.google.appinventor.components.runtime.Map.ZoomLevel ( int  zoom)

Specifies the zoom level of the map. Valid values of ZoomLevel are dependent on the tile provider and the latitude and longitude of the map. For example, zoom levels are more constrained over oceans than dense city centers to conserve space for storing tiles, so valid values may be 1-7 over ocean and 1-20 over cities. Tile providers may send warning or error tiles if the zoom level is too great for the server to support.

Parameters
zoomNew zoom level.

Definition at line 223 of file Map.java.


The documentation for this class was generated from the following file: