AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.MapFeatureContainerBase Class Referenceabstract
Inheritance diagram for com.google.appinventor.components.runtime.MapFeatureContainerBase:
com.google.appinventor.components.runtime.AndroidViewComponent com.google.appinventor.components.runtime.util.MapFactory.MapFeatureContainer com.google.appinventor.components.runtime.VisibleComponent com.google.appinventor.components.runtime.ComponentContainer com.google.appinventor.components.runtime.Component com.google.appinventor.components.runtime.FeatureCollection com.google.appinventor.components.runtime.Map

Public Member Functions

void Features (YailList features)
 
YailList Features ()
 
void FeatureClick (MapFactory.MapFeature feature)
 
void FeatureLongClick (MapFactory.MapFeature feature)
 
void FeatureStartDrag (MapFactory.MapFeature feature)
 
void FeatureDrag (MapFactory.MapFeature feature)
 
void FeatureStopDrag (MapFactory.MapFeature feature)
 
void LoadFromURL (final String url)
 
Object FeatureFromDescription (YailList description)
 
void GotFeatures (String url, YailList features)
 
void LoadError (String url, int responseCode, String errorMessage)
 
Activity $context ()
 
Form $form ()
 
void $add (AndroidViewComponent component)
 
void setChildWidth (AndroidViewComponent component, int width)
 
void setChildHeight (AndroidViewComponent component, int height)
 
void removeFeature (MapFactory.MapFeature feature)
 
Iterator< MapFeatureiterator ()
 
void addFeature (MapFactory.MapFeature feature)
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.AndroidViewComponent
abstract View getView ()
 
boolean Visible ()
 
void Visible (boolean visibility)
 
int Width ()
 
void Width (int width)
 
void WidthPercent (int pCent)
 
void setLastWidth (int width)
 
int getSetWidth ()
 
void setLastHeight (int height)
 
int getSetHeight ()
 
void CopyWidth (AndroidViewComponent sourceComponent)
 
int Height ()
 
void Height (int height)
 
void HeightPercent (int pCent)
 
void CopyHeight (AndroidViewComponent sourceComponent)
 
int Column ()
 
void Column (int column)
 
int Row ()
 
void Row (int row)
 
HandlesEventDispatching getDispatchDelegate ()
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.util.MapFactory.MapFeatureContainer
void FeatureClick (MapFeature feature)
 
void FeatureLongClick (MapFeature feature)
 
void FeatureStartDrag (MapFeature feature)
 
void FeatureDrag (MapFeature feature)
 
void FeatureStopDrag (MapFeature feature)
 
Map getMap ()
 
void addFeature (MapFeature feature)
 
void removeFeature (MapFeature feature)
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.ComponentContainer
int Width ()
 
int Height ()
 

Protected Member Functions

 MapFeatureContainerBase (ComponentContainer container)
 
void processGeoJSON (final String url, final String content) throws JSONException
 
- Protected Member Functions inherited from com.google.appinventor.components.runtime.AndroidViewComponent
 AndroidViewComponent (ComponentContainer container)
 
- Protected Member Functions inherited from com.google.appinventor.components.runtime.VisibleComponent
 VisibleComponent ()
 

Protected Attributes

List< MapFeaturefeatures = new CopyOnWriteArrayList<MapFeature>()
 
- Protected Attributes inherited from com.google.appinventor.components.runtime.AndroidViewComponent
final ComponentContainer container
 

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 42 of file MapFeatureContainerBase.java.

Constructor & Destructor Documentation

◆ MapFeatureContainerBase()

com.google.appinventor.components.runtime.MapFeatureContainerBase.MapFeatureContainerBase ( ComponentContainer  container)
protected

Definition at line 97 of file MapFeatureContainerBase.java.

Member Function Documentation

◆ $add()

void com.google.appinventor.components.runtime.MapFeatureContainerBase.$add ( AndroidViewComponent  component)

Adds a component to a container.

After this method is finished executing, the given component's view must have LayoutParams, even if the component cannot be added to the container until later.

Parameters
componentcomponent associated with view

Implements com.google.appinventor.components.runtime.ComponentContainer.

Definition at line 327 of file MapFeatureContainerBase.java.

◆ $context()

Activity com.google.appinventor.components.runtime.MapFeatureContainerBase.$context ( )

Returns the activity context (which can be retrieved from the root container - aka the form).

Returns
activity context

Implements com.google.appinventor.components.runtime.ComponentContainer.

Definition at line 317 of file MapFeatureContainerBase.java.

◆ $form()

Form com.google.appinventor.components.runtime.MapFeatureContainerBase.$form ( )

Returns the form that ultimately contains this container.

Returns
form

Implements com.google.appinventor.components.runtime.ComponentContainer.

Definition at line 322 of file MapFeatureContainerBase.java.

◆ addFeature()

void com.google.appinventor.components.runtime.MapFeatureContainerBase.addFeature ( MapFactory.MapFeature  feature)

Definition at line 377 of file MapFeatureContainerBase.java.

◆ FeatureClick()

void com.google.appinventor.components.runtime.MapFeatureContainerBase.FeatureClick ( MapFactory.MapFeature  feature)

When a feature is clicked, the parent type% will also receive a FeatureClick event. The feature parameter indicates which child feature was clicked. This event is run after the Click event on the corresponding feature and after the when any ... Click event if one is provided.

Parameters
featurethe clicked feature

Definition at line 145 of file MapFeatureContainerBase.java.

◆ FeatureDrag()

void com.google.appinventor.components.runtime.MapFeatureContainerBase.FeatureDrag ( MapFactory.MapFeature  feature)

When the user drags a feature, the parent type% will also receive a FeatureDrag event. The feature parameter indicates which child feature was dragged. This event is run after the Drag event on the corresponding feature and after the when any ... Drag event if one is provided.

Parameters
featurethe dragged feature

Definition at line 193 of file MapFeatureContainerBase.java.

◆ FeatureFromDescription()

Object com.google.appinventor.components.runtime.MapFeatureContainerBase.FeatureFromDescription ( YailList  description)

Converts a feature description into an App Inventor map feature. Points are converted into Marker components, LineStrings are converted into LineString components, and Polygons (and MultiPolygons) are converted into Polygon components. If the feature has properties, they will be mapped into App Inventor properties using the following mapping:

  • description becomes Description
  • draggable becomes Draggable
  • infobox becomes EnableInfobox
  • fill becomes FillColor
  • fill-opacity becomes FillOpacity
  • image becomes ImageAsset
  • stroke becomes StrokeColor
  • stroke-opacity becomes StrokeOpacity
  • stroke-width becomes StrokeWidth
  • title becomes Title
  • visible becomes Visible
Parameters
descriptionThe description of a map feature, as a list of key-value pairs.
Returns
A new component representing the feature, or a string indicating an error.

Definition at line 261 of file MapFeatureContainerBase.java.

◆ FeatureLongClick()

void com.google.appinventor.components.runtime.MapFeatureContainerBase.FeatureLongClick ( MapFactory.MapFeature  feature)

When a feature is long-clicked, the parent type% will also receive a FeatureLongClick event. The feature parameter indicates which child feature was long-clicked. This event is run after the LongClick event on the corresponding feature and after the when any ... LongClick event if one is provided.

Parameters
featurethe long-clicked feature

Definition at line 161 of file MapFeatureContainerBase.java.

◆ Features() [1/2]

YailList com.google.appinventor.components.runtime.MapFeatureContainerBase.Features ( )

Gets the list of features attached to the type% (without regard to the value of the feature's Visible{:.getter.block} property). This list also includes any features created on the type% by calls to FeatureFromDescription(YailList).

Returns
A YailList of map features, e.g., Marker, LineString

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

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

Definition at line 132 of file MapFeatureContainerBase.java.

◆ Features() [2/2]

void com.google.appinventor.components.runtime.MapFeatureContainerBase.Features ( YailList  features)
Parameters
featuresA YailList of {#Marker Markers}

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

Definition at line 107 of file MapFeatureContainerBase.java.

◆ FeatureStartDrag()

void com.google.appinventor.components.runtime.MapFeatureContainerBase.FeatureStartDrag ( MapFactory.MapFeature  feature)

When the user starts dragging a feature, the parent type% will also receive a FeatureStartDrag event. The feature parameter indicates which child feature was dragged. This event is run after the StartDrag event on the corresponding feature and after the when any ... StartDrag event if one is provided.

Parameters
featurethe dragged feature

Definition at line 177 of file MapFeatureContainerBase.java.

◆ FeatureStopDrag()

void com.google.appinventor.components.runtime.MapFeatureContainerBase.FeatureStopDrag ( MapFactory.MapFeature  feature)

When the user stops dragging a feature, the parent type% will also receive a FeatureStopDrag event. The feature parameter indicates which child feature was dragged. This event is run after the StopDrag event on the corresponding feature and after the when any ... StopDrag event if one is provided.

Parameters
featurethe dragged feature

Definition at line 209 of file MapFeatureContainerBase.java.

◆ GotFeatures()

void com.google.appinventor.components.runtime.MapFeatureContainerBase.GotFeatures ( String  url,
YailList  features 
)

The GotFeatures event is run when when a feature collection is successfully read from the given url{:.variable.block}. The features{:.variable.block} parameter will be a list of feature descriptions that can be converted into components using the FeatureFromDescription(YailList) method.

Parameters
urlthe url corresponding to the requested url in LoadFromURL(String)
featuresthe list of feature descriptions read from the resource at
url

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

Definition at line 282 of file MapFeatureContainerBase.java.

◆ iterator()

Iterator<MapFeature> com.google.appinventor.components.runtime.MapFeatureContainerBase.iterator ( )

Iterates over the features in the MapFeatureContainer.

Returns
new iterator

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

Definition at line 347 of file MapFeatureContainerBase.java.

◆ LoadError()

void com.google.appinventor.components.runtime.MapFeatureContainerBase.LoadError ( String  url,
int  responseCode,
String  errorMessage 
)

The LoadError event is run when an error occurs while processing a feature collection document at the given url{:.variable.block}. The responseCode{:.variable.block} parameter will contain an HTTP status code and the errorMessage{:.variable.block} parameter will contain a detailed error message.

Definition at line 302 of file MapFeatureContainerBase.java.

◆ LoadFromURL()

void com.google.appinventor.components.runtime.MapFeatureContainerBase.LoadFromURL ( final String  url)

Loads a feature collection in GeoJSON format from the given url. On success, the event GotFeatures(String, YailList) will be raised with the given url and a list of features parsed from the GeoJSON as a list of (key, value) pairs. On failure, the LoadError(String, int, String) event will be raised with any applicable HTTP response code and error message.

Parameters
urlThe URL from which to read a GeoJSON-encoded feature collection

Definition at line 231 of file MapFeatureContainerBase.java.

◆ processGeoJSON()

void com.google.appinventor.components.runtime.MapFeatureContainerBase.processGeoJSON ( final String  url,
final String  content 
) throws JSONException
protected

Definition at line 442 of file MapFeatureContainerBase.java.

◆ removeFeature()

void com.google.appinventor.components.runtime.MapFeatureContainerBase.removeFeature ( MapFactory.MapFeature  feature)

Definition at line 341 of file MapFeatureContainerBase.java.

◆ setChildHeight()

void com.google.appinventor.components.runtime.MapFeatureContainerBase.setChildHeight ( AndroidViewComponent  component,
int  height 
)

◆ setChildWidth()

void com.google.appinventor.components.runtime.MapFeatureContainerBase.setChildWidth ( AndroidViewComponent  component,
int  width 
)

Member Data Documentation

◆ features

List<MapFeature> com.google.appinventor.components.runtime.MapFeatureContainerBase.features = new CopyOnWriteArrayList<MapFeature>()
protected

List of features associated with this map, including those that are invisible.

Definition at line 62 of file MapFeatureContainerBase.java.


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