org.oscim.android.MapView Java Examples
The following examples show how to use
org.oscim.android.MapView.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MapActions.java From PocketMaps with MIT License | 6 votes |
/** * move map to my current location as the center of the screen */ protected void initShowMyLocation(final MapView mapView) { showPositionBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (MapActivity.getmCurrentLocation() != null) { showPositionBtn.setImageResource(R.drawable.ic_my_location_white_24dp); MapHandler.getMapHandler().centerPointOnMap( new GeoPoint(MapActivity.getmCurrentLocation().getLatitude(), MapActivity.getmCurrentLocation().getLongitude()), 0, 0, 0); // mapView.getModel().mapViewPosition.setMapPosition(new MapPosition( // new LatLong(MapActivity.getmCurrentLocation().getLatitude(), // MapActivity.getmCurrentLocation().getLongitude()), // mapView.getModel().mapViewPosition.getZoomLevel())); } else { showPositionBtn.setImageResource(R.drawable.ic_location_searching_white_24dp); Toast.makeText(activity, "No Location Available", Toast.LENGTH_SHORT).show(); } ((MapActivity)activity).ensureLocationListener(false); } }); }
Example #2
Source File: GlContextFactory.java From trekarta with GNU General Public License v3.0 | 6 votes |
@Override public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) { log.info("creating OpenGL ES " + MapView.OPENGL_VERSION + " context"); checkEglError("Before eglCreateContext " + MapView.OPENGL_VERSION, egl); int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, (int) MapView.OPENGL_VERSION, EGL10.EGL_NONE}; EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list); boolean success = checkEglError("After eglCreateContext " + MapView.OPENGL_VERSION, egl); if ((!success || context == null) && MapView.OPENGL_VERSION > 2) { log.warn("Falling back to GLES 2"); MapView.OPENGL_VERSION = 2.0; return createContext(egl, display, eglConfig); } log.info("Returning a GLES " + MapView.OPENGL_VERSION + " context"); return context; }
Example #3
Source File: MapActions.java From PocketMaps with MIT License | 5 votes |
void doZoom(MapView mapView, boolean doZoomIn) { MapPosition mvp = mapView.map().getMapPosition(); int i = mvp.getZoomLevel(); log("Zoom from " + mvp.getZoomLevel() + " scale=" + mvp.getScale()); if (doZoomIn) { mvp.setZoomLevel(++i); mvp.setScale(mvp.getScale() * 1.1); /* roundoff err */ } else { mvp.setZoomLevel(--i); } log("Zoom to " + mvp.getZoomLevel()); mapView.map().animator().animateTo(300, mvp); }
Example #4
Source File: MapActivity.java From PocketMaps with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); lastProvider = null; setContentView(R.layout.activity_map); locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); kalmanLocationManager = new KalmanLocationManager(this); kalmanLocationManager.setMaxPredictTime(10000); Variable.getVariable().setContext(getApplicationContext()); mapView = new MapView(this); mapView.setClickable(true); MapHandler.getMapHandler() .init(mapView, Variable.getVariable().getCountry(), Variable.getVariable().getMapsFolder()); try { MapHandler.getMapHandler().loadMap(new File(Variable.getVariable().getMapsFolder().getAbsolutePath(), Variable.getVariable().getCountry() + "-gh"), this); getIntent().putExtra("com.junjunguo.pocketmaps.activities.MapActivity.SELECTNEWMAP", false); } catch (Exception e) { logUser("Map file seems corrupt!\nPlease try to re-download."); log("Error while loading map!"); e.printStackTrace(); finish(); Intent intent = new Intent(this, MainActivity.class); intent.putExtra("com.junjunguo.pocketmaps.activities.MapActivity.SELECTNEWMAP", true); startActivity(intent); return; } customMapView(); checkGpsAvailability(); ensureLastLocationInit(); updateCurrentLocation(null); mapAlive = true; }
Example #5
Source File: BaseActivity.java From open with GNU General Public License v3.0 | 5 votes |
public MapView getMapView() { if (mapFragment == null || mapFragment.getView() == null) { return null; } return (MapView) mapFragment.getView().findViewById(R.id.map); }
Example #6
Source File: TestBaseActivity.java From open with GNU General Public License v3.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MapView mapView = Mockito.mock(MapView.class); Mockito.when(mapView.map()).thenReturn(new TestMap()); actionBar.show(); }
Example #7
Source File: MapHandler.java From PocketMaps with MIT License | 4 votes |
public void init(MapView mapView, String currentArea, File mapsFolder) { this.mapView = mapView; this.currentArea = currentArea; this.mapsFolder = mapsFolder; // path/to/map/area-gh/ }
Example #8
Source File: MapActions.java From PocketMaps with MIT License | 4 votes |
public MapActions(Activity activity, MapView mapView) { this.activity = activity; this.showPositionBtn = (FloatingActionButton) activity.findViewById(R.id.map_show_my_position_fab); this.navigationBtn = (FloatingActionButton) activity.findViewById(R.id.map_nav_fab); this.settingsBtn = (FloatingActionButton) activity.findViewById(R.id.map_southbar_settings_fab); this.settingsSetBtn = (FloatingActionButton) activity.findViewById(R.id.map_southbar_sett_sett_fab); this.settingsNavBtn = (FloatingActionButton) activity.findViewById(R.id.map_southbar_sett_nav_fab); this.favourBtn = (FloatingActionButton) activity.findViewById(R.id.map_southbar_favour_fab); this.controlBtn = (FloatingActionButton) activity.findViewById(R.id.map_sidebar_control_fab); this.zoomInBtn = (FloatingActionButton) activity.findViewById(R.id.map_zoom_in_fab); this.zoomOutBtn = (FloatingActionButton) activity.findViewById(R.id.map_zoom_out_fab); this.naviCenterBtn = (FloatingActionButton) activity.findViewById(R.id.map_southbar_navicenter_fab); // view groups managed by separate layout xml file : //map_sidebar_layout/map_sidebar_menu_layout this.sideBarVP = (ViewGroup) activity.findViewById(R.id.map_sidebar_layout); this.sideBarMenuVP = (ViewGroup) activity.findViewById(R.id.map_sidebar_menu_layout); this.southBarSettVP = (ViewGroup) activity.findViewById(R.id.map_southbar_sett_layout); this.southBarFavourVP = (ViewGroup) activity.findViewById(R.id.map_southbar_favour_layout); this.navSettingsVP = (ViewGroup) activity.findViewById(R.id.nav_settings_layout); this.navTopVP = (ViewGroup) activity.findViewById(R.id.navtop_layout); this.navSettingsFromVP = (ViewGroup) activity.findViewById(R.id.nav_settings_from_layout); this.navSettingsToVP = (ViewGroup) activity.findViewById(R.id.nav_settings_to_layout); this.navInstructionListVP = (ViewGroup) activity.findViewById(R.id.nav_instruction_list_layout); //form location and to location textView this.fromLocalET = (TextView) activity.findViewById(R.id.nav_settings_from_local_et); this.toLocalET = (TextView) activity.findViewById(R.id.nav_settings_to_local_et); this.menuVisible = false; MapHandler.getMapHandler().setMapHandlerListener(this); MapHandler.getMapHandler().setNaviCenterBtn(naviCenterBtn); Navigator.getNavigator().addListener(this); appSettings = new AppSettings(activity); naviCenterBtn.setOnClickListener(createNaviCenterListener()); initControlBtnHandler(); initZoomControlHandler(mapView); initShowMyLocation(mapView); mapView.map().events.bind(createUpdateListener()); initNavBtnHandler(); initNavSettingsHandler(); initSettingsBtnHandler(); initFavourBtnHandler(); mapView.map().getEventLayer().enableRotation(false); mapView.map().getEventLayer().enableTilt(false); }
Example #9
Source File: TestMap.java From open with GNU General Public License v3.0 | 4 votes |
public TestMap() { super(new MapView(Robolectric.application)); this.viewport = new TestViewport(); mapAnimator = new Animator(this); }
Example #10
Source File: GPMap.java From geopaparazzi with GNU General Public License v3.0 | 4 votes |
public GPMap(MapView mapView) { map = mapView.map(); }