public class MyLocationNewOverlay extends SafeDrawOverlay implements IMyLocationConsumer, IOverlayMenuProvider, Overlay.Snappable
Overlay.Snappable
Modifier and Type | Field and Description |
---|---|
protected SafePaint |
mCirclePaint |
protected android.graphics.Bitmap |
mDirectionArrowBitmap |
protected double |
mDirectionArrowCenterX |
protected double |
mDirectionArrowCenterY |
protected boolean |
mDrawAccuracyEnabled |
static int |
MENU_MY_LOCATION |
protected boolean |
mIsFollowing |
protected MapView |
mMapView |
IMyLocationProvider |
mMyLocationProvider |
protected SafePaint |
mPaint |
protected android.graphics.Bitmap |
mPersonBitmap |
protected android.graphics.PointF |
mPersonHotspot
Coordinates the feet of the person are located scaled for display density.
|
mResourceProxy, mScale, SHADOW_X_SKEW, SHADOW_Y_SCALE
DEBUGMODE, DEFAULT_ZOOMLEVEL_MINIMAP_DIFFERENCE, NOT_SET
Constructor and Description |
---|
MyLocationNewOverlay(android.content.Context context,
IMyLocationProvider myLocationProvider,
MapView mapView) |
MyLocationNewOverlay(android.content.Context context,
MapView mapView) |
MyLocationNewOverlay(IMyLocationProvider myLocationProvider,
MapView mapView,
ResourceProxy resourceProxy) |
Modifier and Type | Method and Description |
---|---|
void |
disableFollowLocation()
Disables "follow" functionality.
|
void |
disableMyLocation()
Disable location updates
|
protected void |
drawMyLocation(ISafeCanvas canvas,
MapView mapView,
android.location.Location lastFix) |
protected void |
drawSafe(ISafeCanvas canvas,
MapView mapView,
boolean shadow) |
void |
enableFollowLocation()
Enables "follow" functionality.
|
boolean |
enableMyLocation()
Enable receiving location updates from the provided IMyLocationProvider and show your
location on the maps.
|
boolean |
enableMyLocation(IMyLocationProvider myLocationProvider) |
android.location.Location |
getLastFix() |
GeoPoint |
getMyLocation()
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) |
IMyLocationProvider |
getMyLocationProvider() |
boolean |
isDrawAccuracyEnabled()
If enabled, an accuracy circle will be drawn around your current position.
|
boolean |
isFollowLocationEnabled()
If enabled, the map will center on your current location and automatically scroll as you
move.
|
boolean |
isMyLocationEnabled()
If enabled, the map is receiving location updates and drawing your location on the map.
|
boolean |
isOptionsMenuEnabled()
Can be used to signal to external callers that this Overlay should not be used for providing
option menu items.
|
boolean |
onCreateOptionsMenu(android.view.Menu pMenu,
int pMenuIdOffset,
MapView pMapView) |
void |
onDetach(MapView mapView)
Override to perform clean up of resources before shutdown.
|
void |
onLocationChanged(android.location.Location location,
IMyLocationProvider source) |
boolean |
onOptionsItemSelected(android.view.MenuItem pItem,
int pMenuIdOffset,
MapView pMapView) |
boolean |
onPrepareOptionsMenu(android.view.Menu pMenu,
int pMenuIdOffset,
MapView pMapView) |
boolean |
onSnapToItem(int x,
int y,
android.graphics.Point snapPoint,
IMapView mapView)
Checks to see if the given x and y are close enough to an item resulting in snapping the
current action (e.g.
|
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 |
runOnFirstFix(Runnable runnable) |
void |
setDrawAccuracyEnabled(boolean drawAccuracyEnabled)
If enabled, an accuracy circle will be drawn around your current position.
|
protected void |
setMyLocationProvider(IMyLocationProvider myLocationProvider) |
void |
setOptionsMenuEnabled(boolean pOptionsMenuEnabled) |
void |
setPersonHotspot(float x,
float y) |
draw, isUsingSafeCanvas, setUseSafeCanvas
drawAt, getSafeMenuId, getSafeMenuIdSequence, isEnabled, onDoubleTap, onDoubleTapEvent, onDown, onFling, onKeyDown, onKeyUp, onLongPress, onScroll, onShowPress, onSingleTapConfirmed, onSingleTapUp, onTrackballEvent, setEnabled
protected final SafePaint mPaint
protected final SafePaint mCirclePaint
protected final android.graphics.Bitmap mPersonBitmap
protected final android.graphics.Bitmap mDirectionArrowBitmap
protected final MapView mMapView
public IMyLocationProvider mMyLocationProvider
protected boolean mIsFollowing
protected boolean mDrawAccuracyEnabled
protected final android.graphics.PointF mPersonHotspot
protected final double mDirectionArrowCenterX
protected final double mDirectionArrowCenterY
public static final int MENU_MY_LOCATION
public MyLocationNewOverlay(android.content.Context context, MapView mapView)
public MyLocationNewOverlay(android.content.Context context, IMyLocationProvider myLocationProvider, MapView mapView)
public MyLocationNewOverlay(IMyLocationProvider myLocationProvider, MapView mapView, ResourceProxy resourceProxy)
public void onDetach(MapView mapView)
Overlay
public void setDrawAccuracyEnabled(boolean drawAccuracyEnabled)
drawAccuracyEnabled
- whether the accuracy circle will be enabledpublic boolean isDrawAccuracyEnabled()
public IMyLocationProvider getMyLocationProvider()
protected void setMyLocationProvider(IMyLocationProvider myLocationProvider)
public void setPersonHotspot(float x, float y)
protected void drawMyLocation(ISafeCanvas canvas, MapView mapView, android.location.Location lastFix)
protected android.graphics.Rect getMyLocationDrawingBounds(int zoomLevel, android.location.Location lastFix, android.graphics.Rect reuse)
protected void drawSafe(ISafeCanvas canvas, MapView mapView, boolean shadow)
drawSafe
in class SafeDrawOverlay
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 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()
public void enableFollowLocation()
public void disableFollowLocation()
public boolean isFollowLocationEnabled()
public void onLocationChanged(android.location.Location location, IMyLocationProvider source)
onLocationChanged
in interface IMyLocationConsumer
public boolean enableMyLocation(IMyLocationProvider myLocationProvider)
public boolean enableMyLocation()
public void disableMyLocation()
public boolean isMyLocationEnabled()
public boolean runOnFirstFix(Runnable runnable)
Copyright © 2014. All Rights Reserved.