package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni; import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION; import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil; import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location; import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE; import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView; import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable; import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil; import com.google.gwt.core.client.GWT; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.Widget; import ol.Coordinate; public class LayerConcessioneView extends Composite { private static LayerConcessioneUiBinder uiBinder = GWT.create(LayerConcessioneUiBinder.class); interface LayerConcessioneUiBinder extends UiBinder { } @UiField HTMLPanel layerConcessionePanel; @UiField HTMLPanel mapViewPanel; private CustomFlexTable customTable = new CustomFlexTable(); public LayerConcessioneView(LayerConcessioneDV layerDV) { initWidget(uiBinder.createAndBindUi(this)); GWT.log("Showing: " + layerDV); customTable.addNextKeyValue("Abstract", layerDV.getAbstractSection()); customTable.addNextKeyValue("Valutazione qualità", layerDV.getValutazioneQualita()); customTable.addNextKeyValue("Metodo raccolta dati", layerDV.getMetodoRaccoltaDati()); customTable.addNextKeyValue("Scala acquisizione dati", layerDV.getScalaAcquisizione()); customTable.addNextKeyValues("Autori", layerDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR); layerConcessionePanel.add(customTable); GWT.log("WMS LINK: " + layerDV.getWmsLink()); if (layerDV.getLayerName() != null && layerDV.getWmsLink() != null) { String pngWMSLink = URLUtil.setValueOfParameter("FORMAT", layerDV.getWmsLink(), "image/png", true); customTable.addNextKeyWidget("Layer", new HTML("download image")); Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY); Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857); // Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT); // Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, MAP_PROJECTION.EPSG_4326.getName(), MAP_PROJECTION.EPSG_3857.getName()); MapView mapView = new MapView(transformedCenterCoordinate, GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px"); mapViewPanel.add(mapView); String mapServerHost = layerDV.getWmsLink().contains("?") ? layerDV.getWmsLink().substring(0, layerDV.getWmsLink().indexOf("?")) : layerDV.getWmsLink(); mapView.addWMSLayer(mapServerHost, layerDV.getLayerName(), layerDV.getBbox()); } } }