AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.util.MapFactory.MapController Interface Reference

Inherited by com.google.appinventor.components.runtime.util.DummyMapController, and com.google.appinventor.components.runtime.util.NativeOpenStreetMapController.

Public Member Functions

View getView ()
 
double getLatitude ()
 
double getLongitude ()
 
void setCenter (double latitude, double longitude)
 
void setZoom (int zoom)
 
int getZoom ()
 
MapType getMapType ()
 
void setMapType (MapType type)
 
void setCompassEnabled (boolean enable)
 
boolean isCompassEnabled ()
 
void setZoomEnabled (boolean enable)
 
boolean isZoomEnabled ()
 
void setZoomControlEnabled (boolean enable)
 
boolean isZoomControlEnabled ()
 
void setShowUserEnabled (boolean enable)
 
boolean isShowUserEnabled ()
 
void setRotationEnabled (boolean enable)
 
boolean isRotationEnabled ()
 
void setPanEnabled (boolean enable)
 
boolean isPanEnabled ()
 
void panTo (double latitude, double longitude, int zoom, double seconds)
 
void addEventListener (MapEventListener listener)
 
BoundingBox getBoundingBox ()
 
void setBoundingBox (BoundingBox bbox)
 
void addFeature (MapMarker marker)
 
void addFeature (MapLineString linestring)
 
void addFeature (MapPolygon polygon)
 
void addFeature (MapCircle circle)
 
void addFeature (MapRectangle rectangle)
 
void removeFeature (MapFeature feature)
 
void showFeature (MapFeature feature)
 
void hideFeature (MapFeature feature)
 
boolean isFeatureVisible (MapFeature feature)
 
boolean isFeatureCollectionVisible (MapFeatureCollection collection)
 
void setFeatureCollectionVisible (MapFeatureCollection collection, boolean visible)
 
void showInfobox (MapFeature feature)
 
void hideInfobox (MapFeature feature)
 
boolean isInfoboxVisible (MapFeature feature)
 
void updateFeaturePosition (MapMarker marker)
 
void updateFeaturePosition (MapLineString linestring)
 
void updateFeaturePosition (MapPolygon polygon)
 
void updateFeatureHoles (MapPolygon polygon)
 
void updateFeaturePosition (MapCircle circle)
 
void updateFeaturePosition (MapRectangle rectangle)
 
void updateFeatureFill (HasFill feature)
 
void updateFeatureStroke (HasStroke feature)
 
void updateFeatureText (MapFeature feature)
 
void updateFeatureDraggable (MapFeature feature)
 
void updateFeatureImage (MapMarker marker)
 
void updateFeatureSize (MapMarker marker)
 
LocationSensor.LocationSensorListener getLocationListener ()
 
int getOverlayCount ()
 
void setRotation (float Rotation)
 
float getRotation ()
 
void setScaleVisible (boolean show)
 
boolean isScaleVisible ()
 
void setScaleUnits (MapScaleUnits units)
 
MapScaleUnits getScaleUnits ()
 

Detailed Description

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.

Member Function Documentation

◆ addEventListener()

void com.google.appinventor.components.runtime.util.MapFactory.MapController.addEventListener ( MapEventListener  listener)

Add an event listener to the Map controller.

Parameters
listeneran 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
circlethe 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
linestringthe 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
markerthe 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
polygonthe 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
rectanglethe 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)

Hide a feature on the map. The feature must have been previously added via one of the addFeature calls. Features will be hidden by default if the com.google.appinventor.components.runtime.AndroidViewComponent#Visible() property is false.

See also
showFeature(MapFeature)
Parameters
featurethe feature to hide

◆ 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
featurethe 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
collectionthe 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
featurethe 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
latitudeLatitude of the new center for the map's viewport.
longitudeLongitude of the new center for the map's viewport.
zoomPossibly new zoom level for the map's viewport.
secondsThe 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
featurethe 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
bboxthe 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
latitudethe latitude of the map center
longitudethe 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
enabletrue 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
collectionthe collection which will have its visibility changed
visibletrue 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
typethe 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
enabletrue 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
Rotationin degrees

◆ setRotationEnabled()

void com.google.appinventor.components.runtime.util.MapFactory.MapController.setRotationEnabled ( boolean  enable)

Set whether rotation gestures are enabled on the map.

Parameters
enabletrue 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
unitsthe 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
showTrue 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
enabletrue 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
zoomthe new zoom level to set on the map
Exceptions
IllegalArgumentExceptionif 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
enabletrue 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
enabletrue 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)

Show a feature on the map. The feature must have been previously added via one of the addFeature calls. Features will be shown by default if the com.google.appinventor.components.runtime.AndroidViewComponent#Visible() property is true.

See also
hideFeature(MapFeature)
Parameters
featurethe feature to show
Exceptions
IllegalArgumentExceptionif the feature is not on the map.

◆ 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
featurethe feature with the infobox to show
Exceptions
IllegalArgumentExceptionif 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
featurethe 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
featurethe 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
polygonthe 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
markerthe 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
circlethe 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
linestringthe 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
markerthe 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
polygonthe 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
rectanglethe 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
markerthe 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
featurethe 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
featurethe map feature that needs its infobox updated

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