/** * Creates a new Ground Overlay * * @param imageUrl url of the ground overlay image * @param latLonBox bounds of the image * @param drawOrder z index of the image * @param visibility true if visible, false otherwise * @param properties properties hashmap * @param rotation rotation of image */ /* package */ KmlGroundOverlay(String imageUrl, LatLngBounds latLonBox, float drawOrder, int visibility, HashMap<String, String> properties, float rotation) { mGroundOverlayOptions = new GroundOverlayOptions(); mImageUrl = imageUrl; mProperties = properties; if (latLonBox == null) { throw new IllegalArgumentException("No LatLonBox given"); } mLatLngBox = latLonBox; mGroundOverlayOptions.positionFromBounds(latLonBox); mGroundOverlayOptions.bearing(rotation); mGroundOverlayOptions.zIndex(drawOrder); mGroundOverlayOptions.visible(visibility != 0); }
@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 GroundOverlayOptions bearing(float bearing) { real.bearing(bearing); return this; }
/** * Creates a new Ground Overlay * * @param imageUrl url of the ground overlay image * @param latLonBox bounds of the image * @param drawOrder z index of the image * @param visibility true if visible, false otherwise * @param properties properties hashmap * @param rotation rotation of image */ /* package */ KmlGroundOverlay(String imageUrl, LatLngBounds latLonBox, float drawOrder, int visibility, HashMap<String, String> properties, float rotation) { mGroundOverlayOptions = new GroundOverlayOptions(); mImageUrl = imageUrl; mProperties = properties; if (latLonBox == null) { throw new IllegalArgumentException("No LatLonBox given"); } mLatLngBox = latLonBox; mGroundOverlayOptions.positionFromBounds(latLonBox); mGroundOverlayOptions.bearing(rotation); mGroundOverlayOptions.zIndex(drawOrder); mGroundOverlayOptions.visible(visibility != 0); }
/** * 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); } }