001 package com.google.gwt.maps.client.weatherlib;
002
003 import com.google.gwt.core.client.JavaScriptObject;
004 import com.google.gwt.maps.client.MapImpl;
005 import com.google.gwt.maps.client.MapWidget;
006 import com.google.gwt.maps.client.mvc.MVCObject;
007
008 /**
009 * A layer showing current weather conditions. This class extends MVCObject. <br>
010 * <br>
011 * See <a href=
012 * "https://developers.google.com/maps/documentation/javascript/layers#WeatherLayer"
013 * >WeatherLayer API Doc</a>
014 */
015 public class WeatherLayer extends MVCObject<WeatherLayer> {
016
017 /**
018 * use newInstance();
019 */
020 protected WeatherLayer() {
021 }
022
023 /**
024 * A layer that displays graphics showing current weather conditions.
025 *
026 * @param options
027 * {@link WeatherLayerOptions} configuration for layer (units,
028 * style, behaviors)
029 * @return WeatherLayer object
030 */
031 public static final WeatherLayer newInstance(WeatherLayerOptions options) {
032 return createJso(options).cast();
033 }
034
035 private static final native JavaScriptObject createJso(
036 WeatherLayerOptions options) /*-{
037 return new $wnd.google.maps.weather.WeatherLayer(options);
038 }-*/;
039
040 public final void setMap(MapWidget mapWidget) {
041 if (mapWidget == null) {
042 setMapImpl(null);
043 } else {
044 setMapImpl(mapWidget.getJso());
045 }
046 }
047
048 private final native void setMapImpl(MapImpl map) /*-{
049 this.setMap(map);
050 }-*/;
051
052 public final MapWidget getMap() {
053 return MapWidget.newInstance(getMapImpl());
054 }
055
056 private final native MapImpl getMapImpl() /*-{
057 return this.getMap();
058 }-*/;
059
060 }