AI2 Component  (Version nb184)
Map.java
Go to the documentation of this file.
1 // -*- mode: java; c-basic-offset: 2; -*-
2 // Copyright 2016-2017 MIT, All rights reserved
3 // Released under the Apache License, Version 2.0
4 // http://www.apache.org/licenses/LICENSE-2.0
5 
6 package com.google.appinventor.components.runtime;
7 
17 import org.osmdroid.util.BoundingBox;
18 
40 
41 import android.util.Log;
42 import android.view.View;
43 
44 import java.io.IOException;
45 import java.util.ArrayList;
46 import java.util.List;
47 
63 @SuppressWarnings("WeakerAccess")
64 @DesignerComponent(version = YaVersion.MAP_COMPONENT_VERSION,
65  category = ComponentCategory.MAPS,
66  androidMinSdk = 8,
67  description = "<p>A two-dimensional container that renders map tiles in the background and " +
68  "allows for multiple Marker elements to identify points on the map. Map tiles are supplied " +
69  "by OpenStreetMap contributors and the United States Geological Survey.</p>" +
70  "<p>The Map component provides three utilities for manipulating its boundaries within App " +
71  "Inventor. First, a locking mechanism is provided to allow the map to be moved relative to " +
72  "other components on the Screen. Second, when unlocked, the user can pan the Map to any " +
73  "location. At this new location, the &quot;Set Initial Boundary&quot; button can be pressed " +
74  "to save the current Map coordinates to its properties. Lastly, if the Map is moved to a " +
75  "different location, for example to add Markers off-screen, then the &quot;Reset Map to " +
76  "Initial Bounds&quot; button can be used to re-center the Map at the starting location.</p>")
77 @SimpleObject
78 @UsesAssets(fileNames = "location.png, marker.svg")
79 @UsesPermissions(permissionNames = "android.permission.INTERNET, " + "android.permission.ACCESS_FINE_LOCATION, "
80  + "android.permission.ACCESS_COARSE_LOCATION, " + "android.permission.ACCESS_WIFI_STATE, "
81  + "android.permission.ACCESS_NETWORK_STATE, " + "android.permission.WRITE_EXTERNAL_STORAGE, "
82  + "android.permission.READ_EXTERNAL_STORAGE")
83 @UsesLibraries(libraries = "osmdroid.aar, osmdroid.jar, androidsvg.jar, jts.jar")
84 public class Map extends MapFeatureContainerBase implements MapEventListener {
85  private static final String TAG = Map.class.getSimpleName();
86 
87  private static final String ERROR_INVALID_NUMBER = "%s is not a valid number.";
88  private static final String ERROR_LATITUDE_OUT_OF_BOUNDS = "Latitude %f is out of bounds.";
89  private static final String ERROR_LONGITUDE_OUT_OF_BOUNDS = "Longitude %f is out of bounds.";
90 
94  private MapController mapController = null;
95 
96  private LocationSensor sensor = null;
97 
103  public Map(final ComponentContainer container) {
104  super(container);
105  Log.d(TAG, "Map.<init>");
106  container.$add(this);
109  CenterFromString("42.359144, -71.093612");
110  ZoomLevel(13);
111  EnableZoom(true);
112  EnablePan(true);
113  MapType(1);
114  ShowCompass(false);
115  LocationSensor(new LocationSensor(container.$form(), false));
116  ShowUser(false);
117  ShowZoom(false);
118  EnableRotation(false);
119  ShowScale(false);
120  }
121 
122  @Override
123  public View getView() {
124  if (mapController == null) {
125  mapController = MapFactory.newMap(container.$form());
126  mapController.addEventListener(this);
127  }
128  return mapController.getView();
129  }
130 
142  @SuppressWarnings("squid:S00100")
143  @DesignerProperty(defaultValue = "42.359144, -71.093612",
146  description = "<p>Set the initial center coordinate of the map. The value is specified as " +
147  "a comma-separated pair of decimal latitude and longitude coordinates, for example, " +
148  "<code>42.359144, -71.093612</code>.</p><p>In blocks code, it is recommended for " +
149  "performance reasons to use SetCenter with numerical latitude and longitude rather " +
150  "than convert to the string representation for use with this property.</p>")
151  public void CenterFromString(String center) {
152  String[] parts = center.split(",");
153  if (parts.length != 2) {
154  Log.e(TAG, center + " is not a valid point.");
155  InvalidPoint(center + " is not a valid point.");
156  return;
157  }
158  double latitude;
159  double longitude;
160  try {
161  latitude = Double.parseDouble(parts[0].trim());
162  } catch (NumberFormatException e) {
163  Log.e(TAG, String.format(ERROR_INVALID_NUMBER, parts[0]));
164  InvalidPoint(String.format(ERROR_INVALID_NUMBER, parts[0]));
165  return;
166  }
167  try {
168  longitude = Double.parseDouble(parts[1].trim());
169  } catch (NumberFormatException e) {
170  Log.e(TAG, String.format(ERROR_INVALID_NUMBER, parts[1]));
171  InvalidPoint(String.format(ERROR_INVALID_NUMBER, parts[1]));
172  return;
173  }
174  if (latitude > 90.0 || latitude < -90.0) {
175  InvalidPoint(String.format(ERROR_LATITUDE_OUT_OF_BOUNDS, latitude));
176  } else if (longitude > 180.0 || longitude < -180.0) {
177  InvalidPoint(String.format(ERROR_LONGITUDE_OUT_OF_BOUNDS, longitude));
178  } else {
179  Log.i(TAG, "Setting center to " + latitude + ", " + longitude);
180  mapController.setCenter(latitude, longitude);
181  }
182  }
183 
190  @SuppressWarnings("squid:S00100")
192  description = "The latitude of the center of the map.")
193  public double Latitude() {
194  return mapController.getLatitude();
195  }
196 
203  @SuppressWarnings("squid:S00100")
205  description = "The longitude of the center of the map.")
206  public double Longitude() {
207  return mapController.getLongitude();
208  }
209 
221  defaultValue = "13")
223  public void ZoomLevel(int zoom) {
224  mapController.setZoom(zoom);
225  }
226 
234  description = "The zoom level of the map. Valid values of ZoomLevel are " +
235  "dependent on the tile provider and the latitude and longitude of the map. For " +
236  "example, zoom levels are more constrained over oceans than dense city centers to " +
237  "conserve space for storing tiles, so valid values may be 1-7 over ocean and 1-18 " +
238  "over cities. Tile providers may send warning or error tiles if the zoom level is too " +
239  "great for the server to support.")
240  public int ZoomLevel() {
241  return mapController.getZoom();
242  }
243 
251  @SuppressWarnings("WeakerAccess")
252  @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN, defaultValue = "True")
254  public void EnableZoom(boolean zoom) {
255  mapController.setZoomEnabled(zoom);
256  }
257 
264  description = "If this property is set to true, multitouch zoom gestures are allowed on " +
265  "the map. Otherwise, the map zoom cannot be changed by the user except via the zoom " +
266  "control buttons.")
267  public boolean EnableZoom() {
268  return mapController.isZoomEnabled();
269  }
270 
271  @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_FLOAT, defaultValue = "0.0")
273  public void Rotation(float rotation) {
274  mapController.setRotation(rotation);
275  }
276 
280  @SimpleProperty (category = PropertyCategory.APPEARANCE, description = "Sets or gets the rotation of the map in decimal degrees if any")
281  public float Rotation() {
282  return mapController.getRotation();
283  }
284 
296  defaultValue = "1")
298  public void MapType(int type) {
299  MapFactory.MapType newType = MapFactory.MapType.values()[type];
300  mapController.setMapType(newType);
301  }
302 
317  description = "The type of tile layer to use as the base of the map. Valid values " +
318  "are: 1 (Roads), 2 (Aerial), 3 (Terrain)")
319  public int MapType() {
320  return mapController.getMapType().ordinal();
321  }
322 
330  defaultValue = "False")
332  public void ShowCompass(boolean compass) {
333  mapController.setCompassEnabled(compass);
334  }
335 
343  description = "Show a compass icon rotated based on user orientation.")
344  public boolean ShowCompass() {
345  return mapController.isCompassEnabled();
346  }
347 
356  defaultValue = "False")
358  public void ShowZoom(boolean zoom) {
359  mapController.setZoomControlEnabled(zoom);
360  }
361 
369  description = "Show zoom buttons on the map.")
370  public boolean ShowZoom() {
371  return mapController.isZoomControlEnabled();
372  }
373 
382  defaultValue = "False")
384  public void ShowUser(boolean user) {
385  mapController.setShowUserEnabled(user);
386  }
387 
395  description = "Show the user's location on the map.")
396  public boolean ShowUser() {
397  return mapController.isShowUserEnabled();
398  }
399 
406  defaultValue = "False")
408  public void EnableRotation(boolean rotation) {
409  mapController.setRotationEnabled(rotation);
410  }
411 
418  description = "If set to true, the user can use multitouch gestures to rotate the map " +
419  "around its current center.")
420  public boolean EnableRotation() {
421  return mapController.isRotationEnabled();
422  }
423 
424  @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN, defaultValue = "True")
426  public void EnablePan(boolean pan) {
427  mapController.setPanEnabled(pan);
428  }
429 
434  description = "Enable two-finger panning of the Map")
435  public boolean EnablePan() {
436  return mapController.isPanEnabled();
437  }
438 
440  public void BoundingBox(YailList boundingbox) {
441  double latNorth = GeometryUtil.coerceToDouble(((YailList) boundingbox.get(1)).get(1));
442  double longWest = GeometryUtil.coerceToDouble(((YailList)boundingbox.get(1)).get(2));
443  double latSouth = GeometryUtil.coerceToDouble(((YailList)boundingbox.get(2)).get(1));
444  double longEast = GeometryUtil.coerceToDouble(((YailList)boundingbox.get(2)).get(2));
445  mapController.setBoundingBox(new BoundingBox(latNorth, longEast, latSouth, longWest));
446  }
447 
454  description = "Bounding box for the map stored as [[North, West], [South, East]].")
456  BoundingBox bbox = mapController.getBoundingBox();
457  YailList northwest = YailList.makeList(new Double[] { bbox.getLatNorth(), bbox.getLonWest() });
458  YailList southeast = YailList.makeList(new Double[] { bbox.getLatSouth(), bbox.getLonEast() });
459  return YailList.makeList(new YailList[] { northwest, southeast });
460  }
461 
462  @Override
464  public YailList Features() {
465  return super.Features();
466  }
467 
473  description = "Uses the provided LocationSensor for user location data rather than the " +
474  "built-in location provider.")
475  @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_COMPONENT + ":com.google.appinventor.components.runtime.LocationSensor")
476  public void LocationSensor(LocationSensor sensor) {
477  LocationSensorListener listener = mapController.getLocationListener();
478  if (this.sensor != null) {
479  this.sensor.removeListener(listener);
480  }
481  this.sensor = sensor;
482  if (this.sensor != null) {
483  this.sensor.addListener(listener);
484  }
485  }
486 
488  return sensor;
489  }
490 
495  @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN, defaultValue = "False")
497  public void ShowScale(boolean show) {
498  mapController.setScaleVisible(show);
499  }
500 
502  description = "Shows a scale reference on the map.")
503  public boolean ShowScale() {
504  return mapController.isScaleVisible();
505  }
506 
512  defaultValue = "1")
514  public void ScaleUnits(int units) {
515  if (1 <= units && units < MapScaleUnits.values().length) {
516  mapController.setScaleUnits(MapScaleUnits.values()[units]);
517  } else {
518  $form().dispatchErrorOccurredEvent(this, "ScaleUnits",
520  }
521  }
522 
524  public int ScaleUnits() {
525  switch (mapController.getScaleUnits()) {
526  case METRIC:
527  return 1;
528  case IMPERIAL:
529  return 2;
530  default:
531  return 0;
532  }
533  }
534 
536  description = "Returns the user's latitude if ShowUser is enabled.")
537  public double UserLatitude() {
538  return sensor == null ? -999 : sensor.Latitude();
539  }
540 
542  description = "Returns the user's longitude if ShowUser is enabled.")
543  public double UserLongitude() {
544  return sensor == null ? -999 : sensor.Longitude();
545  }
546 
547  @SimpleFunction(description = "Pans the map center to the given latitude and longitude and " +
548  "adjust the zoom level to the specified zoom.")
549  public void PanTo(double latitude, double longitude, int zoom) {
550  mapController.panTo(latitude, longitude, zoom, 1);
551  }
552 
560  @SimpleFunction(description = "Create a new marker with default properties at the specified " +
561  "latitude and longitude.")
562  public Marker CreateMarker(double latitude, double longitude) {
563  Marker marker = new Marker(this);
564  marker.SetLocation(latitude, longitude);
565  return marker;
566  }
567 
571  @SimpleFunction(description = "Save the contents of the Map to the specified path.")
572  public void Save(final String path) {
573  final List<MapFeature> featuresToSave = new ArrayList<MapFeature>(features);
574  AsynchUtil.runAsynchronously(new Runnable() {
575  @Override
576  public void run() {
577  try {
578  GeoJSONUtil.writeFeaturesAsGeoJSON(featuresToSave, path);
579  } catch(final IOException e) {
580  final Form form = $form();
581  form.runOnUiThread(new Runnable() {
582  @Override
583  public void run() {
584  form.dispatchErrorOccurredEvent(Map.this, "Save",
586  }
587  });
588  }
589  }
590  });
591  }
592 
596  @SuppressWarnings({"WeakerAccess", "squid:S00100"})
597  @SimpleEvent(description = "Map has been initialized and is ready for user interaction.")
598  public void Ready() {
599  EventDispatcher.dispatchEvent(this, "Ready");
600  }
601 
606  @SimpleEvent(description = "User has changed the map bounds by panning or zooming the map.")
607  public void BoundsChange() {
608  EventDispatcher.dispatchEvent(this, "BoundsChange");
609  }
610 
615  @SimpleEvent(description = "User has changed the zoom level of the map.")
616  public void ZoomChange() {
617  EventDispatcher.dispatchEvent(this, "ZoomChange");
618  }
619 
628  @SimpleEvent(description = "An invalid coordinate was supplied during a maps operation. The " +
629  "message parameter will have more details about the issue.")
630  public void InvalidPoint(String message) {
631  EventDispatcher.dispatchEvent(this, "InvalidPoint", message);
632  }
633 
639  @SimpleEvent(description = "The user tapped at a point on the map.")
640  public void TapAtPoint(double latitude, double longitude) {
641  EventDispatcher.dispatchEvent(this, "TapAtPoint", latitude, longitude);
642  }
643 
649  @SimpleEvent(description = "The user double-tapped at a point on the map. This event will be " +
650  "followed by a ZoomChanged event if zooming gestures are enabled and the map is not at " +
651  "the highest possible zoom level.")
652  public void DoubleTapAtPoint(double latitude, double longitude) {
653  EventDispatcher.dispatchEvent(this, "DoubleTapAtPoint", latitude, longitude);
654  }
655 
662  @SimpleEvent(description = "The user long-pressed at a point on the map.")
663  public void LongPressAtPoint(double latitude, double longitude) {
664  EventDispatcher.dispatchEvent(this, "LongPressAtPoint", latitude, longitude);
665  }
666 
668  return mapController;
669  }
670 
671  // MapEventListener implementation
672  @Override
673  public void onReady(MapController map) {
674  container.$form().runOnUiThread(new Runnable() {
675  @Override
676  public void run() {
677  Map.this.Ready();
678  }
679  });
680  }
681 
682  @Override
683  public void onBoundsChanged() {
684  container.$form().runOnUiThread(new Runnable() {
685  @Override
686  public void run() {
687  Map.this.BoundsChange();
688  }
689  });
690  }
691 
692  @Override
693  public void onZoom() {
694  container.$form().runOnUiThread(new Runnable() {
695  @Override
696  public void run() {
697  Map.this.ZoomChange();
698  }
699  });
700  }
701 
702  @Override
703  public void onSingleTap(final double latitude, final double longitude) {
704  container.$form().runOnUiThread(new Runnable() {
705  @Override
706  public void run() {
707  Map.this.TapAtPoint(latitude, longitude);
708  }
709  });
710  }
711 
712  @Override
713  public void onDoubleTap(final double latitude, final double longitude) {
714  container.$form().runOnUiThread(new Runnable() {
715  @Override
716  public void run() {
717  Map.this.DoubleTapAtPoint(latitude, longitude);
718  }
719  });
720  }
721 
722  @Override
723  public void onLongPress(final double latitude, final double longitude) {
724  container.$form().runOnUiThread(new Runnable() {
725  @Override
726  public void run() {
727  Map.this.LongPressAtPoint(latitude, longitude);
728  }
729  });
730  }
731 
732  @Override
733  public void onFeatureClick(final MapFeature feature) {
734  container.$form().runOnUiThread(new Runnable() {
735  @Override
736  public void run() {
737  feature.Click();
738  }
739  });
740  }
741 
742  @Override
743  public void onFeatureLongPress(final MapFeature feature) {
744  container.$form().runOnUiThread(new Runnable() {
745  @Override
746  public void run() {
747  feature.LongClick();
748  }
749  });
750  }
751 
752  @Override
753  public void onFeatureStartDrag(final MapFeature feature) {
754  container.$form().runOnUiThread(new Runnable() {
755  @Override
756  public void run() {
757  feature.StartDrag();
758  }
759  });
760  }
761 
762  @Override
763  public void onFeatureDrag(final MapFeature feature) {
764  container.$form().runOnUiThread(new Runnable() {
765  @Override
766  public void run() {
767  feature.Drag();
768  }
769  });
770  }
771 
772  @Override
773  public void onFeatureStopDrag(final MapFeature feature) {
774  container.$form().runOnUiThread(new Runnable() {
775  @Override
776  public void run() {
777  feature.StopDrag();
778  }
779  });
780  }
781 
782  @Override
783  public Map getMap() {
784  return this;
785  }
786 
787 
788  // MapFeatureContainerBase optimizations
789  @Override
790  void addFeature(MapMarker marker) {
791  features.add(marker);
792  marker.setMap(this);
793  mapController.addFeature(marker);
794  }
795 
796  @Override
797  void addFeature(MapLineString lineString) {
798  features.add(lineString);
799  lineString.setMap(this);
800  mapController.addFeature(lineString);
801  }
802 
803  @Override
804  void addFeature(MapPolygon polygon) {
805  features.add(polygon);
806  polygon.setMap(this);
807  mapController.addFeature(polygon);
808  }
809 
810  @Override
811  void addFeature(MapRectangle rectangle) {
812  features.add(rectangle);
813  rectangle.setMap(this);
814  mapController.addFeature(rectangle);
815  }
816 
817  @Override
818  void addFeature(MapCircle circle) {
819  features.add(circle);
820  circle.setMap(this);
821  mapController.addFeature(circle);
822  }
823 
824  @Override
825  public void removeFeature(MapFeature feature) {
826  features.remove(feature);
827  mapController.removeFeature(feature);
828  }
829 }
com.google.appinventor.components.runtime.EventDispatcher
Definition: EventDispatcher.java:22
com.google.appinventor.components.runtime.util.MapFactory.MapController.setZoomControlEnabled
void setZoomControlEnabled(boolean enable)
com.google.appinventor.components.runtime.MapFeatureContainerBase
Definition: MapFeatureContainerBase.java:42
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_FLOAT
static final String PROPERTY_TYPE_FLOAT
Definition: PropertyTypeConstants.java:76
com.google.appinventor.components.runtime.util.YailList
Definition: YailList.java:26
com.google.appinventor.components.runtime.util.MapFactory.MapCircle
Definition: MapFactory.java:1028
com.google.appinventor.components.runtime.util.MapFactory.MapController.getLocationListener
LocationSensor.LocationSensorListener getLocationListener()
com.google.appinventor.components.runtime.Map.ScaleUnits
void ScaleUnits(int units)
Definition: Map.java:514
com.google.appinventor.components.runtime.Map.onDoubleTap
void onDoubleTap(final double latitude, final double longitude)
Definition: Map.java:713
com.google.appinventor.components.annotations.SimpleFunction
Definition: SimpleFunction.java:23
com.google.appinventor.components.runtime.util.MapFactory.MapFeature.StopDrag
void StopDrag()
com.google.appinventor.components.annotations.UsesLibraries
Definition: UsesLibraries.java:21
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_MAP_UNIT_SYSTEM
static final String PROPERTY_TYPE_MAP_UNIT_SYSTEM
Definition: PropertyTypeConstants.java:174
com.google.appinventor.components.runtime.Map.removeFeature
void removeFeature(MapFeature feature)
Definition: Map.java:825
com.google.appinventor.components.runtime.util.ErrorMessages
Definition: ErrorMessages.java:17
com.google.appinventor.components.runtime.util
-*- mode: java; c-basic-offset: 2; -*-
Definition: AccountChooser.java:7
com.google.appinventor.components.runtime.util.MapFactory
Definition: MapFactory.java:30
com.google.appinventor.components.runtime.util.MapFactory.MapFeature.LongClick
void LongClick()
com.google.appinventor.components.runtime.util.MapFactory.MapController.getLatitude
double getLatitude()
com.google.appinventor.components.runtime.util.MapFactory.MapFeature.Click
void Click()
com.google.appinventor.components.runtime.Map.Rotation
void Rotation(float rotation)
Definition: Map.java:273
com.google.appinventor.components.runtime.Map.Ready
void Ready()
Definition: Map.java:598
com.google.appinventor.components.common.YaVersion
Definition: YaVersion.java:14
com.google.appinventor.components.runtime.Map.EnableZoom
void EnableZoom(boolean zoom)
Definition: Map.java:254
com.google.appinventor.components.runtime.Map.MapType
void MapType(int type)
Definition: Map.java:298
com.google.appinventor.components.runtime.util.MapFactory.MapController.setZoom
void setZoom(int zoom)
com.google.appinventor.components.runtime.util.BoundingBox
Definition: BoundingBox.java:13
com.google.appinventor.components.annotations.DesignerProperty
Definition: DesignerProperty.java:25
com.google.appinventor.components.runtime.Map.onFeatureClick
void onFeatureClick(final MapFeature feature)
Definition: Map.java:733
com.google.appinventor.components.runtime.Map.onFeatureStartDrag
void onFeatureStartDrag(final MapFeature feature)
Definition: Map.java:753
com.google.appinventor.components.runtime.util.MapFactory.MapScaleUnits
Definition: MapFactory.java:1567
com.google.appinventor.components
com.google.appinventor.components.runtime.util.MapFactory.MapType
Definition: MapFactory.java:1541
com.google.appinventor.components.runtime.util.YailList.makeList
static YailList makeList(Object[] objects)
Definition: YailList.java:59
com.google.appinventor.components.runtime.util.GeometryUtil.coerceToDouble
static double coerceToDouble(Object o)
Definition: GeometryUtil.java:52
com.google.appinventor.components.runtime.util.MapFactory.MapController.getBoundingBox
BoundingBox getBoundingBox()
com.google.appinventor.components.runtime.util.MapFactory.MapLineString
Definition: MapFactory.java:1373
com.google.appinventor.components.runtime.Map.LocationSensor
LocationSensor LocationSensor()
Definition: Map.java:487
com.google.appinventor.components.runtime.util.MapFactory.MapPolygon
Definition: MapFactory.java:1410
com.google.appinventor.components.runtime.Map.onZoom
void onZoom()
Definition: Map.java:693
com.google.appinventor.components.runtime.util.MapFactory.MapController.setRotation
void setRotation(float Rotation)
com.google.appinventor.components.runtime.util.MapFactory.newMap
static MapController newMap(Form form)
Definition: MapFactory.java:1597
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN
static final String PROPERTY_TYPE_BOOLEAN
Definition: PropertyTypeConstants.java:35
com.google.appinventor.components.runtime.util.MapFactory.MapController.isZoomEnabled
boolean isZoomEnabled()
com.google.appinventor.components.runtime.Map.getController
MapController getController()
Definition: Map.java:667
com.google.appinventor.components.runtime.Map.ScaleUnits
int ScaleUnits()
Definition: Map.java:524
com.google.appinventor.components.annotations.DesignerComponent
Definition: DesignerComponent.java:22
com.google.appinventor.components.annotations.SimpleEvent
Definition: SimpleEvent.java:20
com.google.appinventor.components.runtime.util.MapFactory.MapController.setScaleVisible
void setScaleVisible(boolean show)
com.google.appinventor.components.runtime.Map.EnablePan
void EnablePan(boolean pan)
Definition: Map.java:426
com.google.appinventor.components.annotations.PropertyCategory.BEHAVIOR
BEHAVIOR
Definition: PropertyCategory.java:15
com.google.appinventor.components.runtime.Marker.SetLocation
void SetLocation(double latitude, double longitude)
Definition: Marker.java:444
com.google.appinventor.components.runtime.util.MapFactory.MapRectangle
Definition: MapFactory.java:1099
com.google.appinventor.components.runtime.util.MapFactory.MapController.isCompassEnabled
boolean isCompassEnabled()
com.google.appinventor.components.runtime.Map.LongPressAtPoint
void LongPressAtPoint(double latitude, double longitude)
Definition: Map.java:663
com.google.appinventor.components.runtime.LocationSensor.removeListener
void removeListener(LocationSensorListener listener)
Definition: LocationSensor.java:780
com.google.appinventor.components.runtime.Map.ShowScale
void ShowScale(boolean show)
Definition: Map.java:497
com.google.appinventor.components.runtime.util.MapFactory.MapFeature.StartDrag
void StartDrag()
com.google.appinventor.components.runtime.Map.onBoundsChanged
void onBoundsChanged()
Definition: Map.java:683
com.google.appinventor.components.runtime.Map.onFeatureDrag
void onFeatureDrag(final MapFeature feature)
Definition: Map.java:763
com.google.appinventor.components.runtime.util.MapFactory.MapFeature.setMap
void setMap(MapFeatureContainer map)
com.google.appinventor.components.runtime.util.MapFactory.MapController.isRotationEnabled
boolean isRotationEnabled()
com.google.appinventor.components.runtime.Map.DoubleTapAtPoint
void DoubleTapAtPoint(double latitude, double longitude)
Definition: Map.java:652
com.google.appinventor.components.runtime.ComponentContainer.$add
void $add(AndroidViewComponent component)
com.google.appinventor.components.runtime.util.MapFactory.MapController.getScaleUnits
MapScaleUnits getScaleUnits()
com.google.appinventor.components.runtime.Map.ZoomChange
void ZoomChange()
Definition: Map.java:616
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_GEOGRAPHIC_POINT
static final String PROPERTY_TYPE_GEOGRAPHIC_POINT
Definition: PropertyTypeConstants.java:82
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_MAP_ZOOM
static final String PROPERTY_TYPE_MAP_ZOOM
Definition: PropertyTypeConstants.java:187
com.google.appinventor.components.annotations.UsesPermissions
Definition: UsesPermissions.java:21
com.google.appinventor.components.runtime.util.MapFactory.MapController.setScaleUnits
void setScaleUnits(MapScaleUnits units)
com.google.appinventor.components.runtime.util.MapFactory.MapController.isPanEnabled
boolean isPanEnabled()
com.google.appinventor.components.runtime.util.MapFactory.MapMarker
Definition: MapFactory.java:1205
com.google.appinventor.components.runtime.util.MapFactory.MapController.panTo
void panTo(double latitude, double longitude, int zoom, double seconds)
com.google.appinventor.components.common.ComponentConstants.MAP_PREFERRED_HEIGHT
static final int MAP_PREFERRED_HEIGHT
Definition: ComponentConstants.java:96
com.google.appinventor.components.runtime.util.MapFactory.MapController
Definition: MapFactory.java:134
com.google.appinventor.components.runtime.util.MapFactory.MapFeature
Definition: MapFactory.java:588
com.google.appinventor.components.runtime.LocationSensor.Longitude
double Longitude()
Definition: LocationSensor.java:473
com.google.appinventor.components.annotations.UsesAssets
Definition: UsesAssets.java:21
com.google.appinventor.components.runtime.util.MapFactory.MapController.isScaleVisible
boolean isScaleVisible()
com.google.appinventor.components.runtime.EventDispatcher.dispatchEvent
static boolean dispatchEvent(Component component, String eventName, Object...args)
Definition: EventDispatcher.java:188
com.google.appinventor.components.runtime.Map.Features
YailList Features()
Definition: Map.java:464
com.google.appinventor.components.runtime.Map.Map
Map(final ComponentContainer container)
Definition: Map.java:103
com.google.appinventor.components.runtime.util.MapFactory.MapController.setCenter
void setCenter(double latitude, double longitude)
com.google.appinventor.components.runtime.util.MapFactory.MapController.setShowUserEnabled
void setShowUserEnabled(boolean enable)
com.google.appinventor.components.runtime.Map.ZoomLevel
void ZoomLevel(int zoom)
Definition: Map.java:223
com.google.appinventor.components.runtime.Map.onFeatureLongPress
void onFeatureLongPress(final MapFeature feature)
Definition: Map.java:743
com.google.appinventor.components.runtime.util.MapFactory.MapController.setBoundingBox
void setBoundingBox(BoundingBox bbox)
com.google.appinventor.components.runtime.Map.onFeatureStopDrag
void onFeatureStopDrag(final MapFeature feature)
Definition: Map.java:773
com.google.appinventor.components.annotations.SimpleProperty
Definition: SimpleProperty.java:23
com.google.appinventor.components.runtime.util.GeometryUtil
Definition: GeometryUtil.java:41
com.google.appinventor.components.runtime.Map.getView
View getView()
Definition: Map.java:123
com.google.appinventor.components.runtime.LocationSensor.Latitude
double Latitude()
Definition: LocationSensor.java:483
com.google.appinventor.components.runtime.util.AsynchUtil.runAsynchronously
static void runAsynchronously(final Runnable call)
Definition: AsynchUtil.java:23
com.google.appinventor.components.annotations.PropertyCategory
Definition: PropertyCategory.java:13
com.google.appinventor.components.runtime.Map.ShowUser
void ShowUser(boolean user)
Definition: Map.java:384
com.google.appinventor.components.runtime.Map.ShowZoom
void ShowZoom(boolean zoom)
Definition: Map.java:358
com.google.appinventor.components.runtime.util.MapFactory.MapController.getRotation
float getRotation()
com.google.appinventor.components.runtime.util.MapFactory.MapController.setCompassEnabled
void setCompassEnabled(boolean enable)
com.google.appinventor.components.runtime.ComponentContainer
Definition: ComponentContainer.java:16
com.google.appinventor.components.runtime
Copyright 2009-2011 Google, All Rights reserved.
Definition: AccelerometerSensor.java:8
com.google.appinventor.components.runtime.Map
Definition: Map.java:84
com.google.appinventor.components.runtime.util.MapFactory.MapController.getZoom
int getZoom()
com.google.appinventor.components.runtime.util.MapFactory.MapController.setMapType
void setMapType(MapType type)
com.google.appinventor.components.runtime.LocationSensor
Definition: LocationSensor.java:81
com.google.appinventor.components.common
Definition: ComponentCategory.java:7
com.google.appinventor.components.runtime.Map.BoundingBox
void BoundingBox(YailList boundingbox)
Definition: Map.java:440
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_COMPONENT
static final String PROPERTY_TYPE_COMPONENT
Definition: PropertyTypeConstants.java:70
com.google.appinventor.components.common.ComponentCategory
Definition: ComponentCategory.java:48
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_EXCEPTION_DURING_MAP_SAVE
static final int ERROR_EXCEPTION_DURING_MAP_SAVE
Definition: ErrorMessages.java:241
com.google.appinventor.components.runtime.Form.dispatchErrorOccurredEvent
void dispatchErrorOccurredEvent(final Component component, final String functionName, final int errorNumber, final Object... messageArgs)
Definition: Form.java:1011
com.google.appinventor.components.runtime.Map.ShowCompass
void ShowCompass(boolean compass)
Definition: Map.java:332
com.google.appinventor.components.runtime.LocationSensor.LocationSensorListener
Definition: LocationSensor.java:84
com.google.appinventor.components.annotations.SimpleObject
Definition: SimpleObject.java:23
com.google.appinventor.components.runtime.Map.onLongPress
void onLongPress(final double latitude, final double longitude)
Definition: Map.java:723
com.google.appinventor.components.runtime.util.AsynchUtil
Definition: AsynchUtil.java:17
com.google
com.google.appinventor.components.runtime.util.MapFactory.MapController.addEventListener
void addEventListener(MapEventListener listener)
com
com.google.appinventor.components.runtime.Map.onSingleTap
void onSingleTap(final double latitude, final double longitude)
Definition: Map.java:703
com.google.appinventor.components.runtime.Marker
Definition: Marker.java:50
com.google.appinventor.components.runtime.util.MapFactory.MapFeature.Drag
void Drag()
com.google.appinventor.components.runtime.Map.EnableRotation
void EnableRotation(boolean rotation)
Definition: Map.java:408
com.google.appinventor.components.runtime.util.MapFactory.MapEventListener
Definition: MapFactory.java:37
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_INVALID_UNIT_SYSTEM
static final int ERROR_INVALID_UNIT_SYSTEM
Definition: ErrorMessages.java:250
com.google.appinventor.components.runtime.Map.getMap
Map getMap()
Definition: Map.java:783
com.google.appinventor.components.runtime.Map.BoundsChange
void BoundsChange()
Definition: Map.java:607
com.google.appinventor.components.runtime.util.MapFactory.MapController.isShowUserEnabled
boolean isShowUserEnabled()
com.google.appinventor.components.runtime.ComponentContainer.$form
Form $form()
com.google.appinventor.components.common.ComponentConstants
Definition: ComponentConstants.java:13
com.google.appinventor.components.runtime.util.MapFactory.MapController.addFeature
void addFeature(MapMarker marker)
com.google.appinventor.components.runtime.util.MapFactory.MapController.getView
View getView()
com.google.appinventor.components.runtime.util.MapFactory.MapController.setRotationEnabled
void setRotationEnabled(boolean enable)
com.google.appinventor.components.runtime.util.GeoJSONUtil.writeFeaturesAsGeoJSON
static void writeFeaturesAsGeoJSON(List< MapFactory.MapFeature > featuresToSave, String path)
Definition: GeoJSONUtil.java:760
com.google.appinventor.components.runtime.util.MapFactory.MapController.isZoomControlEnabled
boolean isZoomControlEnabled()
com.google.appinventor.components.runtime.Form
Definition: Form.java:126
com.google.appinventor.components.runtime.util.MapFactory.MapController.setPanEnabled
void setPanEnabled(boolean enable)
com.google.appinventor.components.runtime.Map.TapAtPoint
void TapAtPoint(double latitude, double longitude)
Definition: Map.java:640
com.google.appinventor.components.runtime.util.GeoJSONUtil
Definition: GeoJSONUtil.java:46
com.google.appinventor.components.runtime.util.MapFactory.MapController.setZoomEnabled
void setZoomEnabled(boolean enable)
com.google.appinventor.components.annotations.PropertyCategory.APPEARANCE
APPEARANCE
Definition: PropertyCategory.java:16
com.google.appinventor.components.runtime.util.MapFactory.MapController.getLongitude
double getLongitude()
com.google.appinventor.components.common.PropertyTypeConstants
Definition: PropertyTypeConstants.java:14
com.google.appinventor.components.annotations
com.google.appinventor.components.runtime.util.MapFactory.MapController.getMapType
MapType getMapType()
com.google.appinventor.components.common.ComponentConstants.MAP_PREFERRED_WIDTH
static final int MAP_PREFERRED_WIDTH
Definition: ComponentConstants.java:95
com.google.appinventor
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_MAP_TYPE
static final String PROPERTY_TYPE_MAP_TYPE
Definition: PropertyTypeConstants.java:181
com.google.appinventor.components.runtime.Map.onReady
void onReady(MapController map)
Definition: Map.java:673
com.google.appinventor.components.runtime.util.MapFactory.MapController.removeFeature
void removeFeature(MapFeature feature)