|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.view.View
com.esri.android.map.LayerView<V>
public abstract class LayerView<V extends LayerModel>
The LayerView class is the base class for all layers that can be added to a MapView.
In a Model-View-Controller architecture, this class represents the View. It handles the image rendering related functions of this architecture. Each View has an associated model class, in this case LayerModel, which handles fetching map images, calculating map extent, and so on.
You will typically work with one of the sub-classes of this abstract class. For example,
You can also extend the LayerView class to add support for additional types of services. However, it is preferred that you extend directly from a DynamicLayer or a TiledLayer class instead of directly from the LayerView if your service type can be classified as dynamic or cached. If your service type extends outside these two types, then you must extend directly from the LayerView class.
Note: The LayerView class, as a base class, extends Android's View class and inherits all of Android's View
methods and attributes. This makes working with this View similar to working with a regular Android View.
| 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 | |
|---|---|
protected float |
canvasOffsetX
The default screen origin of the canvas in the LayerView is at the following screen point: (0, 0). |
protected float |
canvasOffsetY
The default screen origin of the canvas in the LayerView is at the following screen point: (0, 0). |
protected MapView |
mapView
The MapView object that contains this LayerView. |
protected V |
model
The LayerModel object that is associated with this LayerView. |
| 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 | |
|---|---|
LayerView(android.content.Context context,
android.util.AttributeSet attrs)
Inflate the LayerView object from XML. |
|
LayerView(android.content.Context context,
android.util.AttributeSet attrs,
int defStyle)
Inflate the LayerView object from XML and apply a class-specific base style. |
|
| Method Summary | |
|---|---|
protected void |
cancelPendingTasks()
Cancels all the pending worker threads held by the LayerView object. |
protected void |
clearCache()
Clears all the cache used for animation and drawing. |
Point |
getCenter()
Returns the center of the map as it is being displayed on the device with the MapView's spatial coordinate system. |
SpatialReference |
getDefaultSpatialReference()
If the LayerView is associated with a LayerModel, then the default spatial coordinate system of the layer model is returned. |
Envelope |
getExtent()
Returns an extent representing the maximum extent of data, which is currently visible on the device that is showing the map. |
Envelope |
getFullExtent()
Gets the full MapView extent based on the default spatial reference as defined by the map service the layer belongs to. |
protected V |
getModel()
Returns the LayerModel object associated with this LayerView. |
float[] |
getOffset()
Returns the offset of the canvas for the current View. |
OnStatusChangedListener |
getOnStatusChangedListener()
Gets the onStatusChangedListener of the LayerView. |
double |
getResolution()
Gets the current map resolution based on the map view extent and screen size of the view. |
SpatialReference |
getSpatialReference()
Returns the current spatial coordinate system used by the LayerModel that is associated with this LayerView. |
String |
getUrl()
Gets the URL of the map service associated with the LayerView. |
int |
getUrlHashCode()
A convenience method that returns the hash code of the map service URL. |
protected void |
initLayer()
Used to initialize the LayerView and LayerModel objects synchronously. |
protected abstract V |
initModel()
This method will instantiate the LayerModel object. |
boolean |
isInitialized()
Determines if the LayerView has been initialized. |
boolean |
isLongLifeCache()
Determines when to destroy the background of animations that occurs when zooming the MapView. |
protected void |
onAnimationEnd()
|
protected void |
onAnimationStart()
|
protected void |
onDraw(android.graphics.Canvas canvas)
|
protected void |
onSizeChanged(int w,
int h,
int oldw,
int oldh)
|
void |
setLongLifeCache(boolean longLifeCache)
Determines when to destroy the background of animations that occurs when zooming the MapView. |
void |
setOffset(float offsetX,
float offsetY)
Updates the offset of the canvas for the current View. |
void |
setOnStatusChangedListener(OnStatusChangedListener onStatusChangedListener)
Sets the onStatusChangedListener of the LayerView. |
protected void |
setUrl(String url)
Sets the URL of the map service associated with the LayerView. |
Point |
toMapPoint(float x,
float y)
A convenience method that will convert |
Point |
toMapPoint(Point pt)
A convenience method that will convert an ArcGIS geometry Point that contains screen coordinates to the current MapView coordinates. |
Point |
toScreenPoint(float x,
float y)
A convenience method that will convert the |
Point |
toScreenPoint(Point pt)
A convenience method that will convert an ArcGIS geometry Point given in the MapView's spatial coordinate system to the device's screen coordinates. |
protected abstract void |
update()
Updates the MapView with images that are retrieved from the LayerView's associated LayerModel object. |
| 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 |
| Field Detail |
|---|
protected V extends LayerModel model
protected volatile float canvasOffsetX
To begin the process of moving the origin of the canvas for the current LayerView, you can set the canvasOffsetX's field value in screen pixels.
protected volatile float canvasOffsetY
To begin the process of moving the origin of the canvas for the current LayerView, you can set the canvasOffsetY's field value in screen pixels.
protected MapView mapView
| Constructor Detail |
|---|
public LayerView(android.content.Context context,
android.util.AttributeSet attrs,
int defStyle)
context - The Context this View is running in. This Context provides access to the current theme, resources,
and so on.attrs - The attributes of the XML used to inflate this View.defStyle - the style to apply to this View. If a value of 0 is supplied, then no style will be applied (beyond
what is included in the theme). This value may either specified as an attribute resource whose value will
be retrieved from the current theme, or as an explicit style resource.
public LayerView(android.content.Context context,
android.util.AttributeSet attrs)
context - The Context this View is running in. This Context provides access to the current theme, resources,
and so on.attrs - The attributes of the XML used to inflate this View.| Method Detail |
|---|
protected abstract V initModel()
throws Exception
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.
Exception
protected final void initLayer()
throws Exception
Exceptionpublic boolean isInitialized()
protected void setUrl(String url)
url - the URL pointing to your map service.public String getUrl()
public boolean isLongLifeCache()
setLongLifeCache(boolean) method.
public void setLongLifeCache(boolean longLifeCache)
Set to true to destroy the animation background when all requested images are drawn. If you want to release the memory as soon as the first map image request comes back, set it to false.
longLifeCache - set to true for long life animation background; false otherwise.
protected void onSizeChanged(int w,
int h,
int oldw,
int oldh)
onSizeChanged in class android.view.Viewpublic SpatialReference getDefaultSpatialReference()
public SpatialReference getSpatialReference()
public Point toScreenPoint(Point pt)
pt - an ArcGIS geometry Point that represents a location on the map.
public Point toMapPoint(Point pt)
pt - the ArcGIS geometry Point given in screen coordinates.
public Point toMapPoint(float x,
float y)
x - the x coordinate of the screen point in pixels.y - the y coordinate of the screen point in pixels.
public Point toScreenPoint(float x,
float y)
x - the x coordinate of the MapView point.y - the y coordinate of the MapView point.
protected void onDraw(android.graphics.Canvas canvas)
onDraw in class android.view.Viewprotected void onAnimationEnd()
onAnimationEnd in class android.view.Viewprotected void onAnimationStart()
onAnimationStart in class android.view.Viewpublic float[] getOffset()
public void setOffset(float offsetX,
float offsetY)
offsetX - the x screen offset in pixels.offsetY - the y screen offset in pixels.protected V getModel()
LayerModel object associated with this LayerView.
public Point getCenter()
public double getResolution()
public Envelope getExtent()
public Envelope getFullExtent()
protected void clearCache()
public int getUrlHashCode()
protected void cancelPendingTasks()
protected abstract void update()
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).
public OnStatusChangedListener getOnStatusChangedListener()
public void setOnStatusChangedListener(OnStatusChangedListener onStatusChangedListener)
onStatusChangedListener - The onStatusChangedListener to set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||