AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.MapFeatureBase Class Referenceabstract
Inheritance diagram for com.google.appinventor.components.runtime.MapFeatureBase:
com.google.appinventor.components.runtime.util.MapFactory.MapFeature com.google.appinventor.components.runtime.util.MapFactory.HasStroke com.google.appinventor.components.runtime.Component com.google.appinventor.components.runtime.LineString com.google.appinventor.components.runtime.MapFeatureBaseWithFill com.google.appinventor.components.runtime.Marker com.google.appinventor.components.runtime.PolygonBase com.google.appinventor.components.runtime.Circle com.google.appinventor.components.runtime.Polygon com.google.appinventor.components.runtime.Rectangle

Public Member Functions

void setMap (MapFactory.MapFeatureContainer container)
 
void removeFromMap ()
 
void Visible (boolean visibility)
 
boolean Visible ()
 
void StrokeColor (int argb)
 
int StrokeColor ()
 
void StrokeOpacity (float opacity)
 
float StrokeOpacity ()
 
void StrokeWidth (int width)
 
int StrokeWidth ()
 
void Draggable (boolean draggable)
 
boolean Draggable ()
 
void Title (String title)
 
String Title ()
 
void Description (String description)
 
String Description ()
 
void EnableInfobox (boolean enable)
 
boolean EnableInfobox ()
 
void ShowInfobox ()
 
void HideInfobox ()
 
YailList Centroid ()
 
double DistanceToPoint (double latitude, double longitude, boolean centroid)
 
double DistanceToFeature (MapFeature mapFeature, final boolean centroids)
 
void Click ()
 
void LongClick ()
 
void StartDrag ()
 
void Drag ()
 
void StopDrag ()
 
HandlesEventDispatching getDispatchDelegate ()
 
final synchronized GeoPoint getCentroid ()
 
final synchronized Geometry getGeometry ()
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.util.MapFactory.MapFeature
String Type ()
 
< T > T accept (MapFeatureVisitor< T > visitor, Object... arguments)
 
void setMap (MapFeatureContainer map)
 

Protected Member Functions

 MapFeatureBase (MapFeatureContainer container, MapFeatureVisitor< Double > distanceComputation)
 
final synchronized void clearGeometry ()
 
abstract Geometry computeGeometry ()
 

Protected Attributes

MapFeatureContainer container = null
 
Map map = null
 

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 = ""
 

Detailed Description

Definition at line 32 of file MapFeatureBase.java.

Constructor & Destructor Documentation

◆ MapFeatureBase()

com.google.appinventor.components.runtime.MapFeatureBase.MapFeatureBase ( MapFeatureContainer  container,
MapFeatureVisitor< Double >  distanceComputation 
)
protected

Definition at line 95 of file MapFeatureBase.java.

Member Function Documentation

◆ Centroid()

YailList com.google.appinventor.components.runtime.MapFeatureBase.Centroid ( )

Reimplemented in com.google.appinventor.components.runtime.Polygon.

Definition at line 308 of file MapFeatureBase.java.

◆ clearGeometry()

final synchronized void com.google.appinventor.components.runtime.MapFeatureBase.clearGeometry ( )
protected

Definition at line 430 of file MapFeatureBase.java.

◆ Click()

void com.google.appinventor.components.runtime.MapFeatureBase.Click ( )

The Click event runs when the user taps on the type%.

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

Definition at line 358 of file MapFeatureBase.java.

◆ computeGeometry()

◆ Description() [1/2]

String com.google.appinventor.components.runtime.MapFeatureBase.Description ( )

Sets or gets the description displayed in the info window. The info window appears when the user taps on the type%.

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

Definition at line 263 of file MapFeatureBase.java.

◆ Description() [2/2]

void com.google.appinventor.components.runtime.MapFeatureBase.Description ( String  description)

Sets the long text description in the infobox.

Parameters
descriptionthe description of the feature as shown in the infobox.

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

Definition at line 250 of file MapFeatureBase.java.

◆ DistanceToFeature()

double com.google.appinventor.components.runtime.MapFeatureBase.DistanceToFeature ( MapFeature  mapFeature,
final boolean  centroids 
)

Computes the distance between the type% and the given mapFeature. If centroids is true{:.logic.block}, the computation is done between the centroids of the two features. Otherwise, the distance will be computed between the two features based on the closest points. Further, when centroids is false{:.logic.block}, this method will return 0 if the type% intersects or contains the mapFeature. If an error occurs, this method will return -1.

Parameters
mapFeatureThe feature to compute the distance to
centroidsA flag to indicate whether the distance should be computed from the centroids of the two features (true) or from the edges of the two features (false).
Returns
The distance in meters between the two features or -1 if there is an error.

Definition at line 347 of file MapFeatureBase.java.

◆ DistanceToPoint()

double com.google.appinventor.components.runtime.MapFeatureBase.DistanceToPoint ( double  latitude,
double  longitude,
boolean  centroid 
)

Computes the distance between the type% and the given latitude and longitude. If centroids is true{:.logic.block}, the distance is computed from the center of the type% to the given point. Otherwise, the distance is computed from the closest point on the type% to the given point. Further, this method will return 0 if centroids is false{:.logic.block} and the point is in the type%. If an error occurs, -1 will be returned.

Parameters
latitudeThe latitude of the point to compute the distance to
longitudeThe longitude of the point to compute the distance to
centroidA flag to indicate whether the distance should be computed from the centroid of the feature (true) or from the edge (false).
Returns
The distance from the feature to the (latitude, longitude) point, or -1 if there was an error.

Reimplemented in com.google.appinventor.components.runtime.Marker.

Definition at line 329 of file MapFeatureBase.java.

◆ Drag()

void com.google.appinventor.components.runtime.MapFeatureBase.Drag ( )

The Drag event runs in response to position updates of the type% as the user drags it.

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

Definition at line 393 of file MapFeatureBase.java.

◆ Draggable() [1/2]

boolean com.google.appinventor.components.runtime.MapFeatureBase.Draggable ( )

Sets or gets whether or not the user can drag a map feature. This feature is accessed by long-pressing and then dragging the type% to a new location.

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

Definition at line 223 of file MapFeatureBase.java.

◆ Draggable() [2/2]

void com.google.appinventor.components.runtime.MapFeatureBase.Draggable ( boolean  draggable)

Sets whether the map feature is draggable on the map, assuming that the map implementation supports dragging features.

Parameters
draggabletrue if the feature should be draggable by the app user, otherwise false.

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

Definition at line 211 of file MapFeatureBase.java.

◆ EnableInfobox() [1/2]

boolean com.google.appinventor.components.runtime.MapFeatureBase.EnableInfobox ( )

Enables or disables the infobox window display when the user taps the type%.

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

Definition at line 282 of file MapFeatureBase.java.

◆ EnableInfobox() [2/2]

void com.google.appinventor.components.runtime.MapFeatureBase.EnableInfobox ( boolean  enable)

Sets whether the infobox should automatically show when the app user taps the feature

Parameters
enabletrue if the infobox should automatically show when the feature is tapped by the app user, otherwise false.

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

Definition at line 271 of file MapFeatureBase.java.

◆ getCentroid()

final synchronized GeoPoint com.google.appinventor.components.runtime.MapFeatureBase.getCentroid ( )

Gets the centroid of the feature.

Returns
the feature's centroid.

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

Definition at line 414 of file MapFeatureBase.java.

◆ getDispatchDelegate()

HandlesEventDispatching com.google.appinventor.components.runtime.MapFeatureBase.getDispatchDelegate ( )

Returns the dispatch delegate that is responsible for dispatching events for this component.

Implements com.google.appinventor.components.runtime.Component.

Definition at line 409 of file MapFeatureBase.java.

◆ getGeometry()

final synchronized Geometry com.google.appinventor.components.runtime.MapFeatureBase.getGeometry ( )

Gets the geometry of the feature, used for calculating distance and bearing measures.

Returns
the feature's geometry

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

Definition at line 422 of file MapFeatureBase.java.

◆ HideInfobox()

void com.google.appinventor.components.runtime.MapFeatureBase.HideInfobox ( )

Hides the type%'s info box if it is visible. Otherwise, no action is taken.

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

Definition at line 303 of file MapFeatureBase.java.

◆ LongClick()

void com.google.appinventor.components.runtime.MapFeatureBase.LongClick ( )

The LongClick event runs when the user presses and holds the type% and then releases it. This event will only trigger if Draggable() is false{:.logic.block} because it uses the same gesture as StartDrag().

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

Definition at line 371 of file MapFeatureBase.java.

◆ removeFromMap()

void com.google.appinventor.components.runtime.MapFeatureBase.removeFromMap ( )

Removes the feature from its current Map.

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

Definition at line 115 of file MapFeatureBase.java.

◆ setMap()

void com.google.appinventor.components.runtime.MapFeatureBase.setMap ( MapFactory.MapFeatureContainer  container)

Definition at line 110 of file MapFeatureBase.java.

◆ ShowInfobox()

void com.google.appinventor.components.runtime.MapFeatureBase.ShowInfobox ( )

Shows the info box for the type% if it is not visible. Otherwise, this method has no effect. This method can be used to show the info box even if EnableInfobox() is false.

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

Definition at line 293 of file MapFeatureBase.java.

◆ StartDrag()

void com.google.appinventor.components.runtime.MapFeatureBase.StartDrag ( )

The StartDrag event runs when the user presses and holds the type% and then proceeds to move their finger on the screen. It will be followed by the Drag() and StopDrag() events.

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

Definition at line 383 of file MapFeatureBase.java.

◆ StopDrag()

void com.google.appinventor.components.runtime.MapFeatureBase.StopDrag ( )

The StopDrag event runs when the user releases the type% at the end of a drag.

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

Definition at line 403 of file MapFeatureBase.java.

◆ StrokeColor() [1/2]

int com.google.appinventor.components.runtime.MapFeatureBase.StrokeColor ( )

Sets or gets the color used to outline the type%.

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

Definition at line 163 of file MapFeatureBase.java.

◆ StrokeColor() [2/2]

void com.google.appinventor.components.runtime.MapFeatureBase.StrokeColor ( int  argb)

Sets the color used to paint the outline of the feature

Parameters
argbthe outline paint color

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

Reimplemented in com.google.appinventor.components.runtime.Marker.

Definition at line 151 of file MapFeatureBase.java.

◆ StrokeOpacity() [1/2]

float com.google.appinventor.components.runtime.MapFeatureBase.StrokeOpacity ( )

Sets or gets the opacity of the outline of the type%. A value of 0.0 will be invisible and a value of 1.0 will be opaque.

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

Definition at line 184 of file MapFeatureBase.java.

◆ StrokeOpacity() [2/2]

void com.google.appinventor.components.runtime.MapFeatureBase.StrokeOpacity ( float  opacity)

Sets the opacity of the outline of the feature

Parameters
opacitythe stroke opacity

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

Definition at line 171 of file MapFeatureBase.java.

◆ StrokeWidth() [1/2]

int com.google.appinventor.components.runtime.MapFeatureBase.StrokeWidth ( )

Sets or gets the width of the stroke used to outline the type%.

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

Definition at line 203 of file MapFeatureBase.java.

◆ StrokeWidth() [2/2]

void com.google.appinventor.components.runtime.MapFeatureBase.StrokeWidth ( int  width)

Sets the width of the outline of the feature

Parameters
widththe outline width

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

Reimplemented in com.google.appinventor.components.runtime.LineString.

Definition at line 192 of file MapFeatureBase.java.

◆ Title() [1/2]

String com.google.appinventor.components.runtime.MapFeatureBase.Title ( )

Sets or gets the title displayed in the info window that appears when the user clicks on the map feature.

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

Definition at line 243 of file MapFeatureBase.java.

◆ Title() [2/2]

void com.google.appinventor.components.runtime.MapFeatureBase.Title ( String  title)

Sets the title of the feature's infobox.

Parameters
titlethe title of the feature's infobox

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

Definition at line 230 of file MapFeatureBase.java.

◆ Visible() [1/2]

boolean com.google.appinventor.components.runtime.MapFeatureBase.Visible ( )

Specifies whether the type% should be visible on the screen. Value is true{:.logic.block} if the type% is showing and false{:.logic.block} if hidden.

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

Definition at line 143 of file MapFeatureBase.java.

◆ Visible() [2/2]

void com.google.appinventor.components.runtime.MapFeatureBase.Visible ( boolean  visible)

Sets whether the component should be visible on the screen.

Parameters
visibletrue if the component should be visible, otherwise false.

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

Definition at line 123 of file MapFeatureBase.java.

Member Data Documentation

◆ container

MapFeatureContainer com.google.appinventor.components.runtime.MapFeatureBase.container = null
protected

Definition at line 33 of file MapFeatureBase.java.

◆ map

Map com.google.appinventor.components.runtime.MapFeatureBase.map = null
protected

Definition at line 34 of file MapFeatureBase.java.


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