Inherited by com.google.appinventor.components.runtime.util.DummyMapController, and com.google.appinventor.components.runtime.util.NativeOpenStreetMapController.
MapController provides a high-level abstraction for the platform-specific implementation used for the Map implementation. See NativeOpenStreetMapController for an OpenStreetMap based solution compatible with newer devices and DummyMapController for a version that works on any platform using a WebView component.
- Author
- ewpatton
Definition at line 134 of file MapFactory.java.
◆ addEventListener()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.addEventListener |
( |
MapEventListener |
listener | ) |
|
Add an event listener to the Map controller.
- Parameters
-
listener | an object that will receive map events |
◆ addFeature() [1/5]
void com.google.appinventor.components.runtime.util.MapFactory.MapController.addFeature |
( |
MapCircle |
circle | ) |
|
Add a circle to the map.
- Parameters
-
circle | the circle to add to the map |
◆ addFeature() [2/5]
void com.google.appinventor.components.runtime.util.MapFactory.MapController.addFeature |
( |
MapLineString |
linestring | ) |
|
Add a linestring to the map.
- Parameters
-
linestring | the line string to add to the map |
◆ addFeature() [3/5]
void com.google.appinventor.components.runtime.util.MapFactory.MapController.addFeature |
( |
MapMarker |
marker | ) |
|
Add a marker to the map.
- Parameters
-
marker | the marker to add to the map |
◆ addFeature() [4/5]
void com.google.appinventor.components.runtime.util.MapFactory.MapController.addFeature |
( |
MapPolygon |
polygon | ) |
|
Add a polygon to the map.
- Parameters
-
polygon | the polygon to add to the map |
◆ addFeature() [5/5]
void com.google.appinventor.components.runtime.util.MapFactory.MapController.addFeature |
( |
MapRectangle |
rectangle | ) |
|
Add a rectangle to the map.
- Parameters
-
rectangle | the rectangle to add to the map |
◆ getBoundingBox()
BoundingBox com.google.appinventor.components.runtime.util.MapFactory.MapController.getBoundingBox |
( |
| ) |
|
Get the bounding box for the Map. If rotation is enabled, it is possible that the bounding box will be larger than the phone's viewport.
- Returns
- the bounding box of the map's viewport.
◆ getLatitude()
double com.google.appinventor.components.runtime.util.MapFactory.MapController.getLatitude |
( |
| ) |
|
Get the latitude at the center of the Map's viewport.
- Returns
- the latitude of the map center
◆ getLocationListener()
LocationSensor.LocationSensorListener com.google.appinventor.components.runtime.util.MapFactory.MapController.getLocationListener |
( |
| ) |
|
Get the location sensor implementation used to link the LocationSensorListener interface to the underlying implementation's location sensor mechanism.
- Returns
- a location sensor listener specific to the map instance
◆ getLongitude()
double com.google.appinventor.components.runtime.util.MapFactory.MapController.getLongitude |
( |
| ) |
|
Get the longitude at the center of the Map's viewport.
- Returns
- the longitude of the map center
◆ getMapType()
MapType com.google.appinventor.components.runtime.util.MapFactory.MapController.getMapType |
( |
| ) |
|
Get the type of the map being used.
- Returns
- the type of the map's active tile layer
◆ getOverlayCount()
int com.google.appinventor.components.runtime.util.MapFactory.MapController.getOverlayCount |
( |
| ) |
|
Gets the number of overlays present on the map.
- Returns
- the number of overlays on the map
◆ getRotation()
float com.google.appinventor.components.runtime.util.MapFactory.MapController.getRotation |
( |
| ) |
|
Gets the rotation of the map in degrees
- Returns
- the rotation
◆ getScaleUnits()
MapScaleUnits com.google.appinventor.components.runtime.util.MapFactory.MapController.getScaleUnits |
( |
| ) |
|
Gets the units for the scale.
- Returns
- the units used for the scale overlay
◆ getView()
View com.google.appinventor.components.runtime.util.MapFactory.MapController.getView |
( |
| ) |
|
Get the underlying Android view used for the Map in the view hierarchy.
- Returns
- The Map's View
◆ getZoom()
int com.google.appinventor.components.runtime.util.MapFactory.MapController.getZoom |
( |
| ) |
|
Get the zoom level of the Map.
- Returns
- the zoom level of the map
◆ hideFeature()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.hideFeature |
( |
MapFeature |
feature | ) |
|
◆ hideInfobox()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.hideInfobox |
( |
MapFeature |
feature | ) |
|
Hide the infobox attached to a map feature. The feature must have been previously added via one of the addFeature calls, the feature must be shown on the map, and the infobox must be displayed for this call to have any effect.
- See also
- showInfobox(MapFeature)
- Parameters
-
feature | the feature with the infobox to hide |
◆ isCompassEnabled()
boolean com.google.appinventor.components.runtime.util.MapFactory.MapController.isCompassEnabled |
( |
| ) |
|
Get whether the compass is displayed on the map.
- Returns
- true if the compass overlay is enabled, otherwise false.
◆ isFeatureCollectionVisible()
boolean com.google.appinventor.components.runtime.util.MapFactory.MapController.isFeatureCollectionVisible |
( |
MapFeatureCollection |
collection | ) |
|
Gets whether the feature collection is visible or not.
- Parameters
-
collection | the collection to check. |
- Returns
- true if the collection is visible, otherwise false. This may not guarantee that the children of the collection are visible within the viewport.
◆ isFeatureVisible()
boolean com.google.appinventor.components.runtime.util.MapFactory.MapController.isFeatureVisible |
( |
MapFeature |
feature | ) |
|
Gets whether the feature is visible or not.
- Parameters
-
feature | the feature to check |
- Returns
- true if the feature is visible, otherwise false. This may not guarantee that the feature is drawn within the viewport. It may be offscreen.
◆ isInfoboxVisible()
boolean com.google.appinventor.components.runtime.util.MapFactory.MapController.isInfoboxVisible |
( |
MapFeature |
feature | ) |
|
Gets whether the feature's infobox is visible. If the feature does not have an infobox, this will always return false.
- Returns
- true if the infobox exists and is visible, otherwise false. The infobox may be visible but drawn offscreen if it is not within the map bounds.
◆ isPanEnabled()
boolean com.google.appinventor.components.runtime.util.MapFactory.MapController.isPanEnabled |
( |
| ) |
|
Get whether panning gestures are enabled on the map.
- Returns
- true if panning is enabled, otherwise false.
◆ isRotationEnabled()
boolean com.google.appinventor.components.runtime.util.MapFactory.MapController.isRotationEnabled |
( |
| ) |
|
Get whether rotation gestures are enabled on the map.
- Returns
- true if rotation is enabled, otherwise false.
◆ isScaleVisible()
boolean com.google.appinventor.components.runtime.util.MapFactory.MapController.isScaleVisible |
( |
| ) |
|
Gets the visibility of the scale on the map. A true value does not guarantee that the scale is visible to the user (i.e., if the Map is not visible).
- Returns
- true if the scale is enabled on the map, otherwise false.
◆ isShowUserEnabled()
boolean com.google.appinventor.components.runtime.util.MapFactory.MapController.isShowUserEnabled |
( |
| ) |
|
Get whether the user's location is displayed on the map. Note that this does not necessarily mean that the indicator is visible (e.g., GPS fix has not been acquired).
- Returns
- true if the user location overlay is enabled, otherwise false.
◆ isZoomControlEnabled()
boolean com.google.appinventor.components.runtime.util.MapFactory.MapController.isZoomControlEnabled |
( |
| ) |
|
Get whether zoom controls are enabled on the map.
- Returns
- true if zoom controls are enabled, otherwise false.
◆ isZoomEnabled()
boolean com.google.appinventor.components.runtime.util.MapFactory.MapController.isZoomEnabled |
( |
| ) |
|
Get whether zooming is enabled on the map.
- Returns
- true if the zoom gestures are enabled, otherwise false.
◆ panTo()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.panTo |
( |
double |
latitude, |
|
|
double |
longitude, |
|
|
int |
zoom, |
|
|
double |
seconds |
|
) |
| |
Pan to the indicated latitude and longitude, zooming to the specified zoom level over a set period of time.
- Parameters
-
latitude | Latitude of the new center for the map's viewport. |
longitude | Longitude of the new center for the map's viewport. |
zoom | Possibly new zoom level for the map's viewport. |
seconds | The amount of time to animate the viewport transition. |
◆ removeFeature()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.removeFeature |
( |
MapFeature |
feature | ) |
|
Remove a map feature.
- Parameters
-
feature | the map feature to remove |
◆ setBoundingBox()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.setBoundingBox |
( |
BoundingBox |
bbox | ) |
|
Set the bounding box for the Map.
- Parameters
-
bbox | the new bounding box for the viewport. The box may be adjusted based on the device viewport and available zoom levels from the current map type. |
◆ setCenter()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.setCenter |
( |
double |
latitude, |
|
|
double |
longitude |
|
) |
| |
Set the center of the map to a specific coordinate.
- Parameters
-
latitude | the latitude of the map center |
longitude | the longitude of the map center |
◆ setCompassEnabled()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.setCompassEnabled |
( |
boolean |
enable | ) |
|
Set whether the compass is displayed on the map.
- Parameters
-
enable | true if the compass overlay should be shown, otherwise false. |
◆ setFeatureCollectionVisible()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.setFeatureCollectionVisible |
( |
MapFeatureCollection |
collection, |
|
|
boolean |
visible |
|
) |
| |
Changes the visibility of the feature collection.
- Parameters
-
collection | the collection which will have its visibility changed |
visible | true if the features in the feature collection should be visible, otherwise false. Note that the feature has its own visibility flag. Both visible flags must be true for the feature to be drawn. |
◆ setMapType()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.setMapType |
( |
MapType |
type | ) |
|
Set the type of the map being used.
- Parameters
-
type | the new map type for the map |
◆ setPanEnabled()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.setPanEnabled |
( |
boolean |
enable | ) |
|
Set whether panning gestures are enabled on the map.
- Parameters
-
enable | true if the map should allow panning, false otherwise. Implementations that do not support panning need not honor this flag. |
◆ setRotation()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.setRotation |
( |
float |
Rotation | ) |
|
Sets the rotation of the map in degrees
- Parameters
-
◆ setRotationEnabled()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.setRotationEnabled |
( |
boolean |
enable | ) |
|
Set whether rotation gestures are enabled on the map.
- Parameters
-
enable | true if the map should allow rotation, false otherwise. Implementations that do not support rotation need not honor this flag. |
◆ setScaleUnits()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.setScaleUnits |
( |
MapScaleUnits |
units | ) |
|
Sets the units for the scale. Options are either "metric" or "imperial"
- Parameters
-
units | the new units to show for the scale |
◆ setScaleVisible()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.setScaleVisible |
( |
boolean |
show | ) |
|
Sets whether or not the scale overlay is visible.
- Parameters
-
show | True if the scale should be shown, otherwise false. |
◆ setShowUserEnabled()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.setShowUserEnabled |
( |
boolean |
enable | ) |
|
Set whether the user's location is displayed on the map.
- Parameters
-
enable | true if the user location should be displayed on the map, otherwise false. |
◆ setZoom()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.setZoom |
( |
int |
zoom | ) |
|
Set the zoom level of the Map. Valid values range from 0-18, depending on the selected tile layer.
- Parameters
-
zoom | the new zoom level to set on the map |
- Exceptions
-
IllegalArgumentException | if the zoom level given is outside of the range of valid values for the active tile layer. |
◆ setZoomControlEnabled()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.setZoomControlEnabled |
( |
boolean |
enable | ) |
|
Set whether zoom controls are enabled on the map.
- Parameters
-
enable | true if the zoom buttons should be shown on the map |
◆ setZoomEnabled()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.setZoomEnabled |
( |
boolean |
enable | ) |
|
Set whether zooming is enabled on the map.
- Parameters
-
enable | true if the zoom gestures (pinch/expand) should be enabled on the map, otherwise false. |
◆ showFeature()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.showFeature |
( |
MapFeature |
feature | ) |
|
◆ showInfobox()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.showInfobox |
( |
MapFeature |
feature | ) |
|
Show the infobox attached to a map feature. The feature must have been previously added via one of the addFeature calls and must be shown on the map. The infobox will also be shown as part of the default click action on a map feature.
- See also
- hideInfobox(MapFeature)
- Parameters
-
feature | the feature with the infobox to show |
- Exceptions
-
IllegalArgumentException | if the feature is not on the map |
◆ updateFeatureDraggable()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.updateFeatureDraggable |
( |
MapFeature |
feature | ) |
|
Update whether a feature is draggable in the map.
- Parameters
-
feature | the map feature that needs its draggable state to be updated |
◆ updateFeatureFill()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.updateFeatureFill |
( |
HasFill |
feature | ) |
|
Update the fill color of any map feature that has fill properties.
- Parameters
-
feature | the map feature that needs its fill color updated on the map |
◆ updateFeatureHoles()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.updateFeatureHoles |
( |
MapPolygon |
polygon | ) |
|
Update the holes in a polygon on the map.
- Parameters
-
polygon | the polygon that needs its holes updated |
◆ updateFeatureImage()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.updateFeatureImage |
( |
MapMarker |
marker | ) |
|
Update the image used for a marker.
- Parameters
-
marker | the marker that needs its image updated on the map |
◆ updateFeaturePosition() [1/5]
void com.google.appinventor.components.runtime.util.MapFactory.MapController.updateFeaturePosition |
( |
MapCircle |
circle | ) |
|
Update the position of a circle on the map.
- Parameters
-
circle | the circle that needs its position updated on the map |
◆ updateFeaturePosition() [2/5]
void com.google.appinventor.components.runtime.util.MapFactory.MapController.updateFeaturePosition |
( |
MapLineString |
linestring | ) |
|
Update the position of a linestring on the map.
- Parameters
-
linestring | the line string that needs its position updated on the map |
◆ updateFeaturePosition() [3/5]
void com.google.appinventor.components.runtime.util.MapFactory.MapController.updateFeaturePosition |
( |
MapMarker |
marker | ) |
|
Update the position of the marker on the map.
- Parameters
-
marker | the marker that needs its position updated on the map |
◆ updateFeaturePosition() [4/5]
void com.google.appinventor.components.runtime.util.MapFactory.MapController.updateFeaturePosition |
( |
MapPolygon |
polygon | ) |
|
Update the position of a polygon on the map.
- Parameters
-
polygon | the polygon that needs its position updated on the map |
◆ updateFeaturePosition() [5/5]
void com.google.appinventor.components.runtime.util.MapFactory.MapController.updateFeaturePosition |
( |
MapRectangle |
rectangle | ) |
|
Update the position of a rectangle on the map.
- Parameters
-
rectangle | the rectangle that needs its position updated on the map |
◆ updateFeatureSize()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.updateFeatureSize |
( |
MapMarker |
marker | ) |
|
Update the size of a marker.
- Parameters
-
marker | the marker that needs its size to be updated on the map |
◆ updateFeatureStroke()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.updateFeatureStroke |
( |
HasStroke |
feature | ) |
|
Update the stroke width and color of any map feature that has stroke properties.
- Parameters
-
feature | the map feature that needs its stroke color and width updated on the map |
◆ updateFeatureText()
void com.google.appinventor.components.runtime.util.MapFactory.MapController.updateFeatureText |
( |
MapFeature |
feature | ) |
|
Update the text content of a feature's infobox.
- Parameters
-
feature | the map feature that needs its infobox updated |
The documentation for this interface was generated from the following file:
- C:/Users/Ulli/appinventor-sources/appinventor/components/src/com/google/appinventor/components/runtime/util/MapFactory.java