Example usage for com.google.gwt.maps.client MapTypeId SATELLITE

List of usage examples for com.google.gwt.maps.client MapTypeId SATELLITE

Introduction

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

Prototype

MapTypeId SATELLITE

To view the source code for com.google.gwt.maps.client MapTypeId SATELLITE.

Click Source Link

Document

This map type displays satellite images.

Usage

From source file:com.google.gwt.maps.testing.client.maps.ImageMapTypeWidget.java

License:Apache License

private void drawMap() {

    // make custom maps
    ImageMapType moonType = getMoonMapType();
    ImageMapType marsType = getMarsMapType();

    // draw map//from w w w  .  j a  v  a  2  s .c o  m
    MapTypeControlOptions controlOpts = MapTypeControlOptions.newInstance();
    //TODO How it make it label as "Earth" not "Satellite" without redefining that standard map type?
    controlOpts.setMapTypeIds(new String[] { LUNAR_NAME, MARTIAN_NAME, MapTypeId.SATELLITE.toString() });

    MapOptions opts = MapOptions.newInstance();
    opts.setCenter(LatLng.newInstance(-12d, -70d));
    opts.setZoom(7);
    opts.setMapTypeControlOptions(controlOpts);
    opts.setStreetViewControl(false);

    mapWidget = new MapWidget(opts);
    mapWidget.setSize("750px", "500px");

    // add to map
    mapWidget.getMapTypeRegistry().set(MARTIAN_NAME, marsType);
    mapWidget.getMapTypeRegistry().set(LUNAR_NAME, moonType);
    mapWidget.setMapTypeId(MARTIAN_NAME);

    pWidget.add(mapWidget);
}

From source file:com.google.gwt.maps.testing.client.maps.WeatherLayersWidget.java

License:Apache License

private void drawMap() {
    // zoom out for the clouds
    LatLng center = LatLng.newInstance(47.11, -4.91);
    MapOptions opts = MapOptions.newInstance();
    opts.setZoom(3);/*from   ww  w.  j  a  va  2  s.c  o m*/
    opts.setCenter(center);
    opts.setMapTypeId(MapTypeId.SATELLITE);

    mapWidget = new MapWidget(opts);
    pWidget.add(mapWidget);
    mapWidget.setSize("750px", "500px");

    // add weather conditions layer
    WeatherLayerOptions options2 = WeatherLayerOptions.newInstance();
    options2.setTemperatureUnits(TemperatureUnit.FAHRENHEIT);
    options2.setWindSpeedUnits(WindSpeedUnit.MILES_PER_HOUR);
    options2.setLabelColor(LabelColor.BLACK);

    WeatherLayerOptions options = WeatherLayerOptions.newInstance();
    options.setTemperatureUnits(TemperatureUnit.FAHRENHEIT);
    options.setWindSpeedUnits(WindSpeedUnit.MILES_PER_HOUR);
    options.setLabelColor(LabelColor.BLACK);

    weatherLayer = WeatherLayer.newInstance(options);
    weatherLayer.setMap(mapWidget);

    // apply clouds
    cloudLayer = CloudLayer.newInstance();
    cloudLayer.setMap(mapWidget);

    // add custom handler for clicks on weather markers
    // NOTE: this is just being cat'd to the console as an
    // example of the information you get from the event
    weatherLayer.addClickHandler(new WeatherMouseMapHandler() {

        @Override
        public void onEvent(WeatherMouseMapEvent event) {
            ConsoleLog(event.getPixelOffset().getHeight());
            ConsoleLog(event.getLatLng().getLatitude());
            ConsoleLog(event.getInfoWindowHtml());
            ConsoleLog(event.getFeatureDetails().getCurrent());
            ConsoleLog(event.getFeatureDetails().getForecast().get(0));
            ConsoleLog(event.getFeatureDetails().getLocation());
            ConsoleLog(event.getFeatureDetails().getTemperatureUnits().value());
            ConsoleLog(event.getFeatureDetails().getWindSpeedUnits().value());

            // ideally you'd intercept the propagation of the event her so you could
            // display your own custom popup, not the default one
        }
    });

}

From source file:org.rebioma.client.MapView.java

License:Apache License

public void setVisible(boolean visible) {
    if (map.getMapTypeId() == MapTypeId.SATELLITE) {
        map.setVisible(visible);// w  w  w .j  a v a2s .  co  m
    } else {
        map.setVisible(true);
    }
}

From source file:org.rebioma.client.MapView.java

License:Apache License

public void switchBack() {
    if (switched) {
        map.setMapTypeId(MapTypeId.SATELLITE);
    }
    switched = false;
}

From source file:org.rebioma.client.MapView.java

License:Apache License

public boolean temperalySwitchMapType() {
    switched = true;/*from  ww  w  . j av  a  2  s . c o m*/
    //    boolean swit = map.getCurrentMapType() == MapType.getEarthMap();
    boolean swit = map.getMapTypeId() == MapTypeId.SATELLITE;
    if (swit) {
        map.setMapTypeId(DEFAULT_MAP_TYPE);
    }
    return switched = swit;
}

From source file:org.rebioma.client.MapView.java

License:Apache License

private void initMap() {
    MapOptions mapOptions = MapOptions.newInstance();
    mapOptions.setCenter(HistoryState.DEFAULT_CENTER);
    mapOptions.setZoom(DEFAULT_ZOOM);//w ww  .  ja  va 2  s. c o m
    mapOptions.setDraggableCursor("crosshair");
    mapOptions.setDraggingCursor("move");
    mapOptions.setMapTypeId(DEFAULT_MAP_TYPE);
    mapOptions.setScaleControl(true);
    MapTypeControlOptions mapTypeControlOptions = MapTypeControlOptions.newInstance();
    mapTypeControlOptions.setMapTypeIds(MapTypeId.values());
    mapTypesMap.put(MapTypeId.TERRAIN.toString(), MapTypeId.TERRAIN);
    mapTypesMap.put(MapTypeId.ROADMAP.toString(), MapTypeId.ROADMAP);
    mapTypesMap.put(MapTypeId.SATELLITE.toString(), MapTypeId.SATELLITE);
    mapOptions.setMapTypeControlOptions(mapTypeControlOptions);
    mapOptions.setMapTypeControl(true);
    map = new MapWidget(mapOptions);
    map.setWidth("100%");
    map.setHeight("100%");
    final MapView mapView = this;
    // map.addControl(getModelControl());
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            HideControl hideControl = new HideControl();
            map.setControls(ControlPosition.TOP_RIGHT, hideControl);
            controlsGroup.setMap(map, ControlPosition.RIGHT_TOP);
            //          map.setControls(ControlPosition.TOP_RIGHT, geocoder);
            /*ScaleControl scaleControl = new ScaleControl();
            LargeMapControl largeMapControl = new LargeMapControl();
            MenuMapTypeControl mapTypeControl = new MenuMapTypeControl();
                    
            map.addControl(scaleControl);
            map.addControl(largeMapControl);
            map.addControl(mapTypeControl);
                    
            ControlPosition hideControlPosition = new ControlPosition(
               ControlAnchor.TOP_RIGHT, 100, 10);*/
            //           envLayerSelector.setMap(map, ControlPosition.TOP_RIGHT);
            hideControl.addControlWidgetToHide(geocoder);
            hideControl.addControlWidgetToHide(envLayerSelector);

            CoordinatesControl coordinatesControl = new CoordinatesControl(map);

            MapDrawingControl mapDrawingControl = new MapDrawingControl(map, ControlPosition.TOP_CENTER);
            mapDrawingControl.addListener(mapView);
            ClearMapDrawingControl clearMapDrawingControl = new ClearMapDrawingControl(mapDrawingControl);
            map.setControls(ControlPosition.TOP_LEFT, clearMapDrawingControl);
        }
    });
    map.addClickHandler(mapClickHandler);
    map.addZoomChangeHandler(mapZoomHandler);
    map.addMapTypeIdChangeHandler(mapTypeHandler);
    //    map.checkResizeAndCenter();
}