private CameraUpdate zoomToLastKnownLatLng() { return CameraUpdateFactory.newLatLngZoom(getLastKnownLatLng(), ZOOM_LEVEL); }
@Override public void setCenterZoom(LatLng latLng, int zoom) { googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, zoom)); }
@Override public void animateCenterZoom(LatLng latLng, int zoom) { googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, zoom)); }
@Override public void setZoom(int zoom) { googleMap.animateCamera( CameraUpdateFactory.newLatLngZoom(googleMap.getCameraPosition().target, zoom)); }
@Override protected void startDemo() { DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(51.503186, -0.126446), 10)); mClusterManager = new ClusterManager<MyItem>(this, getMap()); mClusterManager.setAlgorithm(new NonHierarchicalViewBasedAlgorithm<MyItem>( metrics.widthPixels, metrics.heightPixels)); getMap().setOnCameraIdleListener(mClusterManager); try { readItems(); } catch (JSONException e) { Toast.makeText(this, "Problem reading list of markers.", Toast.LENGTH_LONG).show(); } }
@Override protected void startDemo() { getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(51.503186, -0.126446), 10)); mClusterManager = new ClusterManager<MyItem>(this, getMap()); getMap().setOnCameraIdleListener(mClusterManager); try { readItems(); } catch (JSONException e) { Toast.makeText(this, "Problem reading list of markers.", Toast.LENGTH_LONG).show(); } }
@Override protected void startDemo() { getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(51.503186, -0.126446), 10)); mClusterManager = new ClusterManager<MyItem>(this, getMap()); getMap().setOnCameraIdleListener(mClusterManager); try { readItems(); } catch (JSONException e) { Toast.makeText(this, "Problem reading list of markers.", Toast.LENGTH_LONG).show(); } }
@Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; // Add a marker in Sydney and move the camera mMap.addMarker(new MarkerOptions().position(sydney).title("last online:"+ LastDateOnline)); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney,15)); }
@Override protected void startDemo() { getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(-25, 143), 4)); // Set up the spinner/dropdown list Spinner spinner = (Spinner) findViewById(R.id.spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.heatmaps_datasets_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(new SpinnerActivity()); try { mLists.put(getString(R.string.police_stations), new DataSet(readItems(R.raw.police), getString(R.string.police_stations_url))); mLists.put(getString(R.string.medicare), new DataSet(readItems(R.raw.medicare), getString(R.string.medicare_url))); } catch (JSONException e) { Toast.makeText(this, "Problem reading list of markers.", Toast.LENGTH_LONG).show(); } // Make the handler deal with the map // Input: list of WeightedLatLngs, minimum and maximum zoom levels to calculate custom // intensity from, and the map to draw the heatmap on // radius, gradient and opacity not specified, so default are used }
@Override protected void startDemo() { List<LatLng> decodedPath = PolyUtil.decode(LINE); getMap().addPolyline(new PolylineOptions().addAll(decodedPath)); getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(-33.8256, 151.2395), 12)); } }
private void setUpMap() { if (mMap == null) { mMap = getMap(); if (mMap != null) { mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(SYDNEY, 11)); // Add a circle around Sydney to roughly encompass the results mMap.addCircle(new CircleOptions() .center(SYDNEY) .radius(SEARCH_RADIUS * 1.2) .strokeColor(Color.RED) .strokeWidth(4)); } } }
@Override protected void startDemo() { mTextView = (TextView) findViewById(R.id.textView); getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(-33.8256, 151.2395), 10)); getMap().setOnMarkerDragListener(this); mMarkerA = getMap().addMarker(new MarkerOptions().position(new LatLng(-33.9046, 151.155)).draggable(true)); mMarkerB = getMap().addMarker(new MarkerOptions().position(new LatLng(-33.8291, 151.248)).draggable(true)); mPolyline = getMap().addPolyline(new PolylineOptions().geodesic(true)); Toast.makeText(this, "Drag the markers!", Toast.LENGTH_LONG).show(); showDistance(); }
/** * Move the camera to center on Darwin. */ public void showDarwin(View v) { // Wait until map is ready if (mMap == null) { return; } // Center camera on Adelaide marker mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(DARWIN, 10f)); }
/** * Move the camera to center on Adelaide. */ public void showAdelaide(View v) { // Wait until map is ready if (mMap == null) { return; } // Center camera on Adelaide marker mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ADELAIDE, 10f)); }
@Override protected void startDemo() { getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(51.503186, -0.126446), 9.5f)); mClusterManager = new ClusterManager<Person>(this, getMap()); mClusterManager.setRenderer(new PersonRenderer()); getMap().setOnCameraIdleListener(mClusterManager); getMap().setOnMarkerClickListener(mClusterManager); getMap().setOnInfoWindowClickListener(mClusterManager); mClusterManager.setOnClusterClickListener(this); mClusterManager.setOnClusterInfoWindowClickListener(this); mClusterManager.setOnClusterItemClickListener(this); mClusterManager.setOnClusterItemInfoWindowClickListener(this); addItems(); mClusterManager.cluster(); }
.color(Color.BLACK)); getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(28.05870, -82.4090), 15));
public void moveToOperaHouse(View view) { if (!checkReady()) { return; } mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(SOH, 16)); }
public void moveToSFO(View view) { if (!checkReady()) { return; } mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(SFO, 18)); }
@Override public void onMapReady(GoogleMap map) { mMap = map; mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(37.614631, -122.385153), 18)); }
@Override protected void startDemo() { getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(-33.8696, 151.2094), 10)); IconGenerator iconFactory = new IconGenerator(this); addIcon(iconFactory, "Default", new LatLng(-33.8696, 151.2094)); iconFactory.setColor(Color.CYAN); addIcon(iconFactory, "Custom color", new LatLng(-33.9360, 151.2070)); iconFactory.setRotation(90); iconFactory.setStyle(IconGenerator.STYLE_RED); addIcon(iconFactory, "Rotated 90 degrees", new LatLng(-33.8858, 151.096)); iconFactory.setContentRotation(-90); iconFactory.setStyle(IconGenerator.STYLE_PURPLE); addIcon(iconFactory, "Rotate=90, ContentRotate=-90", new LatLng(-33.9992, 151.098)); iconFactory.setRotation(0); iconFactory.setContentRotation(90); iconFactory.setStyle(IconGenerator.STYLE_GREEN); addIcon(iconFactory, "ContentRotate=90", new LatLng(-33.7677, 151.244)); iconFactory.setRotation(0); iconFactory.setContentRotation(0); iconFactory.setStyle(IconGenerator.STYLE_ORANGE); addIcon(iconFactory, makeCharSequence(), new LatLng(-33.77720, 151.12412)); }