com.google.android.maps.Overlay
Base class representing an overlay which may be displayed on top of
a map. To add an overlay, subclass this class, create an instance,
and add it to the list obtained from getOverlays().
Known Direct Subclasses
Summary
Constants
|
|
|
Value |
|
float |
SHADOW_X_SKEW |
X Skew value for creating a marker shadow in perspective. |
-0.9 |
float |
SHADOW_Y_SCALE |
Y Scale value for creating a marker shadow in perspective. |
0.5 |
Public Constructors
Public Methods
|
|
|
|
|
boolean |
draw(Canvas canvas, MapView mapView, boolean shadow, long when) |
|
|
|
|
|
void |
draw(Canvas canvas, MapView mapView, boolean shadow) |
|
|
|
|
|
boolean |
onKeyDown(int keyCode, KeyEvent event, MapView mapView) |
|
|
|
|
|
boolean |
onKeyUp(int keyCode, KeyEvent event, MapView mapView) |
|
|
|
|
|
boolean |
onTap(GeoPoint p, MapView mapView) |
|
|
|
|
|
boolean |
onTouchEvent(MotionEvent e, MapView mapView) |
|
|
|
|
|
boolean |
onTrackballEvent(MotionEvent event, MapView mapView) |
Protected Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Constants
protected
static
final
float
SHADOW_X_SKEW
X Skew value for creating a marker shadow in perspective.
Constant Value:
-0.9
protected
static
final
float
SHADOW_Y_SCALE
Y Scale value for creating a marker shadow in perspective.
Constant Value:
0.5
Public Constructors
Public Methods
public
boolean
draw(Canvas canvas, MapView mapView, boolean shadow, long when)
Draw call for animated overlays. By default, calls through to
draw(Canvas, MapView, boolean) and returns false.
Parameters
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 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. |
Returns
- True if you need to be drawn again right away; false
otherwise. Default implementation returns false.
public
void
draw(Canvas canvas, MapView mapView, boolean shadow)
Draw the overlay over the map. This will be called on all
active overlays with shadow=true, to lay down the shadow layer,
and then again on all overlays with shadow=false.
By default, draws nothing.
Parameters
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 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
onKeyDown(int keyCode, KeyEvent event, MapView mapView)
Handle a key down event.
By default does nothing and returns false.
Parameters
keyCode
| The key code. |
event
| The key event. |
mapView
| the MapView that generated the key event |
Returns
- True If the tap was handled by this overlay.
public
boolean
onKeyUp(int keyCode, KeyEvent event, MapView mapView)
Handle a key up event.
By default does nothing and returns false.
Parameters
keyCode
| The key code |
event
| The key event |
mapView
| the MapView that generated the key event |
Returns
- True if the tap was handled by this overlay.
public
boolean
onTap(GeoPoint p, MapView mapView)
Handle a "tap" event. This can be either a touchscreen tap
anywhere on the map, or a trackball click on the center of the
map. By default does nothing and returns false.
Parameters
p
| The point that has been tapped. |
mapView
| the MapView that generated the tap event |
Returns
- True if the tap was handled by this overlay.
public
boolean
onTouchEvent(MotionEvent e, MapView mapView)
Handle a touch event.
By default does nothing and returns false.
Parameters
e
| The motion event. |
mapView
| the MapView that generated the touch event |
Returns
- True if the tap was handled by this overlay.
public
boolean
onTrackballEvent(MotionEvent event, MapView mapView)
Handle a trackball event.
By default does nothing and returns false.
Parameters
event
| The motion event. |
mapView
| the MapView that generated the trackball event |
Returns
- True if the tap was handled by this overlay.
Protected Methods
protected
static
void
drawAt(Canvas canvas, Drawable drawable, int x, int y, boolean shadow)
Convenience method to draw a Drawable at an offset. x and y
are pixel coordinates. You can find appropriate coordinates
from latitude/longitude using the
getProjection()
method on the
MapView passed to you in
draw(Canvas, MapView, boolean).
Parameters
shadow
| If true, draw only the drawable's shadow. Otherwise,
draw the drawable itself.
|