com.esri.android.map.ags
Class ArcGISFeatureLayer

java.lang.Object
  extended by android.view.View
      extended by com.esri.android.map.LayerView<LayerModel>
          extended by com.esri.android.map.GraphicsLayer
              extended by com.esri.android.map.ags.ArcGISFeatureLayer
All Implemented Interfaces:
android.graphics.drawable.Drawable.Callback, android.view.accessibility.AccessibilityEventSource, android.view.KeyEvent.Callback

public class ArcGISFeatureLayer
extends GraphicsLayer

The ArcGISFeatureLayer class represents a layer that contains one or more Graphic features. The map can contains one or more feature layers.

Note: Notice that the ArcGISFeatureLayer class, like all concrete layers, inherits directly from Android's View class. Therefore, the ArcGISFeatureLayer class inherits all the methods and properties from the View and is very similar to working with other Android View objects.

The following are examples of how you might work with the ArcGISFeatureLayer class. There are two approaches you can take when initializing your object, either through a layout's XML or through Java source code.

XML usage:

 
 <!-- MapView that will fill your device screen with the "World Street Map" hosted on ArcGIS Online. -->
 <com.esri.android.map.MapView xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent" 
 android:layout_height="fill_parent">
 <com.esri.android.map.ags.ArcGISTiledMapServiceLayer
 url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer"/>
 <com.esri.android.map.ags.ArcGISFeatureLayer  
      android:id="@+id/featurelayer"
      url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/1"
      mode="ONDEMAND"/>
 </com.esri.android.map.MapView> 
 
 
 
Java usage:
 //ArcGISFeatureLayer class is used to define the LayerView that is added to the 
 //MapView object.
 MapView mv = new MapView(this);
 mv.addLayer(new ArcGISFeatureLayer(this,url,MODE.SNAPSHOT));
 setContentView(mv);
 


Nested Class Summary
static class ArcGISFeatureLayer.MODE
          The feature layer can work under 3 modes.
static class ArcGISFeatureLayer.Options
          The options to instantiate the feature layer.
static class ArcGISFeatureLayer.SELECTION_METHOD
          The modes used for the select features method.
 
Nested classes/interfaces inherited from class android.view.View
android.view.View.BaseSavedState, android.view.View.MeasureSpec, android.view.View.OnClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnFocusChangeListener, android.view.View.OnKeyListener, android.view.View.OnLongClickListener, android.view.View.OnTouchListener
 
Field Summary
static String LOCAL_FEATURE_CACHE_DB_NAME
          The name of the database for feature caching.
 
Fields inherited from class com.esri.android.map.GraphicsLayer
graphics
 
Fields inherited from class com.esri.android.map.LayerView
canvasOffsetX, canvasOffsetY, mapView, model
 
Fields inherited from class android.view.View
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, INVISIBLE, KEEP_SCREEN_ON, NO_ID, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
ArcGISFeatureLayer(android.content.Context context, android.util.AttributeSet attrs)
          This constructor is called when the ArcGISFeatureLayer object is being inflated from XML.
ArcGISFeatureLayer(android.content.Context context, android.util.AttributeSet attrs, int defStyle)
          Inflate the ArcGISFeatureLayer object from XML and apply a class-specific base style.
ArcGISFeatureLayer(android.content.Context context, String url, ArcGISFeatureLayer.MODE mode)
          The constructor is used if your are instantiating the ArcGISFeatureLayer using Java code (see the class description for an example of this usage).
ArcGISFeatureLayer(android.content.Context context, String url, ArcGISFeatureLayer.Options layerOption)
          The constructor is used if your are instantiating the ArcGISFeatureLayer using Java code (see the class description for an example of this usage).
 
Method Summary
 void addAttachment(int objectId, File file, CallbackListener<FeatureEditResult> callback)
          Adds an attachment to the feature specified by the ObjectId.
 void applyEdits(Graphic[] adds, Graphic[] deletes, Graphic[] updates, CallbackListener<FeatureEditResult[][]> callback)
          Applies edits to the editable feature layer.
 void clear()
          Clears all selection and removes all graphics from the layer.
 void clearSelection()
          Clears the current selection.
 Graphic createFeatureWithTemplate(FeatureTemplate template, Geometry geometry)
          Creates a new feature based on the specified feature sub-type and feature template.
 Graphic createFeatureWithType(FeatureType type, Geometry geometry)
          Creates a new feature based on the specified feature sub-type.
 void deleteAttachments(int objectId, int[] attachmentids, CallbackListener<FeatureEditResult[]> callback)
          Deletes one or more attachments for the feature specified by the input ObjectId.
 int getBufferFactor()
          When in ONDEMAND mode, you have a choice to fetch the features within current extent or buffered extent.
 String getDefaultDefinitionExpression()
          Returns the Metadata describing the default definition expression for the layer as defined by the service.
 SpatialReference getDefaultSpatialReference()
          If the LayerView is associated with a LayerModel, then the default spatial coordinate system of the layer model is returned.
 String getDefinitionExpression()
          Returns the current layer definition expression.
 String getDisplayField()
          Returns the name of the field that contains the Display field for the layer.
 int getExpirationInterval()
          The time interval in seconds that features in the layer will expire when the layer is in OnDemand mode.
 Field[] getFields()
          The array of fields in the layer.
 String getGlobalIdField()
          Returns the name of the field that contains the Global ID field for the layer.
 ArcGISFeatureLayer.MODE getMode()
          Returns the layer mode.
 String getObjectIdField()
          Returns the name of the field that contains the Object ID field for the layer.
 String[] getOutFields()
          The array of field names included in the FeatureLayer based on the ArcGISFeatureLayer.OPTIONS.outFields parameter.
 Graphic[] getSelectedFeatures()
          Clears the current selection.
 Symbol getSelectionSymbol()
          Returns the selection symbol for the feature layer.
 FeatureTemplate[] getTemplates()
          Returns an array of feature templates defined in the Graphic Service layer.
 String getTypeIdField()
          Returns the name of the field that contains the SubType field for the layer.
 FeatureType[] getTypes()
          Returns an array of feature types defined in the Graphic Service layer.
 boolean hasAttachments()
          True if attachments are enabled on the feature layer.
protected  LayerModel initModel()
          This method will instantiate the LayerModel object.
 boolean isAutoRefreshOnExpiration()
          Specifies whether or not the layer will refresh automatically when the expiration interval is reached.
 boolean isEditable()
          Returns true if the FeatureLayer is editable.
 boolean isTable()
          Returns true if the type of layer is "Table".
protected  void onDetachedFromWindow()
           
 void queryAttachmentInfos(int objectId, CallbackListener<AttachmentInfo[]> callback)
          Queries for information about attachments associated with the specified ObjectIds.
 void queryFeatures(Query query, CallbackListener<FeatureSet> callback)
          Query features from the feature layer.
 void queryIds(Query query, CallbackListener<int[]> callback)
          Query for ObjectIds.
 void refresh()
          Based on the mode of the feature layer, the method call can update the graphics from the associate service or refresh the layer from local cache.
 InputStream retrieveAttachment(int objectId, int attachmentId)
          Fetches the contents of the specified attachment.
 void selectFeatures(Query query, ArcGISFeatureLayer.SELECTION_METHOD selectionMethod, CallbackListener<FeatureSet> callback)
          Selects features from the FeatureLayer.
 void setAutoRefreshOnExpiration(boolean autoRefreshOnExpiration)
          Specifies whether or not the layer will refresh automatically when the expiration interval is reached.
 void setBufferFactor(int bufferFactor)
          When in ONDEMAND mode, you have a choice to fetch the features within current extent or buffered extent.
 void setDefinitionExpression(String expression)
          Sets the layer definition expression.
 void setExpirationInterval(int expirationInterval)
          The time interval in seconds that features in the layer will expire when the layer is in OnDemand mode.
 void setSelectionSymbol(Symbol selectionSymbol)
          Sets the selection symbol for the feature layer.
protected  void update()
          Updates the MapView with images that are retrieved from the LayerView's associated LayerModel object.
 
Methods inherited from class com.esri.android.map.GraphicsLayer
addGraphic, addGraphics, addGraphics, contains, contains, getGraphics, getGraphics, getRenderer, onDraw, removeGraphic, removeGraphics, setRenderer, toMapUnit
 
Methods inherited from class com.esri.android.map.LayerView
cancelPendingTasks, clearCache, getCenter, getExtent, getFullExtent, getModel, getOffset, getOnStatusChangedListener, getResolution, getSpatialReference, getUrl, getUrlHashCode, initLayer, isInitialized, isLongLifeCache, onAnimationEnd, onAnimationStart, onSizeChanged, setLongLifeCache, setOffset, setOnStatusChangedListener, setUrl, toMapPoint, toMapPoint, toScreenPoint, toScreenPoint
 
Methods inherited from class android.view.View
addFocusables, addFocusables, addTouchables, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, cancelLongPress, checkInputConnectionProxy, clearAnimation, clearFocus, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createContextMenu, destroyDrawingCache, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDraw, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetPressed, dispatchSetSelected, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, draw, drawableStateChanged, findFocus, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getKeyDispatcherState, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTag, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, hasFocus, hasFocusable, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isOpaque, isPaddingOffsetRequired, isPressed, isSaveEnabled, isScrollbarFadingEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAttachedToWindow, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateDrawableState, onCreateInputConnection, onDisplayHint, onDrawScrollBars, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onLayout, onMeasure, onRestoreInstanceState, onSaveInstanceState, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onVisibilityChanged, onWindowFocusChanged, onWindowVisibilityChanged, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPadding, setPressed, setSaveEnabled, setScrollbarFadingEnabled, setScrollBarStyle, setScrollContainer, setSelected, setSoundEffectsEnabled, setTag, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCAL_FEATURE_CACHE_DB_NAME

public static String LOCAL_FEATURE_CACHE_DB_NAME
The name of the database for feature caching.

Constructor Detail

ArcGISFeatureLayer

public ArcGISFeatureLayer(android.content.Context context,
                          android.util.AttributeSet attrs,
                          int defStyle)
Inflate the ArcGISFeatureLayer object from XML and apply a class-specific base style. This constructor of the ArcGISFeatureLayer allows subclasses to use their own base style when they are being inflated.

This constructor assumes you have another layer as the bottom most layer defined for the MapView.

Parameters:
context - The Context the view is running in, through which it can access the current theme, resources, and so on.
attrs - The attributes of the XML tag used to inflate the ArcGISFeatureLayer.
defStyle - the style to apply to this view. If the value 0 is supplied, then no style will be applied (beyond what is included in the theme). This may either be an attribute resource, whose value will be retrieved from the current theme, or an explicit style resource.

ArcGISFeatureLayer

public ArcGISFeatureLayer(android.content.Context context,
                          android.util.AttributeSet attrs)
This constructor is called when the ArcGISFeatureLayer object is being inflated from XML. Attributes that are specified in the XML are used to help inflate this object. This constructor, by default, uses a style of 0. This implies that the only attribute values that are applied are those in Android's Context's Theme and the given attributes stipulated in the XML. The inherited method, onFinishInflate(), is called after all the children have been added.

Parameters:
context - The Context the view is running in, through which it can access the current theme, resources, and so on.
attrs - The attributes of the XML tag used to inflate the ArcGISFeatureLayer.

ArcGISFeatureLayer

public ArcGISFeatureLayer(android.content.Context context,
                          String url,
                          ArcGISFeatureLayer.Options layerOption)
The constructor is used if your are instantiating the ArcGISFeatureLayer using Java code (see the class description for an example of this usage).

Parameters:
context - The Context the view is running in, through which it can access the current theme, resources, and so on.
url - the the URL of the feature layer service.
layerOption - the option parameters. Sets to null to use the default options.

ArcGISFeatureLayer

public ArcGISFeatureLayer(android.content.Context context,
                          String url,
                          ArcGISFeatureLayer.MODE mode)
The constructor is used if your are instantiating the ArcGISFeatureLayer using Java code (see the class description for an example of this usage).

Parameters:
context - The Context the view is running in, through which it can access the current theme, resources, and so on.
url - the the URL of the feature layer service.
mode - the feature layer mode.
Method Detail

initModel

protected LayerModel initModel()
                        throws Exception
Description copied from class: LayerView
This method will instantiate the LayerModel object.

In a Model-View-Controller architecture, the LayerView represents the View and handles the image rendering related functionality. Each View has an associated Model object that handles fetching map images, calculating map bounds, and so on.

Any class that extends the LayerView class should provide an implementation of a LayerModel class and instantiate that model in this method.

Overrides:
initModel in class GraphicsLayer
Returns:
the LayerModel instance associated with this LayerView.
Throws:
Exception

getDefinitionExpression

public String getDefinitionExpression()
Returns the current layer definition expression.

Returns:
the definition.
See Also:
setDefinitionExpression(String)

setDefinitionExpression

public void setDefinitionExpression(String expression)
Sets the layer definition expression. Only the features that match the definition expression are displayed. A definition expression limits the features available for display and queries by applying constraints to the layer's attribute fields. Setting a definition expression is useful when the dataset is large and you don't want to bring everything to the client for analysis. This method is typically called before adding the layer to the map. If the method is called after the layer is added to the map the layer will refresh itself to reflect the new definition expression.

Parameters:
expression - the definition expression.

getDefaultDefinitionExpression

public String getDefaultDefinitionExpression()
Returns the Metadata describing the default definition expression for the layer as defined by the service. The default definition expression limits the features available for display and query. You cannot override this value but you define additional filters on the default expression using the setDefinitionExpression(String) method. For example, if the default definition expression is set to display data where "STATE_NAME = 'California'" you could use setDefinitionExpression to only display a subset of the features in California e.g., "COUNTY='San Diego'".


getSelectionSymbol

public Symbol getSelectionSymbol()
Returns the selection symbol for the feature layer. If no symbol is specified, features are drawn using the layers's renderer.

Returns:
the symbol for highlight feature.

setSelectionSymbol

public void setSelectionSymbol(Symbol selectionSymbol)
Sets the selection symbol for the feature layer. If no symbol is specified, features are drawn using the layers's renderer.

Parameters:
selectionSymbol -

getBufferFactor

public int getBufferFactor()
When in ONDEMAND mode, you have a choice to fetch the features within current extent or buffered extent. The buffer is calculated as: width = extent.width * bufferFactor * 2 + 1); height = extent.height * (bufferFactor * 2 + 1);

By default it is 1 (100%).


setBufferFactor

public void setBufferFactor(int bufferFactor)
When in ONDEMAND mode, you have a choice to fetch the features within current extent or buffered extent. The buffer is calculated as: width = extent.width * bufferFactor * 2 + 1); height = extent.height * (bufferFactor * 2 + 1);

By default it is 1 (100%).


getMode

public ArcGISFeatureLayer.MODE getMode()
Returns the layer mode.


getFields

public Field[] getFields()
The array of fields in the layer.

Returns:
the field array.

isAutoRefreshOnExpiration

public boolean isAutoRefreshOnExpiration()
Specifies whether or not the layer will refresh automatically when the expiration interval is reached. Default is false. This is used only in OnDemand mode.


setAutoRefreshOnExpiration

public void setAutoRefreshOnExpiration(boolean autoRefreshOnExpiration)
Specifies whether or not the layer will refresh automatically when the expiration interval is reached. Default is false. This is used only in OnDemand mode.


getExpirationInterval

public int getExpirationInterval()
The time interval in seconds that features in the layer will expire when the layer is in OnDemand mode. Setting this to 0 will cause the features to not expire.

Returns:
interval in seconds

setExpirationInterval

public void setExpirationInterval(int expirationInterval)
The time interval in seconds that features in the layer will expire when the layer is in OnDemand mode. Setting this to 0 will cause the features to not expire.

Parameters:
expirationInterval - interval in seconds

getDefaultSpatialReference

public SpatialReference getDefaultSpatialReference()
Description copied from class: LayerView
If the LayerView is associated with a LayerModel, then the default spatial coordinate system of the layer model is returned.

Overrides:
getDefaultSpatialReference in class GraphicsLayer

update

protected void update()
Description copied from class: LayerView
Updates the MapView with images that are retrieved from the LayerView's associated LayerModel object. This method is called when the MapView's extent is changed.

Any class that extends the LayerView class should provide an implementation of this method to retrieve updated an updated map from the map service. The TiledLayer and DynamicLayer subclasses provide default implementation for cached and dynamic map services. If you DO NOT need to support other types of map services, then you should not override this default functionality (it will save you a lot of unnecessary development effort).

Overrides:
update in class GraphicsLayer

refresh

public void refresh()
Based on the mode of the feature layer, the method call can update the graphics from the associate service or refresh the layer from local cache.


selectFeatures

public void selectFeatures(Query query,
                           ArcGISFeatureLayer.SELECTION_METHOD selectionMethod,
                           CallbackListener<FeatureSet> callback)
Selects features from the FeatureLayer. The selection method defines how query results are passed to the selection. The feature layer will highlight the current selection if a selection symbol has been defined. Whenever possible, the feature layer will perform the query operation on the client side.

Parameters:
query - The input query.
callback - The function to call when the method is completed or on error.
selectionMethod - the selection mode.

getSelectedFeatures

public Graphic[] getSelectedFeatures()
Clears the current selection.

Returns:
the selected features.

clearSelection

public void clearSelection()
Clears the current selection.


addAttachment

public void addAttachment(int objectId,
                          File file,
                          CallbackListener<FeatureEditResult> callback)
Adds an attachment to the feature specified by the ObjectId. Only applicable if isEditable() and hasAttachments() are true.

Parameters:
objectId - The ObjectId of the feature to which the attachment is added.
file - The path of the attachment on the device.
callback - The path of the attachment on the device.

deleteAttachments

public void deleteAttachments(int objectId,
                              int[] attachmentids,
                              CallbackListener<FeatureEditResult[]> callback)
Deletes one or more attachments for the feature specified by the input ObjectId. Only applicable if isEditable() and hasAttachments() are true.

Parameters:
objectId - The ObjectId of the feature from which the attachment is removed.
attachmentids - The ObjectId of the feature from which the attachment is removed.
callback - This listener will be called when the operation is complete or on error.

queryAttachmentInfos

public void queryAttachmentInfos(int objectId,
                                 CallbackListener<AttachmentInfo[]> callback)
Queries for information about attachments associated with the specified ObjectIds.

Parameters:
objectId - Query for information about attachments associated with the specified ObjectIds.
callback - This listener will be called when the operation is complete or on error.

applyEdits

public void applyEdits(Graphic[] adds,
                       Graphic[] deletes,
                       Graphic[] updates,
                       CallbackListener<FeatureEditResult[][]> callback)
Applies edits to the editable feature layer. Only applicable for layers in a feature service.
  • For new features, the applyEdit will submit all the features to server side. If succeed, all of the new features will be updated with the OID and GID and will be added to the layer graphics.
  • For updating and deleting, the graphics will be adjusted based on the response.

    Parameters:
    adds - Apply edits to the feature layer. Only applicable for layers in a feature service.
    deletes - Array of features to delete. Must have valid ObjectId
    updates - Array of features whose geometry and/or attributes have changed. Features must have a valid OBJECTID. The geometry of features is typically modified using the Editing tools. Attributes are modified using the Attribute Inspector.
    callback - This listener will be called when the operation is complete or on error.

  • isEditable

    public boolean isEditable()
    Returns true if the FeatureLayer is editable. If the layer is editable the following operations can be performed.
  • Add new features.
  • Modify the geometry and attributes of existing features.
  • Delete features. You need to wait until the layer initialization is done before calling this method.

    Returns:
    true of it is editable or false otherwise.

  • queryFeatures

    public void queryFeatures(Query query,
                              CallbackListener<FeatureSet> callback)
    Query features from the feature layer. Layer definition and time definition are honored. Whenever possible the feature layer will perform the query on the client.

    Parameters:
    query - The input query. The query object has the following restrictions to avoid conflicts between layer and map properties.
  • outFields specified by the query object are overridden by the outFields specified in the FeatureLayer constructor.
  • The returnGeometry value specified by the query object is ignored and true is used.
  • The outSpatialReference set by the query object is ignored and the map's spatial reference is used.
    callback - The function to call when the method has completed.

  • queryIds

    public void queryIds(Query query,
                         CallbackListener<int[]> callback)
    Query for ObjectIds. There is no limit on the number of ObjectIds that are returned from the server. Like queryFeatures this operation will perform queries on the client (browser) whenever possible.

    Parameters:
    query - The input query. The query object has the following restrictions to avoid conflicts between layer and map properties.
  • outFields specified by the query object are overridden by the outFields specified in the FeatureLayer constructor.
  • The returnGeometry value specified by the query object is ignored and true is used.
  • The outSpatialReference set by the query object is ignored and the map's spatial reference is used.
    callback - The function to call when the method has completed.

  • createFeatureWithTemplate

    public Graphic createFeatureWithTemplate(FeatureTemplate template,
                                             Geometry geometry)
    Creates a new feature based on the specified feature sub-type and feature template. Note, the new feature is only available on the device at this point, it is not committed to the server.

    Parameters:
    template - the feature template to use while creating the feature.
    geometry - the geometry to create the Graphic.
    Returns:
    the Graphic with the given geometry and the template.

    createFeatureWithType

    public Graphic createFeatureWithType(FeatureType type,
                                         Geometry geometry)
    Creates a new feature based on the specified feature sub-type. Note, the new feature is only available on the device at this point, it is not committed to the server. This method uses the first template in the feature type.

    Parameters:
    type - the type of feature to create.
    geometry - the geometry to create the Graphic.
    Returns:
    the Graphic with the given geometry and the template (defined in the type).

    isTable

    public boolean isTable()
    Returns true if the type of layer is "Table". The type of a feature layer can be "Graphic Layer" or "Table".


    getTypes

    public FeatureType[] getTypes()
    Returns an array of feature types defined in the Graphic Service layer. Only applicable for ArcGIS Server Graphic Service layers.

    Returns:
    the array of FeatureType.

    getTemplates

    public FeatureTemplate[] getTemplates()
    Returns an array of feature templates defined in the Graphic Service layer. Only applicable for ArcGIS Server Graphic Service layers.

    Returns:
    the array of FeatureTemplate.

    getOutFields

    public String[] getOutFields()
    The array of field names included in the FeatureLayer based on the ArcGISFeatureLayer.OPTIONS.outFields parameter. If none are specified, in the ArcGISFeatureLayer.Options class then the feature layer will return all fields and this methods will return null. If "*" was specified in the OPTIONS class this method will return ["*"]. If some field names are set in the OPTIONS class, but the ObjectID field was not included it will be included in the FeatureLayer and will also be returned in this String array.

    Returns:
    the name of the fields
    See Also:
    ArcGISFeatureLayer.Options

    getObjectIdField

    public String getObjectIdField()
    Returns the name of the field that contains the Object ID field for the layer.

    Returns:
    the name of the field.

    getTypeIdField

    public String getTypeIdField()
    Returns the name of the field that contains the SubType field for the layer.

    Returns:
    the name of the field.

    getDisplayField

    public String getDisplayField()
    Returns the name of the field that contains the Display field for the layer.

    Returns:
    the name of the field.

    getGlobalIdField

    public String getGlobalIdField()
    Returns the name of the field that contains the Global ID field for the layer.

    Returns:
    the name of the field.

    onDetachedFromWindow

    protected void onDetachedFromWindow()
    Overrides:
    onDetachedFromWindow in class android.view.View

    hasAttachments

    public boolean hasAttachments()
    True if attachments are enabled on the feature layer. Use the queryAttachmentInfos(int, CallbackListener) method to determine if the the feature has attachments. If the layer is editable (isEditable()) and supports attachments the following operations can be performed.
  • Add attachments to features.
  • Delete existing attachments.


  • retrieveAttachment

    public InputStream retrieveAttachment(int objectId,
                                          int attachmentId)
                                   throws Exception
    Fetches the contents of the specified attachment.

    Parameters:
    objectId - the object ID of the feature to which the attachment belongs.
    attachmentId - the ID of the attachment to fetch.
    Throws:
    Exception

    clear

    public void clear()
    Clears all selection and removes all graphics from the layer.

    Overrides:
    clear in class GraphicsLayer


    Copyright © 2010. All Rights Reserved.