Search in sources :

Example 6 with MyLocationNewOverlay

use of org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay in project Android-IMSI-Catcher-Detector by CellularPrivacy.

the class MapFragment method setUpMapIfNeeded.

/**
 * 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);
    // Latest OSM can go to 21!
    mMap.setMaxZoomLevel(19);
    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());
    // [m]  // Set the minimum distance for location updates
    gpsMyLocationProvider.setLocationUpdateMinDistance(100);
    // [ms] // Set the minimum time interval for location updates
    gpsMyLocationProvider.setLocationUpdateMinTime(10000);
    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);
}
Also used : CellTowerGridMarkerClusterer(com.secupwn.aimsicd.map.CellTowerGridMarkerClusterer) GpsMyLocationProvider(org.osmdroid.views.overlay.mylocation.GpsMyLocationProvider) MyLocationNewOverlay(org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay) BitmapDrawable(android.graphics.drawable.BitmapDrawable) CompassOverlay(org.osmdroid.views.overlay.compass.CompassOverlay) ScaleBarOverlay(org.osmdroid.views.overlay.ScaleBarOverlay) InternalCompassOrientationProvider(org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider)

Example 7 with MyLocationNewOverlay

use of org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay in project Android-IMSI-Catcher-Detector by CellularPrivacy.

the class MapViewerOsmDroid method setUpMapIfNeeded.

/**
 * 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);
    // Latest OSM can go to 21!
    mMap.setMaxZoomLevel(19);
    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());
    // [m]  // Set the minimum distance for location updates
    gpsMyLocationProvider.setLocationUpdateMinDistance(100);
    // [ms] // Set the minimum time interval for location updates
    gpsMyLocationProvider.setLocationUpdateMinTime(10000);
    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);
}
Also used : CellTowerGridMarkerClusterer(com.secupwn.aimsicd.map.CellTowerGridMarkerClusterer) GpsMyLocationProvider(org.osmdroid.views.overlay.mylocation.GpsMyLocationProvider) MyLocationNewOverlay(org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay) BitmapDrawable(android.graphics.drawable.BitmapDrawable) CompassOverlay(org.osmdroid.views.overlay.compass.CompassOverlay) ScaleBarOverlay(org.osmdroid.views.overlay.ScaleBarOverlay) InternalCompassOrientationProvider(org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider)

Aggregations

MyLocationNewOverlay (org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay)7 View (android.view.View)5 MapView (org.osmdroid.views.MapView)5 GpsMyLocationProvider (org.osmdroid.views.overlay.mylocation.GpsMyLocationProvider)4 Intent (android.content.Intent)3 BitmapDrawable (android.graphics.drawable.BitmapDrawable)3 ImageButton (android.widget.ImageButton)3 MapHelper (org.odk.collect.android.spatial.MapHelper)3 GeoPoint (org.osmdroid.util.GeoPoint)3 Bitmap (android.graphics.Bitmap)2 Handler (android.os.Handler)2 CellTowerGridMarkerClusterer (com.secupwn.aimsicd.map.CellTowerGridMarkerClusterer)2 ScaleBarOverlay (org.osmdroid.views.overlay.ScaleBarOverlay)2 CompassOverlay (org.osmdroid.views.overlay.compass.CompassOverlay)2 InternalCompassOrientationProvider (org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider)2 SharedPreferences (android.content.SharedPreferences)1 Drawable (android.graphics.drawable.Drawable)1 Location (android.location.Location)1 LocationManager (android.location.LocationManager)1 Button (android.widget.Button)1