Search in sources :

Example 1 with GroundOverlayOptions

use of com.google.android.libraries.maps.model.GroundOverlayOptions in project android-samples by googlemaps.

the class GroundOverlayDemoActivity method onMapReady.

@Override
public void onMapReady(GoogleMap map) {
    // Register a listener to respond to clicks on GroundOverlays.
    map.setOnGroundOverlayClickListener(this);
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(NEWARK, 11));
    images.clear();
    images.add(BitmapDescriptorFactory.fromResource(R.drawable.newark_nj_1922));
    images.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.)
    groundOverlayRotated = map.addGroundOverlay(new GroundOverlayOptions().image(images.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.
    groundOverlay = map.addGroundOverlay(new GroundOverlayOptions().image(images.get(currentEntry)).anchor(0, 1).position(NEWARK, 8600f, 6500f));
    transparencyBar.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.");
}
Also used : GroundOverlayOptions(com.google.android.libraries.maps.model.GroundOverlayOptions)

Example 2 with GroundOverlayOptions

use of com.google.android.libraries.maps.model.GroundOverlayOptions in project android-samples by googlemaps.

the class TagsDemoActivity method addObjectsToMap.

private void addObjectsToMap() {
    // A circle centered on Adelaide.
    mAdelaideCircle = mMap.addCircle(new CircleOptions().center(ADELAIDE).radius(500000).fillColor(Color.argb(150, 66, 173, 244)).strokeColor(Color.rgb(66, 173, 244)).clickable(true));
    mAdelaideCircle.setTag(new CustomTag("Adelaide circle"));
    // A ground overlay at Sydney.
    mSydneyGroundOverlay = mMap.addGroundOverlay(new GroundOverlayOptions().image(BitmapDescriptorFactory.fromResource(R.drawable.harbour_bridge)).position(SYDNEY, 700000).clickable(true));
    mSydneyGroundOverlay.setTag(new CustomTag("Sydney ground overlay"));
    // A marker at Hobart.
    mHobartMarker = mMap.addMarker(new MarkerOptions().position(HOBART));
    mHobartMarker.setTag(new CustomTag("Hobart marker"));
    // A polygon centered at Darwin.
    mDarwinPolygon = mMap.addPolygon(new PolygonOptions().add(new LatLng(DARWIN.latitude + 3, DARWIN.longitude - 3), new LatLng(DARWIN.latitude + 3, DARWIN.longitude + 3), new LatLng(DARWIN.latitude - 3, DARWIN.longitude + 3), new LatLng(DARWIN.latitude - 3, DARWIN.longitude - 3)).fillColor(Color.argb(150, 34, 173, 24)).strokeColor(Color.rgb(34, 173, 24)).clickable(true));
    mDarwinPolygon.setTag(new CustomTag("Darwin polygon"));
    // A polyline from Perth to Brisbane.
    mPolyline = mMap.addPolyline(new PolylineOptions().add(PERTH, BRISBANE).color(Color.rgb(103, 24, 173)).width(30).clickable(true));
    mPolyline.setTag(new CustomTag("Perth to Brisbane polyline"));
}
Also used : MarkerOptions(com.google.android.libraries.maps.model.MarkerOptions) CircleOptions(com.google.android.libraries.maps.model.CircleOptions) GroundOverlayOptions(com.google.android.libraries.maps.model.GroundOverlayOptions) PolygonOptions(com.google.android.libraries.maps.model.PolygonOptions) LatLng(com.google.android.libraries.maps.model.LatLng) PolylineOptions(com.google.android.libraries.maps.model.PolylineOptions)

Aggregations

GroundOverlayOptions (com.google.android.libraries.maps.model.GroundOverlayOptions)2 CircleOptions (com.google.android.libraries.maps.model.CircleOptions)1 LatLng (com.google.android.libraries.maps.model.LatLng)1 MarkerOptions (com.google.android.libraries.maps.model.MarkerOptions)1 PolygonOptions (com.google.android.libraries.maps.model.PolygonOptions)1 PolylineOptions (com.google.android.libraries.maps.model.PolylineOptions)1