/** * Adds a ground overlay to the map * * @param groundOverlayOptions GroundOverlay style options to be added to the map * @return new GroundOverlay object created from the given GroundOverlayOptions */ public GroundOverlay attachGroundOverlay(GroundOverlayOptions groundOverlayOptions) { return mMap.addGroundOverlay(groundOverlayOptions); }
@Override public void onMapReady(GoogleMap map) { // Register a listener to respond to clicks on GroundOverlays. map.setOnGroundOverlayClickListener(this); map.moveCamera(CameraUpdateFactory.newLatLngZoom(NEWARK, 11)); mImages.clear(); mImages.add(BitmapDescriptorFactory.fromResource(R.drawable.newark_nj_1922)); mImages.add(BitmapDescriptorFactory.fromResource(R.drawable.newark_prudential_sunny)); // Add a small, rotated overlay that is clickable by default // (set by the initial state of the checkbox.) mGroundOverlayRotated = map.addGroundOverlay(new GroundOverlayOptions() .image(mImages.get(1)).anchor(0, 1) .position(NEAR_NEWARK, 4300f, 3025f) .bearing(30) .clickable(((CheckBox) findViewById(R.id.toggleClickability)).isChecked())); // Add a large overlay at Newark on top of the smaller overlay. mGroundOverlay = map.addGroundOverlay(new GroundOverlayOptions() .image(mImages.get(mCurrentEntry)).anchor(0, 1) .position(NEWARK, 8600f, 6500f)); mTransparencyBar.setOnSeekBarChangeListener(this); // Override the default content description on the view, for accessibility mode. // Ideally this string would be localised. map.setContentDescription("Google Map with ground overlay."); }
public void addOverlay(LatLng place) { GroundOverlay groundOverlay = mMap.addGroundOverlay(new GroundOverlayOptions() .position(place, 100) .transparency(0.5f) .zIndex(3) .image(BitmapDescriptorFactory.fromBitmap(drawableToBitmap(getDrawable(R.drawable.map_overlay))))); startOverlayAnimation(groundOverlay); }
@Override public final GroundOverlay addGroundOverlay(GroundOverlayOptions options) { return map.addGroundOverlay(options); }
mSydneyGroundOverlay = mMap.addGroundOverlay(new GroundOverlayOptions() .image(BitmapDescriptorFactory.fromResource(R.drawable.harbour_bridge)) .position(SYDNEY, 700000)
/** * Adds ground overlays from a given URL onto the map * * @param groundOverlayUrl url of ground overlay * @param groundOverlays hashmap of ground overlays to add to the map */ private void addGroundOverlayToMap(String groundOverlayUrl, HashMap<KmlGroundOverlay, GroundOverlay> groundOverlays, boolean containerVisibility) { BitmapDescriptor groundOverlayBitmap = BitmapDescriptorFactory .fromBitmap(mImagesCache.get(groundOverlayUrl)); for (KmlGroundOverlay kmlGroundOverlay : groundOverlays.keySet()) { if (kmlGroundOverlay.getImageUrl().equals(groundOverlayUrl)) { GroundOverlayOptions groundOverlayOptions = kmlGroundOverlay.getGroundOverlayOptions() .image(groundOverlayBitmap); GroundOverlay mapGroundOverlay = mMap.addGroundOverlay(groundOverlayOptions); if (containerVisibility == false) { mapGroundOverlay.setVisible(false); } groundOverlays.put(kmlGroundOverlay, mapGroundOverlay); } } }
public void addOverlay(LatLng place) { GroundOverlay groundOverlay = mMap.addGroundOverlay(new GroundOverlayOptions() .position(place, 100) .transparency(0.5f) .zIndex(3) .image(BitmapDescriptorFactory.fromBitmap(drawableToBitmap(getActivity().getResources().getDrawable(R.drawable.map_overlay))))); startOverlayAnimation(groundOverlay); }
/** * Sets bitmap of floor plan as ground overlay on Google Maps */ private void setupGroundOverlay(IAFloorPlan floorPlan, Bitmap bitmap) { if (mGroundOverlay != null) { mGroundOverlay.remove(); } if (mMap != null) { BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap); IALatLng iaLatLng = floorPlan.getCenter(); LatLng center = new LatLng(iaLatLng.latitude, iaLatLng.longitude); GroundOverlayOptions fpOverlay = new GroundOverlayOptions() .image(bitmapDescriptor) .zIndex(0.0f) .position(center, floorPlan.getWidthMeters(), floorPlan.getHeightMeters()) .bearing(floorPlan.getBearing()); mGroundOverlay = mMap.addGroundOverlay(fpOverlay); } }
/** * Sets bitmap of floor plan as ground overlay on Google Maps */ private void setupGroundOverlay(IAFloorPlan floorPlan, Bitmap bitmap) { if (mGroundOverlay != null) { mGroundOverlay.remove(); } if (mMap != null) { BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap); IALatLng iaLatLng = floorPlan.getCenter(); LatLng center = new LatLng(iaLatLng.latitude, iaLatLng.longitude); GroundOverlayOptions fpOverlay = new GroundOverlayOptions() .image(bitmapDescriptor) .zIndex(0.0f) .position(center, floorPlan.getWidthMeters(), floorPlan.getHeightMeters()) .bearing(floorPlan.getBearing()); mGroundOverlay = mMap.addGroundOverlay(fpOverlay); } }
/** * Triggered when the map is ready to be used. * * @param googleMap The GoogleMap object representing the Google Map. */ @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; // Pan the camera to your home address (in this case, Google HQ). LatLng home = new LatLng(37.421982, -122.085109); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(home, INITIAL_ZOOM)); // Add a ground overlay 100 meters in width to the home location. GroundOverlayOptions homeOverlay = new GroundOverlayOptions() .image(BitmapDescriptorFactory.fromResource(R.drawable.android)) .position(home, 100); mMap.addGroundOverlay(homeOverlay); setMapLongClick(mMap); // Set a long click listener for the map; setPoiClick(mMap); // Set a click listener for points of interest. setMapStyle(mMap); // Set the custom map style. enableMyLocation(mMap); // Enable location tracking. // Enable going into StreetView by clicking on an InfoWindow from a // point of interest. setInfoWindowClickToPanorama(mMap); }