Example usage for com.google.gwt.maps.client MapType getEarthMap

List of usage examples for com.google.gwt.maps.client MapType getEarthMap

Introduction

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

Prototype

public static MapType getEarthMap() 

Source Link

Document

Returns a map type that shows Google Earth using the browser plugin.

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);/*w  w  w .  ja v  a2 s. c  om*/
    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);
            }
        }
    });
}

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

License:Apache License

public MapTypeDemo() {

    VerticalPanel vertPanel = new VerticalPanel();
    vertPanel.setStyleName("hm-panel");

    map = new MapWidget(LatLng.newInstance(37.4419, -122.1419), 13);
    map.setSize("500px", "500px");

    // Add in all the map types we know about.
    for (MapType mt : MapType.getDefaultMapTypes()) {
        map.addMapType(mt);//from  w  w  w . j a va  2s . c  o m
    }
    map.addMapType(MapType.getPhysicalMap());
    map.addMapType(MapType.getEarthMap());

    for (MapType mt : MapType.getMoonMapTypes()) {
        map.addMapType(mt);
    }

    for (MapType mt : MapType.getMarsMapTypes()) {
        map.addMapType(mt);
    }

    for (MapType mt : MapType.getSkyMapTypes()) {
        map.addMapType(mt);
    }

    map.addControl(new DemoCustomMapTypeControl());
    map.addControl(new LargeMapControl());
    vertPanel.add(map);

    initWidget(vertPanel);
}