public abstract class Overlay
extends java.lang.Object
MapView.getOverlays().
In order to allow a user's touch to snap to a point, the subclass should
implement the Overlay.Snappable interface.
| 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 static float |
SHADOW_X_SKEW
X Skew value for creating a marker shadow in perspective.
|
protected static float |
SHADOW_Y_SCALE
Y Scale value for creating a marker shadow in perspective.
|
| Constructor and Description |
|---|
Overlay() |
| Modifier and Type | Method and Description |
|---|---|
void |
draw(android.graphics.Canvas canvas,
MapView mapView,
boolean shadow)
Draw the overlay over the map.
|
boolean |
draw(android.graphics.Canvas canvas,
MapView mapView,
boolean shadow,
long when)
Draw call for animated overlays.
|
protected static void |
drawAt(android.graphics.Canvas canvas,
android.graphics.drawable.Drawable drawable,
int x,
int y,
boolean shadow)
Convenience method to draw a Drawable at an offset.
|
boolean |
onKeyDown(int keyCode,
android.view.KeyEvent event,
MapView mapView)
Handle a key down event.
|
boolean |
onKeyUp(int keyCode,
android.view.KeyEvent event,
MapView mapView)
Handle a key up event.
|
boolean |
onTap(GeoPoint p,
MapView mapView)
Handle a "tap" event.
|
boolean |
onTouchEvent(android.view.MotionEvent e,
MapView mapView)
Handle a touch event.
|
boolean |
onTrackballEvent(android.view.MotionEvent event,
MapView mapView)
Handle a trackball event.
|
protected static final float SHADOW_X_SKEW
protected static final float SHADOW_Y_SCALE
protected static void drawAt(android.graphics.Canvas canvas,
android.graphics.drawable.Drawable drawable,
int x,
int y,
boolean shadow)
MapView.getProjection()
method on the MapView passed to you in draw(Canvas, MapView, boolean).shadow - If true, draw only the drawable's shadow. Otherwise,
draw the drawable itself.public boolean onTouchEvent(android.view.MotionEvent e,
MapView mapView)
e - The motion event.mapView - the MapView that generated the touch eventpublic boolean onTrackballEvent(android.view.MotionEvent event,
MapView mapView)
event - The motion event.mapView - the MapView that generated the trackball eventpublic boolean onKeyDown(int keyCode,
android.view.KeyEvent event,
MapView mapView)
keyCode - The key code.event - The key event.mapView - the MapView that generated the key eventpublic boolean onKeyUp(int keyCode,
android.view.KeyEvent event,
MapView mapView)
keyCode - The key codeevent - The key eventmapView - the MapView that generated the key eventpublic boolean onTap(GeoPoint p, MapView mapView)
p - The point that has been tapped.mapView - the MapView that generated the tap eventpublic void draw(android.graphics.Canvas canvas,
MapView mapView,
boolean shadow)
canvas - The Canvas upon which to draw. Note that this
may already have a transformation applied, so be sure to leave
it the way you found it.mapView - the MapView that requested the draw. Use MapView.getProjection() to convert between on-screen pixels and
latitude/longitude pairs.shadow - If true, draw the shadow layer. If false, draw the
overlay contents.public boolean draw(android.graphics.Canvas canvas,
MapView mapView,
boolean shadow,
long when)
draw(Canvas, MapView, boolean) and returns false.canvas - The Canvas upon which to draw. Note that this
may already have a transformation applied, so be sure to leave
it the way you found it.mapView - the MapView that requested the draw. Use MapView.getProjection() to convert between on-screen pixels and
latitude/longitude pairs.shadow - If true, draw the shadow layer. If false, draw the
overlay contents.when - The timestamp of the draw.