MyLocationNewOverlay
instead.public class MyLocationOverlay extends Overlay implements IMyLocationOverlay, IOverlayMenuProvider, android.hardware.SensorEventListener, android.location.LocationListener, Overlay.Snappable
Overlay.Snappable
Modifier and Type | Field and Description |
---|---|
protected float |
COMPASS_FRAME_CENTER_X
Deprecated.
|
protected float |
COMPASS_FRAME_CENTER_Y
Deprecated.
|
protected float |
COMPASS_ROSE_CENTER_X
Deprecated.
|
protected float |
COMPASS_ROSE_CENTER_Y
Deprecated.
|
protected android.graphics.Bitmap |
DIRECTION_ARROW
Deprecated.
|
protected float |
DIRECTION_ARROW_CENTER_X
Deprecated.
|
protected float |
DIRECTION_ARROW_CENTER_Y
Deprecated.
|
protected android.graphics.Paint |
mCirclePaint
Deprecated.
|
protected android.graphics.Picture |
mCompassFrame
Deprecated.
|
protected android.graphics.Picture |
mCompassRose
Deprecated.
|
protected boolean |
mDrawAccuracyEnabled
Deprecated.
|
static int |
MENU_COMPASS
Deprecated.
|
static int |
MENU_MY_LOCATION
Deprecated.
|
protected boolean |
mFollow
Deprecated.
|
LocationListenerProxy |
mLocationListener
Deprecated.
|
protected MapView |
mMapView
Deprecated.
|
protected android.graphics.Paint |
mPaint
Deprecated.
|
SensorEventListenerProxy |
mSensorListener
Deprecated.
|
protected android.graphics.PointF |
PERSON_HOTSPOT
Deprecated.
Coordinates the feet of the person are located scaled for display density.
|
protected android.graphics.Bitmap |
PERSON_ICON
Deprecated.
|
mResourceProxy, mScale, SHADOW_X_SKEW, SHADOW_Y_SCALE
DEBUGMODE, DEFAULT_ZOOMLEVEL_MINIMAP_DIFFERENCE, NOT_SET
Constructor and Description |
---|
MyLocationOverlay(android.content.Context ctx,
MapView mapView)
Deprecated.
|
MyLocationOverlay(android.content.Context ctx,
MapView mapView,
ResourceProxy pResourceProxy)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
disableCompass()
Deprecated.
Disable orientation updates
|
void |
disableFollowLocation()
Deprecated.
Disables "follow" functionality.
|
void |
disableMyLocation()
Deprecated.
Disable location updates
|
void |
draw(android.graphics.Canvas canvas,
MapView mapView,
boolean shadow)
Deprecated.
Draw the overlay over the map.
|
protected void |
drawCompass(android.graphics.Canvas canvas,
float bearing,
android.graphics.Rect screenRect)
Deprecated.
|
protected void |
drawMyLocation(android.graphics.Canvas canvas,
MapView mapView,
android.location.Location lastFix)
Deprecated.
|
boolean |
enableCompass()
Deprecated.
Enable orientation sensor (compass) updates and show a compass on the map.
|
void |
enableFollowLocation()
Deprecated.
Enables "follow" functionality.
|
boolean |
enableMyLocation()
Deprecated.
Enable location updates and show your current location on the map.
|
void |
followLocation(boolean follow)
Deprecated.
use
enableFollowLocation() and disableFollowLocation() instead. |
android.location.Location |
getLastFix()
Deprecated.
|
float |
getLocationUpdateMinDistance()
Deprecated.
|
long |
getLocationUpdateMinTime()
Deprecated.
|
GeoPoint |
getMyLocation()
Deprecated.
Return a GeoPoint of the last known location, or null if not known.
|
protected android.graphics.Rect |
getMyLocationDrawingBounds(int zoomLevel,
android.location.Location lastFix,
android.graphics.Rect reuse)
Deprecated.
|
float |
getOrientation()
Deprecated.
|
boolean |
isCompassEnabled()
Deprecated.
If enabled, the map is receiving orientation updates and drawing your location on the map.
|
boolean |
isDrawAccuracyEnabled()
Deprecated.
If enabled, an accuracy circle will be drawn around your current position.
|
boolean |
isFollowLocationEnabled()
Deprecated.
If enabled, the map will center on your current location and automatically scroll as you
move.
|
boolean |
isMyLocationEnabled()
Deprecated.
If enabled, the map is receiving location updates and drawing your location on the map.
|
boolean |
isOptionsMenuEnabled()
Deprecated.
Can be used to signal to external callers that this Overlay should not be used for providing
option menu items.
|
void |
onAccuracyChanged(android.hardware.Sensor arg0,
int arg1)
Deprecated.
|
boolean |
onCreateOptionsMenu(android.view.Menu pMenu,
int pMenuIdOffset,
MapView pMapView)
Deprecated.
|
void |
onLocationChanged(android.location.Location location)
Deprecated.
|
boolean |
onOptionsItemSelected(android.view.MenuItem pItem,
int pMenuIdOffset,
MapView pMapView)
Deprecated.
|
boolean |
onPrepareOptionsMenu(android.view.Menu pMenu,
int pMenuIdOffset,
MapView pMapView)
Deprecated.
|
void |
onProviderDisabled(String provider)
Deprecated.
|
void |
onProviderEnabled(String provider)
Deprecated.
|
void |
onSensorChanged(android.hardware.SensorEvent event)
Deprecated.
|
boolean |
onSnapToItem(int x,
int y,
android.graphics.Point snapPoint,
IMapView mapView)
Deprecated.
Checks to see if the given x and y are close enough to an item resulting in snapping the
current action (e.g.
|
void |
onStatusChanged(String provider,
int status,
android.os.Bundle extras)
Deprecated.
|
boolean |
onTouchEvent(android.view.MotionEvent event,
MapView mapView)
Deprecated.
You can prevent all(!) other Touch-related events from happening!
By default does nothing ( return false ). |
boolean |
runOnFirstFix(Runnable runnable)
Deprecated.
|
void |
setCompassCenter(float x,
float y)
Deprecated.
|
void |
setDrawAccuracyEnabled(boolean drawAccuracyEnabled)
Deprecated.
If enabled, an accuracy circle will be drawn around your current position.
|
void |
setLocationUpdateMinDistance(float meters)
Deprecated.
Set the minimum distance for location updates.
|
void |
setLocationUpdateMinTime(long milliSeconds)
Deprecated.
Set the minimum interval for location updates.
|
void |
setOptionsMenuEnabled(boolean pOptionsMenuEnabled)
Deprecated.
|
drawAt, getSafeMenuId, getSafeMenuIdSequence, isEnabled, onDetach, onDoubleTap, onDoubleTapEvent, onDown, onFling, onKeyDown, onKeyUp, onLongPress, onScroll, onShowPress, onSingleTapConfirmed, onSingleTapUp, onTrackballEvent, setEnabled
protected final android.graphics.Paint mPaint
protected final android.graphics.Paint mCirclePaint
protected final android.graphics.Bitmap PERSON_ICON
protected final android.graphics.Bitmap DIRECTION_ARROW
protected final MapView mMapView
public LocationListenerProxy mLocationListener
public SensorEventListenerProxy mSensorListener
protected boolean mFollow
protected boolean mDrawAccuracyEnabled
protected final android.graphics.PointF PERSON_HOTSPOT
protected final float DIRECTION_ARROW_CENTER_X
protected final float DIRECTION_ARROW_CENTER_Y
protected final android.graphics.Picture mCompassFrame
protected final android.graphics.Picture mCompassRose
protected final float COMPASS_FRAME_CENTER_X
protected final float COMPASS_FRAME_CENTER_Y
protected final float COMPASS_ROSE_CENTER_X
protected final float COMPASS_ROSE_CENTER_Y
public static final int MENU_MY_LOCATION
public static final int MENU_COMPASS
public MyLocationOverlay(android.content.Context ctx, MapView mapView)
public MyLocationOverlay(android.content.Context ctx, MapView mapView, ResourceProxy pResourceProxy)
public long getLocationUpdateMinTime()
public void setLocationUpdateMinTime(long milliSeconds)
LocationManager.requestLocationUpdates(String, long, float, LocationListener)
.
Note that you should call this before calling enableMyLocation()
.milliSeconds
- public float getLocationUpdateMinDistance()
public void setLocationUpdateMinDistance(float meters)
LocationManager.requestLocationUpdates(java.lang.String, long, float, android.location.LocationListener)
.
Note that you should call this before calling enableMyLocation()
.meters
- public void setCompassCenter(float x, float y)
public void setDrawAccuracyEnabled(boolean drawAccuracyEnabled)
drawAccuracyEnabled
- whether the accuracy circle will be enabledpublic boolean isDrawAccuracyEnabled()
protected void drawMyLocation(android.graphics.Canvas canvas, MapView mapView, android.location.Location lastFix)
protected android.graphics.Rect getMyLocationDrawingBounds(int zoomLevel, android.location.Location lastFix, android.graphics.Rect reuse)
protected void drawCompass(android.graphics.Canvas canvas, float bearing, android.graphics.Rect screenRect)
public void draw(android.graphics.Canvas canvas, MapView mapView, boolean shadow)
Overlay
public void onLocationChanged(android.location.Location location)
onLocationChanged
in interface android.location.LocationListener
public void onProviderDisabled(String provider)
onProviderDisabled
in interface android.location.LocationListener
public void onProviderEnabled(String provider)
onProviderEnabled
in interface android.location.LocationListener
public void onStatusChanged(String provider, int status, android.os.Bundle extras)
onStatusChanged
in interface android.location.LocationListener
onStatusChanged
in interface IMyLocationOverlay
public boolean onSnapToItem(int x, int y, android.graphics.Point snapPoint, IMapView mapView)
Overlay.Snappable
onSnapToItem
in interface Overlay.Snappable
x
- The x in screen coordinates.y
- The y in screen coordinates.snapPoint
- 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.mapView
- The MapView
that is requesting the snap. Use MapView.getProjection()
to convert between on-screen pixels and latitude/longitude pairs.public boolean onTouchEvent(android.view.MotionEvent event, MapView mapView)
Overlay
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.onTouchEvent
in class Overlay
public void onAccuracyChanged(android.hardware.Sensor arg0, int arg1)
onAccuracyChanged
in interface android.hardware.SensorEventListener
public void onSensorChanged(android.hardware.SensorEvent event)
onSensorChanged
in interface android.hardware.SensorEventListener
public void setOptionsMenuEnabled(boolean pOptionsMenuEnabled)
setOptionsMenuEnabled
in interface IOverlayMenuProvider
public boolean isOptionsMenuEnabled()
IOverlayMenuProvider
isOptionsMenuEnabled
in interface IOverlayMenuProvider
public boolean onCreateOptionsMenu(android.view.Menu pMenu, int pMenuIdOffset, MapView pMapView)
onCreateOptionsMenu
in interface IOverlayMenuProvider
public boolean onPrepareOptionsMenu(android.view.Menu pMenu, int pMenuIdOffset, MapView pMapView)
onPrepareOptionsMenu
in interface IOverlayMenuProvider
public boolean onOptionsItemSelected(android.view.MenuItem pItem, int pMenuIdOffset, MapView pMapView)
onOptionsItemSelected
in interface IOverlayMenuProvider
public GeoPoint getMyLocation()
public android.location.Location getLastFix()
getLastFix
in interface IMyLocationOverlay
@Deprecated public void followLocation(boolean follow)
public void enableFollowLocation()
public void disableFollowLocation()
public boolean isFollowLocationEnabled()
public boolean enableMyLocation()
setLocationUpdateMinTime(long)
and/or setLocationUpdateMinDistance(float)
before calling this method. You will want to call
enableMyLocation() probably from your Activity's Activity.onResume() method, to enable the
features of this overlay. Remember to call the corresponding disableMyLocation() in your
Activity's Activity.onPause() method to turn off updates when in the background.enableMyLocation
in interface IMyLocationOverlay
public void disableMyLocation()
disableMyLocation
in interface IMyLocationOverlay
public boolean isMyLocationEnabled()
isMyLocationEnabled
in interface IMyLocationOverlay
public boolean enableCompass()
enableCompass
in interface IMyLocationOverlay
public void disableCompass()
disableCompass
in interface IMyLocationOverlay
public boolean isCompassEnabled()
isCompassEnabled
in interface IMyLocationOverlay
public float getOrientation()
getOrientation
in interface IMyLocationOverlay
public boolean runOnFirstFix(Runnable runnable)
runOnFirstFix
in interface IMyLocationOverlay
Copyright © 2015. All Rights Reserved.