com.esri.android.map.ags
Class ArcGISDynamicMapServiceLayer

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

public class ArcGISDynamicMapServiceLayer
extends DynamicLayer

The ArcGISDynamicMapServiceLayer class allows you to work with a dynamic map service resource that is exposed by the ArcGIS Server REST API (see the system requirements document for supported versions of ArcGIS Server). A dynamic map service generates map images on the server each time a request comes in.

Note: Notice that the ArcGISDynamicMapServiceLayer class, like all concrete layers, inherits directly from Android's View class. Therefore, the ArcGISDynamicMapServiceLayer 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 ArcGISDynamicMapServiceLayer class. The code will add a map service from ArcGIS Online using map services that are dynamically retrieved. When working with dynamic services the ArcGISDynamicMapServiceLayer class must be used. There are two approaches you can take when initializing your object, either through a layout's XML or through Java source code. This example code shows you how to connect to ArcGIS Online, but you can easily update the code to point to your own ArcGIS Server REST end points.

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.ArcGISDynamicMapServiceLayer
 url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
 </com.esri.android.map.MapView> 
 
 
Java usage:
 //ArcGISDynamicMapServiceLayer class is used to define the LayerView that is added to the 
 //MapView object.
 MapView mv = new MapView(this);
 mv.addLayer(new ArcGISDynamicMapServiceLayer(this,
     "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"));
 setContentView(mv);
 


Nested Class Summary
 
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
 
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
ArcGISDynamicMapServiceLayer(android.content.Context context, android.util.AttributeSet attrs)
          The constructor is called when the ArcGISDynamicMapServiceLayer object is being inflated from XML.
ArcGISDynamicMapServiceLayer(android.content.Context context, android.util.AttributeSet attrs, int defStyle)
          Inflate the ArcGISDynamicMapServiceLayer object from XML and apply a class-specific base style.
ArcGISDynamicMapServiceLayer(android.content.Context context, String url)
          This constructor is used if you're instantiating the ArcGISDynamicMapServiceLayer using Java code (see the class description for an example of this usage).
 
Method Summary
 ArcGISLayerInfo[] getLayers()
          Returns all the sub-layers of the dynamic map service.
protected  DynamicLayerModel initModel()
          This method will instantiate the LayerModel object.
 void update()
          Invoke this method to fetch the map image from the associated map service and update the MapView.
 
Methods inherited from class com.esri.android.map.DynamicLayer
cancelPendingTasks, onDraw, preUpdateNow
 
Methods inherited from class com.esri.android.map.LayerView
clearCache, getCenter, getDefaultSpatialReference, 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, onDetachedFromWindow, 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
 

Constructor Detail

ArcGISDynamicMapServiceLayer

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

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 ArcGISDynamicMapServiceLayer.
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.

ArcGISDynamicMapServiceLayer

public ArcGISDynamicMapServiceLayer(android.content.Context context,
                                    android.util.AttributeSet attrs)
The constructor is called when the ArcGISDynamicMapServiceLayer 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 ArcGISDynamicMapServiceLayer.

ArcGISDynamicMapServiceLayer

public ArcGISDynamicMapServiceLayer(android.content.Context context,
                                    String url)
This constructor is used if you're instantiating the ArcGISDynamicMapServiceLayer 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 URL of the dynamic map service.
Method Detail

initModel

protected DynamicLayerModel 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.

Specified by:
initModel in class LayerView<DynamicLayerModel>
Returns:
the LayerModel instance associated with this LayerView.
Throws:
Exception

getLayers

public ArcGISLayerInfo[] getLayers()
Returns all the sub-layers of the dynamic map service.

Returns:
an array of type ArcGISLayer.

update

public void update()
Invoke this method to fetch the map image from the associated map service and update the MapView.

Overrides:
update in class DynamicLayer


Copyright © 2010. All Rights Reserved.