added download layer
This commit is contained in:
parent
5a84d3a990
commit
6230560af7
|
@ -32,7 +32,7 @@
|
|||
</b:Paragraph>
|
||||
</g:HTMLPanel>
|
||||
</b:DropdownButton>
|
||||
<b:DropdownButton type="LINK" text="Extent to"
|
||||
<b:DropdownButton type="LINK" text="Preset Location"
|
||||
icon="TH_LARGE">
|
||||
<b:Nav>
|
||||
<b:Button type="LINK" ui:field="extentToItaly"
|
||||
|
|
|
@ -169,4 +169,5 @@ import ol.OLFactory;
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ public class ConcessioneView extends Composite {
|
|||
}
|
||||
|
||||
if (concessioneDV.getAuthors() != null) {
|
||||
customTable.addNextKeyValues("Autori", concessioneDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
customTable.addNextKeyValues("Staff", concessioneDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getContributore() != null) {
|
||||
|
|
|
@ -8,11 +8,13 @@ import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.L
|
|||
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;
|
||||
|
||||
|
@ -35,7 +37,7 @@ public class LayerConcessioneView extends Composite {
|
|||
|
||||
public LayerConcessioneView(LayerConcessioneDV layerDV) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
GWT.log("Showing: "+layerDV);
|
||||
GWT.log("Showing: " + layerDV);
|
||||
|
||||
customTable.addNextKeyValue("Abstract", layerDV.getAbstractSection());
|
||||
customTable.addNextKeyValue("Valutazione qualità", layerDV.getValutazioneQualita());
|
||||
|
@ -44,18 +46,24 @@ public class LayerConcessioneView extends Composite {
|
|||
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) {
|
||||
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("<a href=\"" + pngWMSLink + "\">download image</a>"));
|
||||
|
||||
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");
|
||||
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();
|
||||
String mapServerHost = layerDV.getWmsLink().contains("?")
|
||||
? layerDV.getWmsLink().substring(0, layerDV.getWmsLink().indexOf("?"))
|
||||
: layerDV.getWmsLink();
|
||||
mapView.addWMSLayer(mapServerHost, layerDV.getLayerName(), layerDV.getBbox());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.util;
|
||||
|
||||
import org.gcube.spatial.data.geoutility.bean.WmsParameters;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class URLUtil.
|
||||
*
|
||||
|
@ -60,6 +63,35 @@ public class URLUtil {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the value of parameter.
|
||||
*
|
||||
* @param wmsParam the wms param
|
||||
* @param wmsLink the wms link
|
||||
* @param newValue the new value
|
||||
* @param addIfNotExists the add if not exists
|
||||
* @return the string
|
||||
*/
|
||||
public static String setValueOfParameter(String wmsParam, String wmsLink, String newValue, boolean addIfNotExists){
|
||||
String toLowerWmsLink = wmsLink.toLowerCase();
|
||||
String toLowerWmsParam = wmsParam.toLowerCase();
|
||||
|
||||
int index = toLowerWmsLink.indexOf(toLowerWmsParam+"="); //END WITH CHAR "=" TO BE SURE THAT IT IS A PARAMETER
|
||||
if(index > -1){
|
||||
int indexStartValue = index + toLowerWmsParam.length()+1; //add +1 for char '='
|
||||
int indexOfSeparator = toLowerWmsLink.indexOf("&", indexStartValue); //GET THE FIRST "&" STARTING FROM INDEX VALUE
|
||||
// logger.trace("indexOfSeparator index of "+wmsParam+ " is: "+indexOfSeparator);
|
||||
int indexEndValue = indexOfSeparator!=-1?indexOfSeparator:toLowerWmsLink.length();
|
||||
// logger.trace("end: "+indexEndValue);
|
||||
return wmsLink.substring(0, indexStartValue) + newValue +wmsLink.substring(indexEndValue, wmsLink.length());
|
||||
}else if (addIfNotExists){
|
||||
wmsLink+="&"+wmsParam+"="+newValue;
|
||||
}
|
||||
// logger.trace("return value: "+value);
|
||||
return wmsLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract value of parameter from URL.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue