public abstract class Overlay extends Object implements OverlayConstants
MapView
. To add an
overlay, subclass this class, create an instance, and add it to the list obtained from
getOverlays() of MapView
.
This class implements a form of Gesture Handling similar to
GestureDetector.SimpleOnGestureListener
and
GestureDetector.OnGestureListener
. The difference is there is an additional argument for
the item.Modifier and Type | Class and Description |
---|---|
static interface |
Overlay.Snappable
Interface definition for overlays that contain items that can be snapped to (for example,
when the user invokes a zoom, this could be called allowing the user to snap the zoom to an
interesting point.)
|
Modifier and Type | Field and Description |
---|---|
protected ResourceProxy |
mResourceProxy |
protected float |
mScale |
protected static float |
SHADOW_X_SKEW |
protected static float |
SHADOW_Y_SCALE |
DEBUGMODE, DEFAULT_ZOOMLEVEL_MINIMAP_DIFFERENCE, NOT_SET
Constructor and Description |
---|
Overlay(android.content.Context ctx) |
Overlay(ResourceProxy pResourceProxy) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
draw(android.graphics.Canvas c,
MapView osmv,
boolean shadow)
Draw the overlay over the map.
|
protected static void |
drawAt(android.graphics.Canvas canvas,
android.graphics.drawable.Drawable drawable,
int x,
int y,
boolean shadow,
float aMapOrientation)
Convenience method to draw a Drawable at an offset.
|
protected static int |
getSafeMenuId()
Since the menu-chain will pass through several independent Overlays, menu IDs cannot be fixed
at compile time.
|
protected static int |
getSafeMenuIdSequence(int count)
Similar to
getSafeMenuId() , except this reserves a sequence of IDs of length
count . |
boolean |
isEnabled()
Specifies if the Overlay is marked to be enabled.
|
void |
onDetach(MapView mapView)
Override to perform clean up of resources before shutdown.
|
boolean |
onDoubleTap(android.view.MotionEvent e,
MapView mapView)
By default does nothing (
return false ). |
boolean |
onDoubleTapEvent(android.view.MotionEvent e,
MapView mapView)
By default does nothing (
return false ). |
boolean |
onDown(android.view.MotionEvent e,
MapView mapView)
By default does nothing (
return false ). |
boolean |
onFling(android.view.MotionEvent pEvent1,
android.view.MotionEvent pEvent2,
float pVelocityX,
float pVelocityY,
MapView pMapView)
By default does nothing (
return false ). |
boolean |
onKeyDown(int keyCode,
android.view.KeyEvent event,
MapView mapView)
By default does nothing (
return false ). |
boolean |
onKeyUp(int keyCode,
android.view.KeyEvent event,
MapView mapView)
By default does nothing (
return false ). |
boolean |
onLongPress(android.view.MotionEvent e,
MapView mapView)
By default does nothing (
return false ). |
boolean |
onScroll(android.view.MotionEvent pEvent1,
android.view.MotionEvent pEvent2,
float pDistanceX,
float pDistanceY,
MapView pMapView)
By default does nothing (
return false ). |
void |
onShowPress(android.view.MotionEvent pEvent,
MapView pMapView) |
boolean |
onSingleTapConfirmed(android.view.MotionEvent e,
MapView mapView)
By default does nothing (
return false ). |
boolean |
onSingleTapUp(android.view.MotionEvent e,
MapView mapView)
By default does nothing (
return false ). |
boolean |
onTouchEvent(android.view.MotionEvent event,
MapView mapView)
You can prevent all(!) other Touch-related events from happening!
By default does nothing ( return false ). |
boolean |
onTrackballEvent(android.view.MotionEvent event,
MapView mapView)
By default does nothing (
return false ). |
void |
setEnabled(boolean pEnabled)
Sets whether the Overlay is marked to be enabled.
|
protected static final float SHADOW_X_SKEW
protected static final float SHADOW_Y_SCALE
protected final ResourceProxy mResourceProxy
protected final float mScale
public Overlay(android.content.Context ctx)
public Overlay(ResourceProxy pResourceProxy)
public void setEnabled(boolean pEnabled)
public boolean isEnabled()
protected static final int getSafeMenuId()
protected static final int getSafeMenuIdSequence(int count)
getSafeMenuId()
, except this reserves a sequence of IDs of length
count
. The returned number is the starting index of that sequential list.getSafeMenuId()
protected abstract void draw(android.graphics.Canvas c, MapView osmv, boolean shadow)
public void onDetach(MapView mapView)
public boolean onKeyDown(int keyCode, android.view.KeyEvent event, MapView mapView)
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.public boolean onKeyUp(int keyCode, android.view.KeyEvent event, MapView mapView)
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.public boolean onTouchEvent(android.view.MotionEvent event, MapView mapView)
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.public boolean onTrackballEvent(android.view.MotionEvent event, MapView mapView)
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.public boolean onDoubleTap(android.view.MotionEvent e, MapView mapView)
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.public boolean onDoubleTapEvent(android.view.MotionEvent e, MapView mapView)
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.public boolean onSingleTapConfirmed(android.view.MotionEvent e, MapView mapView)
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.public boolean onDown(android.view.MotionEvent e, MapView mapView)
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.public boolean onFling(android.view.MotionEvent pEvent1, android.view.MotionEvent pEvent2, float pVelocityX, float pVelocityY, MapView pMapView)
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.public boolean onLongPress(android.view.MotionEvent e, MapView mapView)
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.public boolean onScroll(android.view.MotionEvent pEvent1, android.view.MotionEvent pEvent2, float pDistanceX, float pDistanceY, MapView pMapView)
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.public void onShowPress(android.view.MotionEvent pEvent, MapView pMapView)
public boolean onSingleTapUp(android.view.MotionEvent e, MapView mapView)
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.protected static void drawAt(android.graphics.Canvas canvas, android.graphics.drawable.Drawable drawable, int x, int y, boolean shadow, float aMapOrientation)
shadow
- If true, draw only the drawable's shadow. Otherwise, draw the drawable itself.aMapOrientation
- Copyright © 2015. All Rights Reserved.