package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants; import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils; 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.shared.products.model.LayerConcessioneDV; 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.HTMLPanel; import com.google.gwt.user.client.ui.Widget; import ol.Coordinate; import ol.OLFactory; 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) { Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT); Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857); 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()); } } }