org.osmdroid.views.overlay
Class ItemizedIconOverlay<Item extends OverlayItem>

java.lang.Object
  extended by org.osmdroid.views.overlay.Overlay
      extended by org.osmdroid.views.overlay.ItemizedOverlay<Item>
          extended by org.osmdroid.views.overlay.ItemizedIconOverlay<Item>
All Implemented Interfaces:
Overlay.Snappable, OverlayConstants
Direct Known Subclasses:
ItemizedOverlayWithFocus

public class ItemizedIconOverlay<Item extends OverlayItem>
extends ItemizedOverlay<Item>


Nested Class Summary
static interface ItemizedIconOverlay.ActiveItem
           
static interface ItemizedIconOverlay.OnItemGestureListener<T>
          When the item is touched one of these methods may be invoked depending on the type of touch.
 
Nested classes/interfaces inherited from class org.osmdroid.views.overlay.Overlay
Overlay.Snappable
 
Field Summary
protected  List<Item> mItemList
           
protected  ItemizedIconOverlay.OnItemGestureListener<Item> mOnItemGestureListener
           
 
Fields inherited from class org.osmdroid.views.overlay.ItemizedOverlay
mDefaultMarker, mDrawFocusedItem
 
Fields inherited from class org.osmdroid.views.overlay.Overlay
mResourceProxy, mScale, SHADOW_X_SKEW, SHADOW_Y_SCALE
 
Fields inherited from interface org.osmdroid.views.util.constants.OverlayConstants
DEBUGMODE, DEFAULT_ZOOMLEVEL_MINIMAP_DIFFERENCE, NOT_SET
 
Constructor Summary
ItemizedIconOverlay(android.content.Context pContext, List<Item> pList, ItemizedIconOverlay.OnItemGestureListener<Item> pOnItemGestureListener)
           
ItemizedIconOverlay(List<Item> pList, android.graphics.drawable.Drawable pDefaultMarker, ItemizedIconOverlay.OnItemGestureListener<Item> pOnItemGestureListener, ResourceProxy pResourceProxy)
           
ItemizedIconOverlay(List<Item> pList, ItemizedIconOverlay.OnItemGestureListener<Item> pOnItemGestureListener, ResourceProxy pResourceProxy)
           
 
Method Summary
 void addItem(int location, Item item)
           
 boolean addItem(Item item)
           
 boolean addItems(List<Item> items)
           
protected  Item createItem(int index)
          Method by which subclasses create the actual Items.
 int getDrawnItemsLimit()
           
 boolean onLongPress(android.view.MotionEvent event, MapView mapView)
          By default does nothing (return false).
protected  boolean onLongPressHelper(int index, Item item)
           
 boolean onSingleTapUp(android.view.MotionEvent event, MapView mapView)
          Each of these methods performs a item sensitive check.
protected  boolean onSingleTapUpHelper(int index, Item item, MapView mapView)
           
 boolean onSnapToItem(int pX, int pY, android.graphics.Point pSnapPoint, IMapView pMapView)
          Checks to see if the given x and y are close enough to an item resulting in snapping the current action (e.g. zoom) to the item.
 void removeAllItems()
           
 void removeAllItems(boolean withPopulate)
           
 Item removeItem(int position)
           
 boolean removeItem(Item item)
           
 void setDrawnItemsLimit(int aLimit)
           
 int size()
          The number of items in this overlay.
 
Methods inherited from class org.osmdroid.views.overlay.ItemizedOverlay
boundToHotspot, draw, getFocus, getItem, hitTest, onDrawItem, populate, setDrawFocusedItem, setFocus
 
Methods inherited from class org.osmdroid.views.overlay.Overlay
drawAt, getSafeMenuId, getSafeMenuIdSequence, isEnabled, onDetach, onDoubleTap, onDoubleTapEvent, onDown, onFling, onKeyDown, onKeyUp, onScroll, onShowPress, onSingleTapConfirmed, onTouchEvent, onTrackballEvent, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mItemList

protected final List<Item extends OverlayItem> mItemList

mOnItemGestureListener

protected ItemizedIconOverlay.OnItemGestureListener<Item extends OverlayItem> mOnItemGestureListener
Constructor Detail

ItemizedIconOverlay

public ItemizedIconOverlay(List<Item> pList,
                           android.graphics.drawable.Drawable pDefaultMarker,
                           ItemizedIconOverlay.OnItemGestureListener<Item> pOnItemGestureListener,
                           ResourceProxy pResourceProxy)

ItemizedIconOverlay

public ItemizedIconOverlay(List<Item> pList,
                           ItemizedIconOverlay.OnItemGestureListener<Item> pOnItemGestureListener,
                           ResourceProxy pResourceProxy)

ItemizedIconOverlay

public ItemizedIconOverlay(android.content.Context pContext,
                           List<Item> pList,
                           ItemizedIconOverlay.OnItemGestureListener<Item> pOnItemGestureListener)
Method Detail

onSnapToItem

public boolean onSnapToItem(int pX,
                            int pY,
                            android.graphics.Point pSnapPoint,
                            IMapView pMapView)
Description copied from interface: Overlay.Snappable
Checks to see if the given x and y are close enough to an item resulting in snapping the current action (e.g. zoom) to the item.

Parameters:
pX - The x in screen coordinates.
pY - The y in screen coordinates.
pSnapPoint - To be filled with the the interesting point (in screen coordinates) that is closest to the given x and y. Can be untouched if not snapping.
pMapView - The MapView that is requesting the snap. Use MapView.getProjection() to convert between on-screen pixels and latitude/longitude pairs.
Returns:
Whether or not to snap to the interesting point.

createItem

protected Item createItem(int index)
Description copied from class: ItemizedOverlay
Method by which subclasses create the actual Items. This will only be called from populate() we'll cache them for later use.

Specified by:
createItem in class ItemizedOverlay<Item extends OverlayItem>

size

public int size()
Description copied from class: ItemizedOverlay
The number of items in this overlay.

Specified by:
size in class ItemizedOverlay<Item extends OverlayItem>

addItem

public boolean addItem(Item item)

addItem

public void addItem(int location,
                    Item item)

addItems

public boolean addItems(List<Item> items)

removeAllItems

public void removeAllItems()

removeAllItems

public void removeAllItems(boolean withPopulate)

removeItem

public boolean removeItem(Item item)

removeItem

public Item removeItem(int position)

onSingleTapUp

public boolean onSingleTapUp(android.view.MotionEvent event,
                             MapView mapView)
Each of these methods performs a item sensitive check. If the item is located its corresponding method is called. The result of the call is returned. Helper methods are provided so that child classes may more easily override behavior without resorting to overriding the ItemGestureListener methods.

Overrides:
onSingleTapUp in class Overlay

onSingleTapUpHelper

protected boolean onSingleTapUpHelper(int index,
                                      Item item,
                                      MapView mapView)

onLongPress

public boolean onLongPress(android.view.MotionEvent event,
                           MapView mapView)
Description copied from class: Overlay
By default does nothing (return false). If you handled the Event, return true, otherwise return false. If you returned true none of the following Overlays or the underlying MapView has the chance to handle this event.

Overrides:
onLongPress in class Overlay

onLongPressHelper

protected boolean onLongPressHelper(int index,
                                    Item item)

getDrawnItemsLimit

public int getDrawnItemsLimit()

setDrawnItemsLimit

public void setDrawnItemsLimit(int aLimit)


Copyright © 2012. All Rights Reserved.