AI2 Component
(Version nb184)
|
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< MapFeature > | iterator () |
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< MapFeature > | features = new CopyOnWriteArrayList<MapFeature>() |
Protected Attributes inherited from com.google.appinventor.components.runtime.AndroidViewComponent | |
final ComponentContainer | container |
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.
com.google.appinventor.components.runtime.Map.Map | ( | final ComponentContainer | container | ) |
YailList com.google.appinventor.components.runtime.Map.BoundingBox | ( | ) |
void com.google.appinventor.components.runtime.Map.BoundingBox | ( | YailList | boundingbox | ) |
void com.google.appinventor.components.runtime.Map.BoundsChange | ( | ) |
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.
center | A comma-separated string containing the latitude and longitude of the map center. |
Marker com.google.appinventor.components.runtime.Map.CreateMarker | ( | double | latitude, |
double | longitude | ||
) |
void com.google.appinventor.components.runtime.Map.DoubleTapAtPoint | ( | double | latitude, |
double | longitude | ||
) |
boolean com.google.appinventor.components.runtime.Map.EnablePan | ( | ) |
void com.google.appinventor.components.runtime.Map.EnablePan | ( | boolean | pan | ) |
boolean com.google.appinventor.components.runtime.Map.EnableRotation | ( | ) |
void com.google.appinventor.components.runtime.Map.EnableRotation | ( | boolean | rotation | ) |
boolean com.google.appinventor.components.runtime.Map.EnableZoom | ( | ) |
void com.google.appinventor.components.runtime.Map.EnableZoom | ( | boolean | zoom | ) |
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).
Reimplemented from com.google.appinventor.components.runtime.MapFeatureContainerBase.
MapController com.google.appinventor.components.runtime.Map.getController | ( | ) |
Map com.google.appinventor.components.runtime.Map.getMap | ( | ) |
Gets the map containing the feature collection.
Implements com.google.appinventor.components.runtime.util.MapFactory.MapFeatureContainer.
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.
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.
message |
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.
LocationSensor com.google.appinventor.components.runtime.Map.LocationSensor | ( | ) |
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.
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.
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.
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:
Note: Road layers are provided by OpenStreetMap and aerial and terrain layers are provided by the U.S. Geological Survey.
void com.google.appinventor.components.runtime.Map.MapType | ( | int | type | ) |
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.
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.
latitude | Latitude of the double-tap event |
longitude | Longitude of the double-tap event |
Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.
void com.google.appinventor.components.runtime.Map.onFeatureClick | ( | final MapFeature | feature | ) |
onFeatureClick is raised when the user single-taps on a MapFeature.
feature | The map feature clicked by the user. |
Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.
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.
feature | The map feature the user is dragging. |
Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.
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.
feature | The map feature long-pressed by the user. |
Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.
void com.google.appinventor.components.runtime.Map.onFeatureStartDrag | ( | final MapFeature | feature | ) |
onFeatureStartDrag is raised when the user starts dragging a MapFeature.
feature | The map feature the user has started dragging. |
Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.
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.
feature | The map feature the user has released from dragging. |
Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.
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.
latitude | Latitude of the long-press event |
longitude | Longitude of the long-press event |
Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.
void com.google.appinventor.components.runtime.Map.onReady | ( | MapController | map | ) |
The Map is ready for user interaction.
map | The MapController for the underlying Map implementation. |
Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.
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.
latitude | Latitude of the tap event |
longitude | Longitude of the tap event |
Implements com.google.appinventor.components.runtime.util.MapFactory.MapEventListener.
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.
void com.google.appinventor.components.runtime.Map.PanTo | ( | double | latitude, |
double | longitude, | ||
int | zoom | ||
) |
void com.google.appinventor.components.runtime.Map.Ready | ( | ) |
void com.google.appinventor.components.runtime.Map.removeFeature | ( | MapFeature | feature | ) |
Removes a feature from the feature collection.
feature | the feature to remove |
Implements com.google.appinventor.components.runtime.util.MapFactory.MapFeatureContainer.
float com.google.appinventor.components.runtime.Map.Rotation | ( | ) |
void com.google.appinventor.components.runtime.Map.Rotation | ( | float | rotation | ) |
void com.google.appinventor.components.runtime.Map.Save | ( | final String | path | ) |
int com.google.appinventor.components.runtime.Map.ScaleUnits | ( | ) |
void com.google.appinventor.components.runtime.Map.ScaleUnits | ( | int | units | ) |
boolean com.google.appinventor.components.runtime.Map.ShowCompass | ( | ) |
void com.google.appinventor.components.runtime.Map.ShowCompass | ( | boolean | compass | ) |
boolean com.google.appinventor.components.runtime.Map.ShowScale | ( | ) |
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.
boolean com.google.appinventor.components.runtime.Map.ShowUser | ( | ) |
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.
user | True if the user's location should be shown, otherwise false. |
boolean com.google.appinventor.components.runtime.Map.ShowZoom | ( | ) |
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.
zoom | True if the controls should be shown, otherwise false. |
void com.google.appinventor.components.runtime.Map.TapAtPoint | ( | double | latitude, |
double | longitude | ||
) |
double com.google.appinventor.components.runtime.Map.UserLatitude | ( | ) |
double com.google.appinventor.components.runtime.Map.UserLongitude | ( | ) |
void com.google.appinventor.components.runtime.Map.ZoomChange | ( | ) |
int com.google.appinventor.components.runtime.Map.ZoomLevel | ( | ) |
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.
zoom | New zoom level. |