added Application Profile to read available layers
This commit is contained in:
parent
05f6d5f5b8
commit
538f87f1d1
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
||||||
|
@ -7,8 +8,9 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEven
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataViewerProfile;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ProductType;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ProductType;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
|
||||||
|
|
||||||
|
@ -58,6 +60,9 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
/** The param UUID. */
|
/** The param UUID. */
|
||||||
private String paramUUID;
|
private String paramUUID;
|
||||||
|
|
||||||
|
/** The param UUID. */
|
||||||
|
private String layerType;
|
||||||
|
|
||||||
/** The param layer title. */
|
/** The param layer title. */
|
||||||
private String paramLayerTitle;
|
private String paramLayerTitle;
|
||||||
|
|
||||||
|
@ -104,42 +109,109 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
// });
|
// });
|
||||||
|
|
||||||
paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER);
|
paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER);
|
||||||
|
layerType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_DISPLAY_LAYER_TYPE);
|
||||||
paramUUID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_UUID_PARAMETER);
|
paramUUID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_UUID_PARAMETER);
|
||||||
paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE);
|
paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE);
|
||||||
GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest);
|
GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest);
|
||||||
|
GWT.log(GeoportalDataViewerConstants.GET_DISPLAY_LAYER_TYPE + " = " + layerType);
|
||||||
GWT.log(GeoportalDataViewerConstants.GET_UUID_PARAMETER + " = " + paramUUID);
|
GWT.log(GeoportalDataViewerConstants.GET_UUID_PARAMETER + " = " + paramUUID);
|
||||||
GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle);
|
GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle);
|
||||||
|
|
||||||
if (paramWmsRequest != null && !paramWmsRequest.isEmpty()) {
|
|
||||||
|
|
||||||
try {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
//wmsRequestConverter.addRequestToGisViewer(paramWmsRequest, paramLayerTitle, paramUUID);
|
|
||||||
//FIND BASE URL
|
|
||||||
int indexStart = paramWmsRequest.indexOf("?");
|
|
||||||
String url;
|
|
||||||
if(indexStart>=0){
|
|
||||||
url = paramWmsRequest.substring(0, indexStart); //get only base uri
|
|
||||||
url = url.trim(); //string trim
|
|
||||||
}else{
|
|
||||||
Window.alert("Bad wms request '?' not found!");
|
|
||||||
// throw new Exception("Bad server request '?' not found!");
|
|
||||||
}
|
|
||||||
|
|
||||||
String layerName = URLUtil.getValueOfParameter("layers", paramWmsRequest);
|
@Override
|
||||||
String displayName = paramLayerTitle==null || paramLayerTitle.isEmpty()?layerName:paramLayerTitle;
|
public void execute() {
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
GeoportalDataViewerServiceAsync.Util.getInstance().getGeoNaDataViewProfile(new AsyncCallback<GeoNaDataViewerProfile>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void onFailure(Throwable caught) {
|
||||||
layerManager.addLayerByWmsRequest(displayName, layerName, paramWmsRequest, false, false, paramUUID, true);
|
Window.alert(caught.getMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(GeoNaDataViewerProfile result) {
|
||||||
|
GWT.log("Profile: "+result);
|
||||||
|
Iterator<String> it;
|
||||||
|
if(layerType==null) {
|
||||||
|
it = result.getMapLayers().keySet().iterator();
|
||||||
|
it.hasNext();
|
||||||
|
layerType= it.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerItem layerItem = result.getMapLayers().get(layerType);
|
||||||
|
|
||||||
|
if(layerItem==null) {
|
||||||
|
Window.alert("Not detected any layer for "+layerType);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GWT.log("The layerItem is: "+layerItem);
|
||||||
|
layerManager.addLayerByWmsRequest(null, null, layerItem.getWmsLink(), false, false, null, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
GWT.log("An error occurred on adding wmsrequest :" + paramWmsRequest, e);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
// if (paramWmsRequest != null && !paramWmsRequest.isEmpty()) {
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// //wmsRequestConverter.addRequestToGisViewer(paramWmsRequest, paramLayerTitle, paramUUID);
|
||||||
|
// //FIND BASE URL
|
||||||
|
// /*int indexStart = paramWmsRequest.indexOf("?");
|
||||||
|
// String url;
|
||||||
|
// if(indexStart>=0){
|
||||||
|
// url = paramWmsRequest.substring(0, indexStart); //get only base uri
|
||||||
|
// url = url.trim(); //string trim
|
||||||
|
// }else{
|
||||||
|
// Window.alert("Bad wms request '?' not found!");
|
||||||
|
//// throw new Exception("Bad server request '?' not found!");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String layerName = URLUtil.getValueOfParameter("layers", paramWmsRequest);
|
||||||
|
// String displayName = paramLayerTitle==null || paramLayerTitle.isEmpty()?layerName:paramLayerTitle;
|
||||||
|
// Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void execute() {
|
||||||
|
// layerManager.addLayerByWmsRequest(displayName, layerName, paramWmsRequest, false, false, paramUUID, true);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });*/
|
||||||
|
// Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void execute() {
|
||||||
|
// GWT.log("qui");
|
||||||
|
// GeoportalDataViewerServiceAsync.Util.getInstance().getGeoNaDataViewProfile(new AsyncCallback<GeoNaDataViewerProfile>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onFailure(Throwable caught) {
|
||||||
|
// Window.alert(caught.getMessage());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess(GeoNaDataViewerProfile result) {
|
||||||
|
// GWT.log("Profile: "+result);
|
||||||
|
// Iterator<String> it;
|
||||||
|
// if(layerType==null) {
|
||||||
|
// it = result.getMapLayers().keySet().iterator();
|
||||||
|
// it.hasNext();
|
||||||
|
// layerType= it.next();
|
||||||
|
// }
|
||||||
|
// layerManager.addLayerByType(layerType);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// GWT.log("An error occurred on adding wmsrequest :" + paramWmsRequest, e);
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
bindEvents();
|
bindEvents();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ public class GeoportalDataViewerConstants {
|
||||||
public static final String MAP_DIV = "map";
|
public static final String MAP_DIV = "map";
|
||||||
|
|
||||||
public static final String GET_WMS_PARAMETER = "wmsrequest";
|
public static final String GET_WMS_PARAMETER = "wmsrequest";
|
||||||
|
public static final String GET_DISPLAY_LAYER_TYPE = "dlt";
|
||||||
public static final String GET_UUID_PARAMETER = "uuid";
|
public static final String GET_UUID_PARAMETER = "uuid";
|
||||||
public static final String GET_LAYER_TITLE = "layertitle";
|
public static final String GET_LAYER_TITLE = "layertitle";
|
||||||
public static final String GET_MAX_ZOOM_LEVEL = OpenLayersMapParameters.OL_MAP_PARAM.maxzoomlevel.name();
|
public static final String GET_MAX_ZOOM_LEVEL = OpenLayersMapParameters.OL_MAP_PARAM.maxzoomlevel.name();
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataObject;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataViewerProfile;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
@ -26,4 +27,15 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
|
|
||||||
String getMyLogin();
|
String getMyLogin();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the layer for type.
|
||||||
|
*
|
||||||
|
* @param layerType the layer type
|
||||||
|
* @return the layer for type
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
GeoInformationForWMSRequest getLayerForType(String layerType) throws Exception;
|
||||||
|
|
||||||
|
GeoNaDataViewerProfile getGeoNaDataViewProfile() throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataObject;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataViewerProfile;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
@ -38,4 +39,8 @@ public interface GeoportalDataViewerServiceAsync {
|
||||||
void getConcessioneForId(Long id, AsyncCallback<ConcessioneDV> callback);
|
void getConcessioneForId(Long id, AsyncCallback<ConcessioneDV> callback);
|
||||||
|
|
||||||
void getMyLogin(AsyncCallback<String> callback);
|
void getMyLogin(AsyncCallback<String> callback);
|
||||||
|
|
||||||
|
void getLayerForType(String layerType, AsyncCallback<GeoInformationForWMSRequest> callback);
|
||||||
|
|
||||||
|
void getGeoNaDataViewProfile(AsyncCallback<GeoNaDataViewerProfile> callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -62,7 +65,8 @@ public class LayerManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new layer manager.
|
* Instantiates a new layer manager.
|
||||||
* @param applicationBus
|
*
|
||||||
|
* @param applicationBus the application bus
|
||||||
*/
|
*/
|
||||||
public LayerManager(HandlerManager applicationBus) {
|
public LayerManager(HandlerManager applicationBus) {
|
||||||
this.applicationBus = applicationBus;
|
this.applicationBus = applicationBus;
|
||||||
|
@ -70,6 +74,9 @@ public class LayerManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind events.
|
||||||
|
*/
|
||||||
private void bindEvents() {
|
private void bindEvents() {
|
||||||
|
|
||||||
eventBus.addHandler(QueryDataEvent.TYPE, new QueryDataEventHandler() {
|
eventBus.addHandler(QueryDataEvent.TYPE, new QueryDataEventHandler() {
|
||||||
|
@ -266,13 +273,35 @@ public class LayerManager {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(GeoInformationForWMSRequest result) {
|
public void onSuccess(GeoInformationForWMSRequest result) {
|
||||||
|
|
||||||
GWT.log("Add Layer By WMS: "+result.getMapWMSNoStandard() + ", and isNCWMS? "+result.isNcWMS());
|
GWT.log("Add Layer By WMS: "+result.getWmsRequest() + ", and isNCWMS? "+result.isNcWMS());
|
||||||
addLayerByWms(featureType, layerTitle, layerName, result.getWmsRequest(), result.getBaseWmsServiceHost(), true, isBase, displayInLayerSwitcher, (ArrayList<String>) result.getStyles().getGeoStyles(), result.getWmsRequest(), false, result.getMapWMSNoStandard(), result.isNcWMS(), UUID, result.getZAxis());
|
addLayerByWms(featureType, layerTitle, result.getLayerName(), result.getWmsRequest(), result.getBaseWmsServiceHost(), true, isBase, displayInLayerSwitcher, (ArrayList<String>) result.getStyles().getGeoStyles(), result.getWmsRequest(), false, result.getMapWMSNoStandard(), result.isNcWMS(), UUID, result.getZAxis());
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public void addLayerByType(String layerType) {
|
||||||
|
//
|
||||||
|
// final boolean isBase = false;
|
||||||
|
// final LayerType featureType = isBase?LayerType.RASTER_BASELAYER:LayerType.FEATURE_TYPE;
|
||||||
|
// boolean displayInLayerSwitcher = false;
|
||||||
|
// GeoportalDataViewerServiceAsync.Util.getInstance().getLayerForType(layerType, new AsyncCallback<GeoInformationForWMSRequest>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onFailure(Throwable caught) {
|
||||||
|
// Window.alert(caught.getMessage());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess(GeoInformationForWMSRequest result) {
|
||||||
|
// GWT.log("Add Layer By WMS: "+result.getMapWMSNoStandard() + ", and isNCWMS? "+result.isNcWMS());
|
||||||
|
// addLayerByWms(featureType, result.getLayerName(), result.getLayerName(), result.getWmsRequest(), result.getBaseWmsServiceHost(), true, isBase, displayInLayerSwitcher, (ArrayList<String>) result.getStyles().getGeoStyles(), result.getWmsRequest(), false, result.getMapWMSNoStandard(), result.isNcWMS(), null, result.getZAxis());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the layer by wms.
|
* Adds the layer by wms.
|
||||||
|
@ -286,14 +315,14 @@ public class LayerManager {
|
||||||
* @param isBase the is base
|
* @param isBase the is base
|
||||||
* @param displayInLayerSwitcher the display in layer switcher
|
* @param displayInLayerSwitcher the display in layer switcher
|
||||||
* @param styles the styles
|
* @param styles the styles
|
||||||
* @param serverWmsRequest the server wms request
|
* @param wmsLink the wms link
|
||||||
* @param onTop the on top
|
* @param onTop the on top
|
||||||
* @param wmsNotStandardParams the wms not standard params
|
* @param wmsNotStandardParams the wms not standard params
|
||||||
* @param isNcWms the is nc wms
|
* @param isNcWms the is nc wms
|
||||||
* @param UUID the uuid
|
* @param UUID the uuid
|
||||||
* @param zAxis the z axis
|
* @param zAxis the z axis
|
||||||
*/
|
*/
|
||||||
private void addLayerByWms(LayerType layerType, String layerTitle, String layerName, String layerURL, String mapServerHost, boolean isExternal, boolean isBase, boolean displayInLayerSwitcher, ArrayList<String> styles, String serverWmsRequest, boolean onTop, HashMap<String, String> wmsNotStandardParams, boolean isNcWms, String UUID, ZAxis zAxis) {
|
private void addLayerByWms(LayerType layerType, String layerTitle, String layerName, String layerURL, String mapServerHost, boolean isExternal, boolean isBase, boolean displayInLayerSwitcher, ArrayList<String> styles, String wmsLink, boolean onTop, HashMap<String, String> wmsNotStandardParams, boolean isNcWms, String UUID, ZAxis zAxis) {
|
||||||
|
|
||||||
// GWT.log("Add addLayerByWms 1");
|
// GWT.log("Add addLayerByWms 1");
|
||||||
LayerItem layerItem = new LayerItem();
|
LayerItem layerItem = new LayerItem();
|
||||||
|
@ -305,7 +334,7 @@ public class LayerManager {
|
||||||
//l.setExternal(isExternal);
|
//l.setExternal(isExternal);
|
||||||
layerItem.setOpacity(1d);
|
layerItem.setOpacity(1d);
|
||||||
layerItem.setBuffer(2);
|
layerItem.setBuffer(2);
|
||||||
layerItem.setServerWmsRequest(serverWmsRequest);
|
layerItem.setWmsLink(wmsLink);
|
||||||
layerItem.setWmsNotStandardParams(wmsNotStandardParams);
|
layerItem.setWmsNotStandardParams(wmsNotStandardParams);
|
||||||
layerItem.setNcWms(isNcWms);
|
layerItem.setNcWms(isNcWms);
|
||||||
layerItem.setUUID(UUID);
|
layerItem.setUUID(UUID);
|
||||||
|
@ -340,7 +369,7 @@ public class LayerManager {
|
||||||
layerItem.setStyle(styles.get(0));
|
layerItem.setStyle(styles.get(0));
|
||||||
layerItem.setStyles(styles);
|
layerItem.setStyles(styles);
|
||||||
}else{
|
}else{
|
||||||
String style = URLUtil.getValueOfParameter("styles", serverWmsRequest);
|
String style = URLUtil.getValueOfParameter("styles", wmsLink);
|
||||||
if(style!=null){ //CASE OF STYLE ="";
|
if(style!=null){ //CASE OF STYLE ="";
|
||||||
//TENTATIVE TO GET LEGEND
|
//TENTATIVE TO GET LEGEND
|
||||||
layerItem.setHasLegend(true);
|
layerItem.setHasLegend(true);
|
||||||
|
@ -376,6 +405,11 @@ public class LayerManager {
|
||||||
this.olMap = olMap;
|
this.olMap = olMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the event bus.
|
||||||
|
*
|
||||||
|
* @return the event bus
|
||||||
|
*/
|
||||||
public HandlerManager getEventBus() {
|
public HandlerManager getEventBus() {
|
||||||
return eventBus;
|
return eventBus;
|
||||||
}
|
}
|
||||||
|
@ -383,4 +417,7 @@ public class LayerManager {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import ol.MapOptions;
|
||||||
import ol.OLFactory;
|
import ol.OLFactory;
|
||||||
import ol.View;
|
import ol.View;
|
||||||
import ol.ViewOptions;
|
import ol.ViewOptions;
|
||||||
import ol.color.Color;
|
|
||||||
import ol.control.Attribution;
|
import ol.control.Attribution;
|
||||||
import ol.event.EventListener;
|
import ol.event.EventListener;
|
||||||
import ol.geom.Point;
|
import ol.geom.Point;
|
||||||
|
@ -32,12 +31,8 @@ import ol.source.ImageWmsOptions;
|
||||||
import ol.source.ImageWmsParams;
|
import ol.source.ImageWmsParams;
|
||||||
import ol.source.Osm;
|
import ol.source.Osm;
|
||||||
import ol.source.XyzOptions;
|
import ol.source.XyzOptions;
|
||||||
import ol.style.Fill;
|
|
||||||
import ol.style.FillOptions;
|
|
||||||
import ol.style.Icon;
|
import ol.style.Icon;
|
||||||
import ol.style.IconOptions;
|
import ol.style.IconOptions;
|
||||||
import ol.style.Stroke;
|
|
||||||
import ol.style.StrokeOptions;
|
|
||||||
import ol.style.Style;
|
import ol.style.Style;
|
||||||
import ol.style.Text;
|
import ol.style.Text;
|
||||||
import ol.style.TextOptions;
|
import ol.style.TextOptions;
|
||||||
|
|
|
@ -118,9 +118,9 @@ import ol.OLFactory;
|
||||||
|
|
||||||
ExtentWrapped ew = new ExtentWrapped(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(),
|
ExtentWrapped ew = new ExtentWrapped(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(),
|
||||||
upperCoord.getY());
|
upperCoord.getY());
|
||||||
Coordinate center = ew.getCenter();
|
//Coordinate center = ew.getCenter();
|
||||||
GWT.log("center: "+center);
|
//GWT.log("center: "+center);
|
||||||
Coordinate invertCoordinate = new Coordinate(center.getY(), center.getX());
|
//Coordinate invertCoordinate = new Coordinate(center.getY(), center.getX());
|
||||||
// Size size = new Size(300, 300);
|
// Size size = new Size(300, 300);
|
||||||
//olsm.getMap().getView().setCenter(invertCoordinate);
|
//olsm.getMap().getView().setCenter(invertCoordinate);
|
||||||
olsm.getMap().getView().fit(ew);
|
olsm.getMap().getView().fit(ew);
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class ApplicationProfileException.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
||||||
|
* Sep 6, 2016
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class ApplicationProfileNotFoundException extends Exception {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new application profile exception.
|
||||||
|
*
|
||||||
|
* @param message the message
|
||||||
|
*/
|
||||||
|
public ApplicationProfileNotFoundException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,181 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||||
|
|
||||||
|
import static org.gcube.resources.discovery.icclient.ICFactory.client;
|
||||||
|
|
||||||
|
import java.io.StringReader;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.xpath.XPath;
|
||||||
|
import javax.xml.xpath.XPathConstants;
|
||||||
|
import javax.xml.xpath.XPathFactory;
|
||||||
|
|
||||||
|
import org.gcube.common.resources.gcore.utils.XPathHelper;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataViewerProfile;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
|
import org.gcube.resources.discovery.client.queries.api.Query;
|
||||||
|
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
import org.xml.sax.InputSource;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class GeoNaViewerProfileReader.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Nov 12, 2020
|
||||||
|
*/
|
||||||
|
public class GeoNaDataViewerProfileReader {
|
||||||
|
|
||||||
|
private static final String RESOURCE_PROFILE_BODY_PORTLET_URL = "/Resource/Profile/Body/PortletURL";
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static final String SECONDARY_TYPE = "ApplicationProfile";
|
||||||
|
public static final String WORKSPACE_EXPLORER_APP_NAME = "GeoNa-Viewer-Profile";
|
||||||
|
|
||||||
|
private Logger logger = LoggerFactory.getLogger(GeoNaDataViewerProfileReader.class);
|
||||||
|
private String secondaryType;
|
||||||
|
private String scope;
|
||||||
|
private String appID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new application profile reader.
|
||||||
|
*
|
||||||
|
* @param appID the app id
|
||||||
|
*/
|
||||||
|
public GeoNaDataViewerProfileReader(String appID) {
|
||||||
|
|
||||||
|
this.appID = appID;
|
||||||
|
this.secondaryType = SECONDARY_TYPE;
|
||||||
|
this.scope = ScopeProvider.instance.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read profile from infrastrucure.
|
||||||
|
*
|
||||||
|
* @return the map
|
||||||
|
*/
|
||||||
|
public GeoNaDataViewerProfile readProfileFromInfrastrucure() throws Exception {
|
||||||
|
|
||||||
|
String queryString = getGcubeGenericQueryString(secondaryType, appID);
|
||||||
|
logger.info("Scope "+scope+", trying to perform query: "+queryString);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (scope == null)
|
||||||
|
throw new Exception("Scope is null, set scope into ScopeProvider");
|
||||||
|
|
||||||
|
GeoNaDataViewerProfile profile = new GeoNaDataViewerProfile();
|
||||||
|
|
||||||
|
logger.info("Trying to fetch ApplicationProfile in the scope: " + scope + ", SecondaryType: "
|
||||||
|
+ secondaryType + ", AppId: " + appID);
|
||||||
|
Query q = new QueryBox(queryString);
|
||||||
|
DiscoveryClient<String> client = client();
|
||||||
|
List<String> appProfile = client.submit(q);
|
||||||
|
|
||||||
|
if (appProfile == null || appProfile.size() == 0)
|
||||||
|
throw new ApplicationProfileNotFoundException("ApplicationProfile with SecondaryType: " + secondaryType
|
||||||
|
+ ", AppId: " + appID + " is not registered in the scope: " + scope);
|
||||||
|
else {
|
||||||
|
String elem = appProfile.get(0);
|
||||||
|
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
|
Document doc = docBuilder.parse(new InputSource(new StringReader(elem)));
|
||||||
|
|
||||||
|
XPathHelper helper = new XPathHelper(doc.getDocumentElement());
|
||||||
|
|
||||||
|
List<String> currValue = null;
|
||||||
|
String portletURL = null;
|
||||||
|
currValue = helper.evaluate(RESOURCE_PROFILE_BODY_PORTLET_URL+"/text()");
|
||||||
|
if (currValue != null && currValue.size() > 0) {
|
||||||
|
portletURL = currValue.get(0);
|
||||||
|
}else
|
||||||
|
throw new Exception("I'm not able to read the path: "+RESOURCE_PROFILE_BODY_PORTLET_URL);
|
||||||
|
|
||||||
|
|
||||||
|
XPath xPath = XPathFactory.newInstance().newXPath();
|
||||||
|
NodeList nodeList = (NodeList) xPath.compile("/Resource/Profile/Body/AvailableLayers/Layer")
|
||||||
|
.evaluate(doc, XPathConstants.NODESET);
|
||||||
|
|
||||||
|
Map<String, LayerItem> mapLayers = new HashMap<String, LayerItem>(nodeList.getLength());
|
||||||
|
|
||||||
|
for (int i = 0; i < nodeList.getLength(); i++) {
|
||||||
|
Node layerNode = nodeList.item(i);
|
||||||
|
if (layerNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
|
Element eElement = (Element) layerNode;
|
||||||
|
String layerType = eElement.getElementsByTagName("Type").item(0).getTextContent();
|
||||||
|
String wmsLink = eElement.getElementsByTagName("WMS_LINK").item(0).getTextContent();
|
||||||
|
String decodedURL = URLDecoder.decode(wmsLink, "UTF-8");
|
||||||
|
LayerItem layer = new LayerItem();
|
||||||
|
layer.setWmsLink(decodedURL);
|
||||||
|
mapLayers.put(layerType.toLowerCase(), layer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
profile.setPortletURL(portletURL);
|
||||||
|
profile.setMapLayers(mapLayers);
|
||||||
|
logger.info("returning: "+profile);
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Error while trying to read the " + SECONDARY_TYPE + " with SecondaryType "
|
||||||
|
+ WORKSPACE_EXPLORER_APP_NAME + " from scope " + scope, e);
|
||||||
|
return null;
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the gcube generic query string.
|
||||||
|
*
|
||||||
|
* @param secondaryType the secondary type
|
||||||
|
* @param appId the app id
|
||||||
|
* @return the gcube generic query string
|
||||||
|
*/
|
||||||
|
public static String getGcubeGenericQueryString(String secondaryType, String appId) {
|
||||||
|
|
||||||
|
return "for $profile in collection('/db/Profiles/GenericResource')//Resource "
|
||||||
|
+ "where $profile/Profile/SecondaryType/string() eq '" + secondaryType
|
||||||
|
+ "' and $profile/Profile/Body/AppId/string() " + " eq '" + appId + "'" + "return $profile";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the secondary type.
|
||||||
|
*
|
||||||
|
* @return the secondary type
|
||||||
|
*/
|
||||||
|
public String getSecondaryType() {
|
||||||
|
return secondaryType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the scope.
|
||||||
|
*
|
||||||
|
* @return the scope
|
||||||
|
*/
|
||||||
|
public String getScope() {
|
||||||
|
return scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "GeoNaViewerProfileReader [secondaryType=" + secondaryType + ", scope=" + scope + ", appID=" + appID
|
||||||
|
+ "]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,6 +14,7 @@ import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.URLParserUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.URLParserUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataObject;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataViewerProfile;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
@ -32,6 +33,10 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server side implementation of the RPC service.
|
* The server side implementation of the RPC service.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Nov 12, 2020
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet implements
|
public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
@ -41,21 +46,31 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
/** The Constant LOG. */
|
/** The Constant LOG. */
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataViewerServiceImpl.class);
|
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataViewerServiceImpl.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses the wms request.
|
||||||
|
*
|
||||||
|
* @param wmsRequest the wms request
|
||||||
|
* @param layerName the layer name
|
||||||
|
* @return the geo information for WMS request
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public GeoInformationForWMSRequest parseWmsRequest(String wmsRequest, String layerName) throws Exception {
|
public GeoInformationForWMSRequest parseWmsRequest(String wmsRequest, String layerName) throws Exception {
|
||||||
return loadGeoInfoForWmsRequest(wmsRequest, layerName);
|
return loadGeoInfoForWmsRequest(wmsRequest, layerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load geo info for wms request.
|
|
||||||
|
/**
|
||||||
|
* Load geo info for wms request.
|
||||||
*
|
*
|
||||||
* @param wmsRequest the wms request
|
* @param wmsLink the wms link
|
||||||
* @param layerName the layer name
|
* @param layerName the layer name
|
||||||
* @return the gis viewer wms valid parameters
|
* @return the geo information for WMS request
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public static GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsRequest, String layerName) throws Exception{
|
public static GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName) throws Exception{
|
||||||
try {
|
try {
|
||||||
WMSUrlValidator validator = new WMSUrlValidator(wmsRequest, layerName);
|
WMSUrlValidator validator = new WMSUrlValidator(wmsLink, layerName);
|
||||||
String wmsServiceHost = validator.getWmsServiceHost();
|
String wmsServiceHost = validator.getWmsServiceHost();
|
||||||
String validWMSRequest = validator.parseWMSRequest(true, true);
|
String validWMSRequest = validator.parseWMSRequest(true, true);
|
||||||
layerName = validator.getLayerName();
|
layerName = validator.getLayerName();
|
||||||
|
@ -89,6 +104,16 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the data result.
|
||||||
|
*
|
||||||
|
* @param layerItems the layer items
|
||||||
|
* @param mapSrsName the map srs name
|
||||||
|
* @param selectBBOX the select BBOX
|
||||||
|
* @param maxWFSFeature the max WFS feature
|
||||||
|
* @param zoomLevel the zoom level
|
||||||
|
* @return the data result
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -104,17 +129,17 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the concessione for id.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @return the concessione for id
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ConcessioneDV getConcessioneForId(Long id) throws Exception{
|
public ConcessioneDV getConcessioneForId(Long id) throws Exception{
|
||||||
LOG.info("getConcessioneForId "+id+ "called");
|
LOG.info("getConcessioneForId "+id+ "called");
|
||||||
|
|
||||||
// if(!SessionUtil.isIntoPortal()) {
|
|
||||||
// LOG.warn("OUT OF PORTAL setting HARD-CODED SCOPE");
|
|
||||||
// String scope = "/gcube/devNext/NextNext";
|
|
||||||
// LOG.warn("SCOPE is: "+scope);
|
|
||||||
// ScopeProvider.instance.set(scope);
|
|
||||||
// }
|
|
||||||
|
|
||||||
ConcessioneDV concessionDV = null;
|
ConcessioneDV concessionDV = null;
|
||||||
|
|
||||||
if(id==null)
|
if(id==null)
|
||||||
|
@ -198,4 +223,51 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the layer for type.
|
||||||
|
*
|
||||||
|
* @param layerType the layer type
|
||||||
|
* @param fallbackOnError the fallback on error
|
||||||
|
* @return the layer for type
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public GeoInformationForWMSRequest getLayerForType(String layerType) throws Exception{
|
||||||
|
LOG.info("Called getLayerForType for:"+layerType);
|
||||||
|
|
||||||
|
if(layerType==null || layerType.isEmpty())
|
||||||
|
throw new Exception("The input parameter layerType is null or empty");
|
||||||
|
|
||||||
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
GeoNaDataViewerProfileReader gdvp = new GeoNaDataViewerProfileReader("geoportal-data-viewer-app");
|
||||||
|
GeoNaDataViewerProfile profile = gdvp.readProfileFromInfrastrucure();
|
||||||
|
LOG.info("Read profile: "+profile);
|
||||||
|
|
||||||
|
String lowerLayerType = layerType.toLowerCase();
|
||||||
|
LOG.info("Reading map layers for type:"+lowerLayerType);
|
||||||
|
LayerItem layer = profile.getMapLayers().get(lowerLayerType);
|
||||||
|
|
||||||
|
if(layer==null || layer.getWmsLink()==null)
|
||||||
|
throw new Exception("The layer type "+lowerLayerType+" has not been found. Please check your input parameter");
|
||||||
|
|
||||||
|
if(layer.getWmsLink()==null)
|
||||||
|
throw new Exception("The layer type "+lowerLayerType+" has not a WMS Link associated. Please check your input parameter");
|
||||||
|
|
||||||
|
|
||||||
|
return parseWmsRequest(layer.getWmsLink(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GeoNaDataViewerProfile getGeoNaDataViewProfile() throws Exception{
|
||||||
|
LOG.info("Called getAvailableLayers");
|
||||||
|
|
||||||
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
GeoNaDataViewerProfileReader gdvp = new GeoNaDataViewerProfileReader("geoportal-data-viewer-app");
|
||||||
|
GeoNaDataViewerProfile profile = gdvp.readProfileFromInfrastrucure();
|
||||||
|
LOG.info("Returning profile: "+profile);
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,13 +37,16 @@ public class WMSUrlValidator {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new gis viewer wms url validator.
|
* Instantiates a new WMS url validator.
|
||||||
*
|
*
|
||||||
* @param wmsRequest the full url
|
* @param wmsRequest the wms request
|
||||||
* @param layerName the layer name
|
* @param inputLayerName the input layer name
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public WMSUrlValidator(String wmsRequest, String layerName) throws Exception{
|
public WMSUrlValidator(String wmsRequest, String inputLayerName) throws Exception{
|
||||||
|
LOG.debug("WMSURLValidator wmsRequest: "+wmsRequest);
|
||||||
|
LOG.debug("WMSURLValidator layerName: "+inputLayerName);
|
||||||
|
|
||||||
|
|
||||||
if(wmsRequest==null || wmsRequest.isEmpty())
|
if(wmsRequest==null || wmsRequest.isEmpty())
|
||||||
throw new Exception("WMS request is null or empty");
|
throw new Exception("WMS request is null or empty");
|
||||||
|
@ -57,13 +60,13 @@ public class WMSUrlValidator {
|
||||||
LOG.trace("found "+GeoWmsServiceUtility.SERVICE_WMS+" in wms request: "+wmsRequestURI);
|
LOG.trace("found "+GeoWmsServiceUtility.SERVICE_WMS+" in wms request: "+wmsRequestURI);
|
||||||
webMapServerHost = getWebMapServerHost(wmsRequestURI);
|
webMapServerHost = getWebMapServerHost(wmsRequestURI);
|
||||||
}else
|
}else
|
||||||
throw new Exception("WMS service not found for layer: "+layerName);
|
throw new Exception("WMS service not found for layer: "+inputLayerName);
|
||||||
|
|
||||||
//VALIDATION WMS
|
//VALIDATION WMS
|
||||||
String baseWmsService = webMapServerHost.getHost();
|
String baseWmsService = webMapServerHost.getHost();
|
||||||
//IS OWS OR WMS?
|
//IS OWS OR WMS?
|
||||||
this.wmsServiceHost = appendWmsServiceToBaseUrl(wmsRequest.substring(0, wmsRequest.indexOf("?")),isOwsService);
|
this.wmsServiceHost = appendWmsServiceToBaseUrl(wmsRequest.substring(0, wmsRequest.indexOf("?")),isOwsService);
|
||||||
this.layerName = layerName;
|
this.layerName = inputLayerName;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//VALIDATE WMS SERVICE FOR WEB MAP SERVER
|
//VALIDATE WMS SERVICE FOR WEB MAP SERVER
|
||||||
|
@ -82,7 +85,7 @@ public class WMSUrlValidator {
|
||||||
if(this.layerName==null || this.layerName.isEmpty()){
|
if(this.layerName==null || this.layerName.isEmpty()){
|
||||||
|
|
||||||
this.layerName = WmsUrlValidator.getValueOfParameter(WmsParameters.LAYERS, wmsRequest);
|
this.layerName = WmsUrlValidator.getValueOfParameter(WmsParameters.LAYERS, wmsRequest);
|
||||||
if(this.layerName==null || layerName.isEmpty())
|
if(this.layerName==null || this.layerName.isEmpty())
|
||||||
throw new Exception("Layer name is null or empty");
|
throw new Exception("Layer name is null or empty");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class GeoNaDataViewerProfile.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Nov 12, 2020
|
||||||
|
*/
|
||||||
|
public class GeoNaDataViewerProfile implements IsSerializable, Serializable{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 8583236018312392009L;
|
||||||
|
private String portletURL;
|
||||||
|
//the key is the layer type
|
||||||
|
private Map<String, LayerItem> mapLayers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new geo na data viewer profile.
|
||||||
|
*/
|
||||||
|
public GeoNaDataViewerProfile() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the portlet URL.
|
||||||
|
*
|
||||||
|
* @return the portlet URL
|
||||||
|
*/
|
||||||
|
public String getPortletURL() {
|
||||||
|
return portletURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the portlet URL.
|
||||||
|
*
|
||||||
|
* @param portletURL the new portlet URL
|
||||||
|
*/
|
||||||
|
public void setPortletURL(String portletURL) {
|
||||||
|
this.portletURL = portletURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the map layers.
|
||||||
|
*
|
||||||
|
* @return the map layers
|
||||||
|
*/
|
||||||
|
public Map<String, LayerItem> getMapLayers() {
|
||||||
|
return mapLayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the map layers.
|
||||||
|
*
|
||||||
|
* @param mapLayers the map layers
|
||||||
|
*/
|
||||||
|
public void setMapLayers(Map<String, LayerItem> mapLayers) {
|
||||||
|
this.mapLayers = mapLayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To string.
|
||||||
|
*
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "GeoNaDataViewerProfile [portletURL=" + portletURL + ", mapLayers=" + mapLayers + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -94,7 +94,7 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
private boolean isNcWms = false;
|
private boolean isNcWms = false;
|
||||||
|
|
||||||
/** The server wms request. */
|
/** The server wms request. */
|
||||||
public String serverWmsRequest;
|
public String wmsLink;
|
||||||
|
|
||||||
/** The cql filter available. */
|
/** The cql filter available. */
|
||||||
private boolean cqlFilterAvailable = false;
|
private boolean cqlFilterAvailable = false;
|
||||||
|
@ -759,21 +759,21 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the server wms request.
|
* Gets the wms link.
|
||||||
*
|
*
|
||||||
* @return the server wms request
|
* @return the wms link
|
||||||
*/
|
*/
|
||||||
public String getServerWmsRequest() {
|
public String getWmsLink() {
|
||||||
return serverWmsRequest;
|
return wmsLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the server wms request.
|
* Sets the wms link.
|
||||||
*
|
*
|
||||||
* @param serverWmsRequest the new server wms request
|
* @param wmsLink the new wms link
|
||||||
*/
|
*/
|
||||||
public void setServerWmsRequest(String serverWmsRequest) {
|
public void setWmsLink(String wmsLink) {
|
||||||
this.serverWmsRequest = serverWmsRequest;
|
this.wmsLink = wmsLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -848,11 +848,6 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
this.zAxisSelected = zAxisSelected;
|
this.zAxisSelected = zAxisSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* To string.
|
|
||||||
*
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
@ -904,8 +899,8 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
builder.append(wmsNotStandardParams);
|
builder.append(wmsNotStandardParams);
|
||||||
builder.append(", isNcWms=");
|
builder.append(", isNcWms=");
|
||||||
builder.append(isNcWms);
|
builder.append(isNcWms);
|
||||||
builder.append(", serverWmsRequest=");
|
builder.append(", wmsLink=");
|
||||||
builder.append(serverWmsRequest);
|
builder.append(wmsLink);
|
||||||
builder.append(", cqlFilterAvailable=");
|
builder.append(", cqlFilterAvailable=");
|
||||||
builder.append(cqlFilterAvailable);
|
builder.append(cqlFilterAvailable);
|
||||||
builder.append(", UUID=");
|
builder.append(", UUID=");
|
||||||
|
@ -918,4 +913,5 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue