本文整理汇总了Java中org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay类的典型用法代码示例。如果您正苦于以下问题:Java MyLocationNewOverlay类的具体用法?Java MyLocationNewOverlay怎么用?Java MyLocationNewOverlay使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MyLocationNewOverlay类属于org.osmdroid.views.overlay.mylocation包,在下文中一共展示了MyLocationNewOverlay类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUpMapIfNeeded
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
/**
* Description: Initialises the Map and sets initial options such as:
* Zoom levels and controls
* Compass
* ScaleBar
* Cluster Pin colors
* Location update settings
*/
private void setUpMapIfNeeded() {
// Check if we were successful in obtaining the map.
mMap.setBuiltInZoomControls(true);
mMap.setMultiTouchControls(true);
mMap.setMinZoomLevel(3);
mMap.setMaxZoomLevel(19); // Latest OSM can go to 21!
mMap.getTileProvider().createTileCache();
mCompassOverlay = new CompassOverlay(this, new InternalCompassOrientationProvider(this), mMap);
ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(this);
mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10);
mScaleBarOverlay.setCentred(true);
// Sets cluster pin color
mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(MapViewerOsmDroid.this);
//BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange);
BitmapDrawable mapPinDrawable = (BitmapDrawable) ResourcesCompat.getDrawable(getResources(),R.drawable.ic_map_pin_orange, null);
mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap());
GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(MapViewerOsmDroid.this.getBaseContext());
gpsMyLocationProvider.setLocationUpdateMinDistance(100); // [m] // Set the minimum distance for location updates
gpsMyLocationProvider.setLocationUpdateMinTime(10000); // [ms] // Set the minimum time interval for location updates
mMyLocationOverlay = new MyLocationNewOverlay(MapViewerOsmDroid.this.getBaseContext(), gpsMyLocationProvider, mMap);
mMyLocationOverlay.setDrawAccuracyEnabled(true);
mMap.getOverlays().add(mCellTowerGridMarkerClusterer);
mMap.getOverlays().add(mMyLocationOverlay);
mMap.getOverlays().add(mCompassOverlay);
mMap.getOverlays().add(mScaleBarOverlay);
}
示例2: addLocationOverlay
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
public static MyLocationNewOverlay addLocationOverlay(Context context, MapView map)
{
MyLocationNewOverlay locationOverlay = new MyLocationNewOverlay(context,
new GpsMyLocationProvider(context), map);
if (!locationOverlay.enableMyLocation())
return null;
Bitmap icon = BitmapFactory.decodeResource(context.getResources(), R.drawable.user_location);
locationOverlay.setPersonIcon(icon);
locationOverlay.setPersonHotspot(icon.getWidth() / 2, icon.getHeight());
map.getOverlays().add(locationOverlay);
return locationOverlay;
}
示例3: onResume
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
mRadiusMarkerClusterer = new DevicesMarkerClusterer(getContext());
mRadiusMarkerClusterer.setIcon(BitmapFactory.decodeResource(getResources(), R.drawable.marker_cluster));
mMapView.getOverlays().add(mRadiusMarkerClusterer);
mLocationOverlay = new MyLocationNewOverlay(new GpsMyLocationProvider(getActivity()), mMapView);
mLocationOverlay.disableFollowLocation();
mLocationOverlay.disableMyLocation();
mMapView.getOverlays().add(mLocationOverlay);
}
示例4: enableMyLocationOverlay
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
/**
* Initialize the map layer and feature to show user's location
* on the map.
*/
private void enableMyLocationOverlay(){
if(userLocation == null){
myLocationOverlay = new MyLocationNewOverlay(new GpsMyLocationProvider(context),mapView);
}
myLocationOverlay.enableMyLocation();
myLocationOverlay.disableFollowLocation();
myLocationOverlay.setOptionsMenuEnabled(true);
if(!mapView.containsOverlay(OverlayTags.MY_LOCATION))
mapView.addOverlay(myLocationOverlay, OverlayTags.MY_LOCATION);
}
示例5: removeAllOverlays
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
/**
* Removes all overlays from the MapView except MyLocationOverlay instances.
*/
public void removeAllOverlays(){
int size = layersTags.size()- 1;
for (int i = size; i > 0 ; i--) {
Overlay currentOverlay = this.getOverlays().get(i);
if(!(currentOverlay instanceof MyLocationNewOverlay || currentOverlay instanceof CopyrightOverlay))
this.removeOverlay(layersTags.get(i));
}
Log.i(TAG, "Map Cleared.");
Log.i(TAG, "Current Overlays: " + this.getLayersTagsNames());
}
示例6: setUpMapIfNeeded
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
/**
* Description: Initialises the Map and sets initial options such as:
* Zoom levels and controls
* Compass
* ScaleBar
* Cluster Pin colors
* Location update settings
*/
private void setUpMapIfNeeded() {
// Check if we were successful in obtaining the map.
mMap.setBuiltInZoomControls(true);
mMap.setMultiTouchControls(true);
mMap.setMinZoomLevel(3);
mMap.setMaxZoomLevel(19); // Latest OSM can go to 21!
mMap.getTileProvider().createTileCache();
mCompassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), mMap);
ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(getActivity());
mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10);
mScaleBarOverlay.setCentred(true);
// Sets cluster pin color
mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(getActivity());
BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange);
mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap());
GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(getActivity().getBaseContext());
gpsMyLocationProvider.setLocationUpdateMinDistance(100); // [m] // Set the minimum distance for location updates
gpsMyLocationProvider.setLocationUpdateMinTime(10000); // [ms] // Set the minimum time interval for location updates
mMyLocationOverlay = new MyLocationNewOverlay(getActivity().getBaseContext(), gpsMyLocationProvider, mMap);
mMyLocationOverlay.setDrawAccuracyEnabled(true);
mMap.getOverlays().add(mCellTowerGridMarkerClusterer);
mMap.getOverlays().add(mMyLocationOverlay);
mMap.getOverlays().add(mCompassOverlay);
mMap.getOverlays().add(mScaleBarOverlay);
}
示例7: setUpMapIfNeeded
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
/**
* Description: Initialises the Map and sets initial options such as:
* Zoom levels and controls
* Compass
* ScaleBar
* Cluster Pin colors
* Location update settings
*/
private void setUpMapIfNeeded() {
// Check if we were successful in obtaining the map.
mMap.setBuiltInZoomControls(true);
mMap.setMultiTouchControls(true);
mMap.setMinZoomLevel(3);
mMap.setMaxZoomLevel(19); // Latest OSM can go to 21!
mMap.getTileProvider().createTileCache();
mCompassOverlay = new CompassOverlay(this, new InternalCompassOrientationProvider(this), mMap);
ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(this);
mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10);
mScaleBarOverlay.setCentred(true);
// Sets cluster pin color
mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(MapViewerOsmDroid.this);
BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange);
mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap());
GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(MapViewerOsmDroid.this.getBaseContext());
gpsMyLocationProvider.setLocationUpdateMinDistance(100); // [m] // Set the minimum distance for location updates
gpsMyLocationProvider.setLocationUpdateMinTime(10000); // [ms] // Set the minimum time interval for location updates
mMyLocationOverlay = new MyLocationNewOverlay(MapViewerOsmDroid.this.getBaseContext(), gpsMyLocationProvider, mMap);
mMyLocationOverlay.setDrawAccuracyEnabled(true);
mMap.getOverlays().add(mCellTowerGridMarkerClusterer);
mMap.getOverlays().add(mMyLocationOverlay);
mMap.getOverlays().add(mCompassOverlay);
mMap.getOverlays().add(mScaleBarOverlay);
}
示例8: onCreateView
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
fragmentView = (LinearLayout) inflater.inflate(R.layout.main, container, false);
layout1 = (LinearLayout) fragmentView.findViewById(R.id.linearLayout1);
layout2 = (LinearLayout) fragmentView.findViewById(R.id.linearLayout2);
layout4 = (LinearLayout) fragmentView.findViewById(R.id.linearLayout4);
layout5 = (LinearLayout) fragmentView.findViewById(R.id.linearLayout5);
defineWidgets(fragmentView);
if (savedInstanceState != null)
chrono.setBase(chronoBaseValue);
chrono.setOnChronometerTickListener(new OnChronometerTickListener() {
public void onChronometerTick(Chronometer arg0) {
showCalculatedData(arg0);
if (prefs.getInt("practice_display5", TypesOfPractices.BASIC_PRACTICE.getTypes()) == TypesOfPractices.HIIT_PRACTICE
.getTypes())
showHiitTrainingDataInDisplay(arg0);
}
});
mapView = (MapView) fragmentView.findViewById(R.id.practice_mapview);
mapView.getOverlays().clear();
mapView.setBuiltInZoomControls(true);
mapView.setMultiTouchControls(true);
mapView.setUseSafeCanvas(true);
setHardwareAccelerationOff();
mapController = (MapController) mapView.getController();
ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(mContext);
mapView.getOverlays().add(mScaleBarOverlay);
pathOverlay = new PathOverlay(Color.BLUE, mContext);
pathOverlay.getPaint().setStyle(Style.STROKE);
pathOverlay.getPaint().setStrokeWidth(3);
pathOverlay.getPaint().setAntiAlias(true);
mapView.getOverlays().add(pathOverlay);
this.mCompassOverlay = new CompassOverlay(mContext, new InternalCompassOrientationProvider(mContext),
mapView);
mCompassOverlay.setEnabled(true);
mapView.getOverlays().add(mCompassOverlay);
this.mLocationOverlay = new MyLocationNewOverlay(mContext, new GpsMyLocationProvider(mContext),
mapView);
mLocationOverlay.setDrawAccuracyEnabled(true);
mapView.getOverlays().add(mLocationOverlay);
MapOverlay touchOverlay = new MapOverlay(mContext);
mapView.getOverlays().add(touchOverlay);
mLocationOverlay.runOnFirstFix(new Runnable() {
public void run() {
if (centerPoint == null)
centerPoint = mLocationOverlay.getMyLocation();
centerMyLocation(centerPoint);
}
});
mapView.postInvalidate();
return fragmentView;
}
示例9: onCreate
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(R.string.select_station);
analyticsUtils.onScreen("map selection screen");
// load args
stationSelection = new StationSelection(getIntent());
// setup map
mapView.setMultiTouchControls(true);
locationOverlay = new MyLocationNewOverlay(
this,
new GpsMyLocationProvider(this),
mapView);
mapView.getOverlays().add(locationOverlay);
// restore state
if (savedInstanceState != null) {
mapView.getController().setZoom(savedInstanceState.getInt(EXTRA_ZOOM_LEVEL, 1));
mapView.scrollTo(
savedInstanceState.getInt(EXTRA_SCROLL_X, 0),
savedInstanceState.getInt(EXTRA_SCROLL_Y, 0));
}
loadData();
}
示例10: onCreate
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initialize location requests
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
bestProvider = getLocationManager().getBestProvider(criteria, true);
// Create map
setContentView(R.layout.activity_map);
backButtonCount = 0;
mMap = (MapView) this.findViewById(R.id.map);
mMap.setTileSource(getTileSource());
mMap.setBuiltInZoomControls(true);
mMap.setMultiTouchControls(true);
mMap.getController().setZoom(3);
initLocation();
// Add your own location
mMyLocationOverlay = new MyLocationNewOverlay(getApplicationContext(), mMap);
mMyLocationOverlay.enableMyLocation();
mMyLocationOverlay.setDrawAccuracyEnabled(true);
mMap.getOverlays().add(mMyLocationOverlay);
resourceProxy = new DefaultResourceProxyImpl(getApplicationContext());
}
示例11: addOverlays
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
@Override
public void addOverlays() {
overlay = new MyLocationNewOverlay(mMapView);
overlay.setEnableAutoStop(false);
overlay.enableFollowLocation();
overlay.enableMyLocation();
mMapView.setBuiltInZoomControls(true);
this.mMapView.getOverlayManager().add(overlay);
}
示例12: addOverlays
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
public void addOverlays() {
mLocationOverlay = new MyLocationNewOverlay(mMapView);
mLocationOverlay.setEnableAutoStop(false);
mLocationOverlay.enableFollowLocation();
mLocationOverlay.enableMyLocation();
this.mMapView.getOverlayManager().add(mLocationOverlay);
mMapView.setBuiltInZoomControls(true);
mMapView.setMultiTouchControls(true);
mMapView.setTilesScaledToDpi(true);
}
示例13: setUpMapIfNeeded
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
/**
* Description: Initialises the Map and sets initial options such as:
* Zoom levels and controls
* Compass
* ScaleBar
* Cluster Pin colors
* Location update settings
*/
private void setUpMapIfNeeded() {
// Check if we were successful in obtaining the map.
mMap.setBuiltInZoomControls(true);
mMap.setMultiTouchControls(true);
mMap.setMinZoomLevel(3);
mMap.setMaxZoomLevel(19); // Latest OSM can go to 21!
mMap.getTileProvider().createTileCache();
mCompassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), mMap);
ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(getActivity());
mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10);
mScaleBarOverlay.setCentred(true);
// Sets cluster pin color
mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(getActivity());
//BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange);
BitmapDrawable mapPinDrawable = (BitmapDrawable) ResourcesCompat.getDrawable(getResources(), R.drawable.ic_map_pin_orange, null);
mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap());
GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(getActivity().getBaseContext());
gpsMyLocationProvider.setLocationUpdateMinDistance(100); // [m] // Set the minimum distance for location updates
gpsMyLocationProvider.setLocationUpdateMinTime(10000); // [ms] // Set the minimum time interval for location updates
mMyLocationOverlay = new MyLocationNewOverlay(getActivity().getBaseContext(), gpsMyLocationProvider, mMap);
mMyLocationOverlay.setDrawAccuracyEnabled(true);
mMap.getOverlays().add(mCellTowerGridMarkerClusterer);
mMap.getOverlays().add(mMyLocationOverlay);
mMap.getOverlays().add(mCompassOverlay);
mMap.getOverlays().add(mScaleBarOverlay);
}
示例14: refreshLocationsOnMap
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
public void refreshLocationsOnMap(){
map.getOverlays().clear();
map.invalidate();
placeMarkers.clear();
allPlaces = Place.getAll();
for(Place place: allPlaces){
OverlayItem placeOverlayItem = new OverlayItem(
place.getAddress(), place.getDescription(), new GeoPoint(place.getLatitude(), place.getLongitude()));
Drawable myCurrentLocationMarker = this.getResources().getDrawable(R.drawable.marker_cloud);
placeOverlayItem.setMarker(myCurrentLocationMarker);
placeMarkers.add(placeOverlayItem);
}
// add my current location overlay
if(currentLocation != null){
OverlayItem myLocationOverlayItem = new OverlayItem("Here", "Current location",
new GeoPoint(currentLocation.getLatitude(), currentLocation.getLongitude()));
myLocationOverlayItem.setMarkerHotspot(OverlayItem.HotspotPlace.CENTER);
placeMarkers.add(myLocationOverlayItem);
}
ItemizedIconOverlay<OverlayItem> anotherItemizedIconOverlay
= new ItemizedIconOverlay<OverlayItem>(
getActivity(), placeMarkers, null);
map.getOverlays().add(anotherItemizedIconOverlay);
ScaleBarOverlay myScaleBarOverlay = new ScaleBarOverlay(map);
map.getOverlays().add(myScaleBarOverlay);
MyLocationNewOverlay mLocationOverlay = new MyLocationNewOverlay(new GpsMyLocationProvider(getActivity()), map);
map.getOverlays().add(mLocationOverlay);
CompassOverlay mCompassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), map);
map.getOverlays().add(mCompassOverlay);
/*RotationGestureOverlay mRotationGestureOverlay = new RotationGestureOverlay(getActivity(), map);
mRotationGestureOverlay.setEnabled(true);
map.setMultiTouchControls(true);
map.getOverlays().add(mRotationGestureOverlay);*/
setBoundingBox();
}
示例15: createMyLocationOverlay
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay; //导入依赖的package包/类
private void createMyLocationOverlay(List<Overlay> overlays) {
this.mLocationOverlay = new MyLocationNewOverlay(mMapView);
overlays.add(this.mLocationOverlay);
mLocationOverlay.enableMyLocation(); // could be made configurable through settings
}