@Override public void onLocationChanged(final AndNavLocation pLocation) { if (this.mMyLocationOverlay != null) { this.mMyLocationOverlay.setLocation(getLastKnownLocation(true)); } if (super.mOSMapView != null) { super.mOSMapView.invalidate(); } }
@Override protected void onRestoreInstanceState(final Bundle in) { final ArrayList<OSMMapViewOSBOverlayItem> items = in.getParcelableArrayList(STATE_BUGOVERLAYITEMS_ID); this.mBugOverlayItems.addAll(items); this.mBugOverlayItemsIndex = in.getInt(STATE_BUGOVERLAYITEMS_SELECTED_ID); super.mOSMapView.getController().setZoom(in.getInt(STATE_ZOOMLEVEL_ID)); final GeoPoint mapCenter = in.getParcelable(STATE_MAPCENTER_ID); if (mapCenter != null) { super.mOSMapView.getController().setCenter(mapCenter); } this.mAddOSMPOIType = in.getParcelable(STATE_ADDOSMPOITYPE_ID); super.mOSMapView.invalidate(); }
@Override protected void onSetupContentView() { this.setContentView(R.layout.osbmap); super.mOSMapView = (MapView) findViewById(R.id.map_osbmap); this.mIbtnCommentWrite = (ImageButton) this.findViewById(R.id.ibtn_osbmap_comment_write); this.mIbtnRefresh = (ImageButton) this.findViewById(R.id.ibtn_osbmap_refresh); this.mIbtnAdd = (ImageButton) this.findViewById(R.id.ibtn_osbmap_add); this.mIbtnAddCancel = (ImageButton) this.findViewById(R.id.ibtn_osbmap_add_cancel); this.mScaleIndicatorView = new ScaleBarOverlay(this); if (Preferences.getUnitSystem(this) == UnitSystem.IMPERIAL) { this.mScaleIndicatorView.setImperial(); } else { this.mScaleIndicatorView.setMetric(); } this.mScaleIndicatorView.setScaleBarOffset( getResources().getDisplayMetrics().widthPixels / 2 - getResources().getDisplayMetrics().xdpi / 2, 10); this.mIbtnCommentWrite.setEnabled(false); final OverlayManager overlaymanager = this.mOSMapView.getOverlayManager(); this.mOSBOverlay = new OSMMapViewOSBOverlay(this, this.mBugOverlayItems, this); this.mOSBOverlay.setFocusItemsOnTap(false); overlaymanager.add(this.mScaleIndicatorView); overlaymanager.add(this.mMyLocationOverlay = new SimpleLocationOverlay(this)); overlaymanager.add(this.mOSBOverlay); /* Add AddBugOverlay after OSBOverlay to give it a higher zOrder. */ overlaymanager.add( this.mAddBugCrosshairOverlay = new OSMMapViewCrosshairOverlay(this, Color.BLACK, 2, 17)); this.mAddBugCrosshairOverlay.setEnabled(false); super.mOSMapView.invalidate(); }