package org.gisandchips.gwt.maps.wms.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.maps.client.MapType; import com.google.gwt.maps.client.MapUIOptions; import com.google.gwt.maps.client.MapWidget; import com.google.gwt.maps.client.TileLayer; import com.google.gwt.maps.client.geom.LatLng; import com.google.gwt.maps.client.geom.MercatorProjection; import com.google.gwt.maps.client.geom.Projection; import com.google.gwt.maps.client.geom.Size; import com.google.gwt.user.client.ui.RootPanel; /** * Entry point classes define onModuleLoad(). */ public class GoogleMaps_WMS implements EntryPoint { private MapWidget map; private String wmsURL = "http://wms.jpl.nasa.gov/wms.cgi"; private String wmsLayers = "global_mosaic_base"; private String wmsStyles = "pseudo"; private String mapName = "Nasa"; /** * This is the entry point method. */ public void onModuleLoad() { //Coordenadas centrales para posicionar el mapa LatLng latLonCenter = LatLng.newInstance(0,0); //Creamos el mapa con un tamaño fijo map = new MapWidget(latLonCenter, 2); map.setSize("520px", "520px"); Projection projection = new MercatorProjection(20); //Creamos el servicio WMS que nutrirá a GoogleMaps MapType myWMSMap = new MapType(new TileLayer[] { new WMSTileLayer(wmsURL, wmsLayers, wmsStyles, projection)}, projection, mapName); //Añadimos el servicio WMS al mapa map.addMapType(myWMSMap); //Añadimos algunas opciones al mapa MapUIOptions options = MapUIOptions.newInstance(Size.newInstance(400,400)); options.setMapTypeControl(true); map.setUI(options); // Add the map to the HTML host page RootPanel.get("mapContainer").add(map); } }