List of usage examples for com.google.gwt.maps.client.overlay GroundOverlay GroundOverlay
public GroundOverlay(String imageUrl, LatLngBounds bounds)
From source file:com.google.gwt.maps.sample.hellomaps.client.GroundOverlayDemo.java
License:Apache License
@Override public void onShow() { // The map's bounds are meaningless until the map has been added to the DOM // and sized appropriately if (firstTime) { firstTime = false;/* www . j ava 2 s .c o m*/ LatLngBounds bounds = map.getBounds(); LatLng southWest = bounds.getSouthWest(); LatLng northEast = bounds.getNorthEast(); double lngDelta = (northEast.getLongitude() - southWest.getLongitude()) / 4; double latDelta = (northEast.getLatitude() - southWest.getLatitude()) / 4; // generate bounds that covers center map with half the width and height LatLngBounds rectBounds = LatLngBounds.newInstance( LatLng.newInstance(southWest.getLatitude() + latDelta, southWest.getLongitude() + lngDelta), LatLng.newInstance(northEast.getLatitude() - latDelta, northEast.getLongitude() - lngDelta)); groundOverlay = new GroundOverlay("boot.jpg", rectBounds); groundOverlay.addGroundOverlayVisibilityChangedHandler(new GroundOverlayVisibilityChangedHandler() { public void onVisibilityChanged(GroundOverlayVisibilityChangedEvent event) { if (event.isVisible()) { hideButton.setText("Hide Overlay"); } else { hideButton.setText("Show Overlay"); } } }); map.addOverlay(groundOverlay); } }