public class MyLocationNewOverlay extends Overlay implements IMyLocationConsumer, IOverlayMenuProvider, Overlay.Snappable
Overlay.Snappable
Modifier and Type | Field and Description |
---|---|
protected android.graphics.Paint |
mCirclePaint |
protected android.graphics.Bitmap |
mDirectionArrowBitmap |
protected float |
mDirectionArrowCenterX |
protected float |
mDirectionArrowCenterY |
protected boolean |
mDrawAccuracyEnabled |
static int |
MENU_MY_LOCATION |
protected boolean |
mIsFollowing |
protected MapView |
mMapView |
IMyLocationProvider |
mMyLocationProvider |
protected android.graphics.Paint |
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 |
draw(android.graphics.Canvas c,
MapView mapView,
boolean shadow)
Draw the overlay over the map.
|
protected void |
drawMyLocation(android.graphics.Canvas canvas,
MapView mapView,
android.location.Location lastFix) |
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)
Call when a provider has a new location to consume.
|
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)
Queues a runnable to be executed as soon as we have a location fix.
|
void |
setDrawAccuracyEnabled(boolean drawAccuracyEnabled)
If enabled, an accuracy circle will be drawn around your current position.
|
protected void |
setLocation(android.location.Location location) |
protected void |
setMyLocationProvider(IMyLocationProvider myLocationProvider) |
void |
setOptionsMenuEnabled(boolean pOptionsMenuEnabled) |
void |
setPersonHotspot(float x,
float y) |
void |
setPersonIcon(android.graphics.Bitmap icon)
enabls you to change the my location 'person' icon at runtime.
|
protected void |
stopLocationProvider() |
drawAt, getSafeMenuId, getSafeMenuIdSequence, isEnabled, 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 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 float mDirectionArrowCenterX
protected final float 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(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 draw(android.graphics.Canvas c, MapView mapView, boolean shadow)
Overlay
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)
IMyLocationConsumer
onLocationChanged
in interface IMyLocationConsumer
protected void setLocation(android.location.Location location)
public boolean enableMyLocation(IMyLocationProvider myLocationProvider)
public boolean enableMyLocation()
public void disableMyLocation()
protected void stopLocationProvider()
public boolean isMyLocationEnabled()
public boolean runOnFirstFix(Runnable runnable)
public void setPersonIcon(android.graphics.Bitmap icon)
setPersonHotspot(float, float)
icon
- Copyright © 2015. All Rights Reserved.