Example usage for com.google.gwt.maps.client.overlay Icon setShadowURL

List of usage examples for com.google.gwt.maps.client.overlay Icon setShadowURL

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.overlay Icon setShadowURL.

Prototype

public final native void setShadowURL(String url) ;

Source Link

Document

Sets the shadow image URL of the icon.

Usage

From source file:com.google.gwt.maps.sample.hellomaps.client.IconDemo.java

License:Apache License

@Override
public void onShow() {
    map.clearOverlays();/*from   w w  w  .  j a v a 2  s . co m*/

    // Create our "tiny" marker icon
    Icon icon = Icon.newInstance("http://labs.google.com/ridefinder/images/mm_20_red.png");
    icon.setShadowURL("http://labs.google.com/ridefinder/images/mm_20_shadow.png");
    icon.setIconSize(Size.newInstance(12, 20));
    icon.setShadowSize(Size.newInstance(22, 20));
    icon.setIconAnchor(Point.newInstance(6, 20));
    icon.setInfoWindowAnchor(Point.newInstance(5, 1));

    // Add 10 markers to the map at random locations
    LatLngBounds bounds = map.getBounds();
    LatLng southWest = bounds.getSouthWest();
    LatLng northEast = bounds.getNorthEast();
    double lngSpan = northEast.getLongitude() - southWest.getLongitude();
    double latSpan = northEast.getLatitude() - southWest.getLatitude();
    MarkerOptions options = MarkerOptions.newInstance();
    options.setIcon(icon);
    for (int i = 0; i < 10; i++) {
        LatLng point = LatLng.newInstance(southWest.getLatitude() + latSpan * Math.random(),
                southWest.getLongitude() + lngSpan * Math.random());

        map.addOverlay(new Marker(point, options));
    }
}