Example usage for com.google.gwt.maps.client.event EarthInstanceHandler EarthInstanceHandler

List of usage examples for com.google.gwt.maps.client.event EarthInstanceHandler EarthInstanceHandler

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.event EarthInstanceHandler EarthInstanceHandler.

Prototype

EarthInstanceHandler

Source Link

Usage

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

License:Apache License

public EarthPluginDemo() {
    Panel panel = new FlowPanel();
    map = new MapWidget(LatLng.newInstance(37.42317, -122.08364), 16);
    map.setSize("500px", "500px");
    map.addControl(new SmallMapControl());
    map.addMapType(MapType.getEarthMap());
    map.setCurrentMapType(MapType.getEarthMap());
    panel.add(map);// ww  w .j  a v  a 2 s. c o  m
    initWidget(panel);
    map.getEarthInstance(new EarthInstanceHandler() {

        public void onEarthInstance(EarthInstanceEvent event) {
            final JavaScriptObject earth = event.getEarthInstance();
            if (earth == null) {
                Window.alert("Failed to init earth plugin");
            } else {
                /*
                 * Create a marker. The timer is set to give the earth plugin a chance
                 * to position to the proper point on the map.
                 */
                new Timer() {

                    @Override
                    public void run() {
                        createPlacemark(earth);
                    }
                }.schedule(1000);
            }
        }
    });
}