gui_optimization_25461 #16

Merged
francesco.mangiacrapa merged 6 commits from gui_optimization_25461 into master 2023-09-05 15:16:50 +02:00
11 changed files with 115 additions and 88 deletions
Showing only changes of commit 8967184d3c - Show all commits

View File

@ -67,6 +67,7 @@
@ -157,6 +158,7 @@
@ -247,6 +249,7 @@
@ -337,6 +340,7 @@
@ -427,6 +431,7 @@
@ -449,6 +454,10 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<dependent-module archiveName="geoportal-data-common-2.2.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -607,6 +616,7 @@
@ -697,6 +707,7 @@
@ -787,6 +798,7 @@

View File

@ -515,7 +515,7 @@ public class LayerManager {
GWT.log("Parsed WMS Request returned: " + geoInfoWMS); GWT.log("Parsed WMS Request returned: " + geoInfoWMS);
LayerItem layerItem = toLayerItem(featureType, layerTitle, geoInfoWMS.getLayerName(), LayerItem layerItem = toLayerItem(featureType, layerTitle, geoInfoWMS.getLayerName(),
geoInfoWMS.getWmsRequest(), geoInfoWMS.getBaseWmsServiceHost(), true, isBase, geoInfoWMS.getWmsRequest(), geoInfoWMS.getServiceEndPoint(), true, isBase,
displayInLayerSwitcher, (ArrayList<String>) geoInfoWMS.getStyles().getGeoStyles(), displayInLayerSwitcher, (ArrayList<String>) geoInfoWMS.getStyles().getGeoStyles(),
geoInfoWMS.getWmsRequest(), false, geoInfoWMS.getMapWMSNoStandard(), geoInfoWMS.getWmsRequest(), false, geoInfoWMS.getMapWMSNoStandard(),
geoInfoWMS.isNcWMS(), UUID, geoInfoWMS.getZAxis(), minResolution, maxResolution); geoInfoWMS.isNcWMS(), UUID, geoInfoWMS.getZAxis(), minResolution, maxResolution);

View File

@ -439,7 +439,7 @@ public abstract class OpenLayerMap {
imageWMSParams.setLayers(layerItem.getName()); imageWMSParams.setLayers(layerItem.getName());
ImageWmsOptions imageWMSOptions = OLFactory.createOptions(); ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
imageWMSOptions.setUrl(layerItem.getMapServerHost()); imageWMSOptions.setUrl(layerItem.getMapServerEndpoint());
imageWMSOptions.setParams(imageWMSParams); imageWMSOptions.setParams(imageWMSParams);
// imageWMSOptions.setRatio(1.5f); // imageWMSOptions.setRatio(1.5f);
@ -544,7 +544,7 @@ public abstract class OpenLayerMap {
imageWMSParams.setLayers(layerItem.getName()); imageWMSParams.setLayers(layerItem.getName());
ImageWmsOptions imageWMSOptions = OLFactory.createOptions(); ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
imageWMSOptions.setUrl(layerItem.getMapServerHost()); imageWMSOptions.setUrl(layerItem.getMapServerEndpoint());
imageWMSOptions.setParams(imageWMSParams); imageWMSOptions.setParams(imageWMSParams);
// imageWMSOptions.setRatio(1.5f); // imageWMSOptions.setRatio(1.5f);
@ -595,7 +595,7 @@ public abstract class OpenLayerMap {
imageWMSParams.setLayers(layerItem.getName()); imageWMSParams.setLayers(layerItem.getName());
ImageWmsOptions imageWMSOptions = OLFactory.createOptions(); ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
imageWMSOptions.setUrl(layerItem.getMapServerHost()); imageWMSOptions.setUrl(layerItem.getMapServerEndpoint());
imageWMSOptions.setParams(imageWMSParams); imageWMSOptions.setParams(imageWMSParams);
// imageWMSOptions.setRatio(1.5f); // imageWMSOptions.setRatio(1.5f);

View File

@ -219,7 +219,7 @@ public class OverlayCustomLayerPanel extends Composite {
flow.add(new HTMLPanel("Legend for: " + theLayerName)); flow.add(new HTMLPanel("Legend for: " + theLayerName));
final HorizontalPanel hpLegend = new HorizontalPanel(); final HorizontalPanel hpLegend = new HorizontalPanel();
String url = geoInformation.getBaseWmsServiceHost() + "?service=WMS&" + "version=" String url = geoInformation.getServiceEndPoint() + "?service=WMS&" + "version="
+ URLUtil.getValueOfParameter("version", wmsLink) + "&" + "request=GetLegendGraphic&" + "layer=" + URLUtil.getValueOfParameter("version", wmsLink) + "&" + "request=GetLegendGraphic&" + "layer="
+ theLayerName; + theLayerName;

View File

@ -271,7 +271,7 @@ public class LayerCollectionPanel extends Composite {
flow.add(new HTMLPanel("Legend for: " + theLayerName)); flow.add(new HTMLPanel("Legend for: " + theLayerName));
final HorizontalPanel hpLegend = new HorizontalPanel(); final HorizontalPanel hpLegend = new HorizontalPanel();
String url = geoInformation.getBaseWmsServiceHost() + "?service=WMS&" + "version=" String url = geoInformation.getServiceEndPoint() + "?service=WMS&" + "version="
+ URLUtil.getValueOfParameter("version", wmsLink) + "&" + "request=GetLegendGraphic&" + "layer=" + URLUtil.getValueOfParameter("version", wmsLink) + "&" + "request=GetLegendGraphic&" + "layer="
+ theLayerName; + theLayerName;

View File

@ -65,6 +65,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclara
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV; import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView; import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap; import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.util.StringUtil;
import org.gcube.application.geoportalcommon.util.URLParserUtil; import org.gcube.application.geoportalcommon.util.URLParserUtil;
import org.gcube.application.geoportaldatamapper.GcubeProfilesPerUCDIdCache; import org.gcube.application.geoportaldatamapper.GcubeProfilesPerUCDIdCache;
import org.gcube.application.geoportaldatamapper.Geoportal_JSON_Mapper; import org.gcube.application.geoportaldatamapper.Geoportal_JSON_Mapper;
@ -262,7 +263,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
public GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName) throws Exception { public GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName) throws Exception {
try { try {
WMSUrlValidator validator = new WMSUrlValidator(wmsLink, layerName); WMSUrlValidator validator = new WMSUrlValidator(wmsLink, layerName);
String wmsServiceHost = validator.getWmsServiceHost(); String wmsServiceServiceEndpoint = validator.getWmsServiceEndPoint();
String validWMSRequest = validator.parseWMSRequest(true, true); String validWMSRequest = validator.parseWMSRequest(true, true);
layerName = validator.getLayerName(); layerName = validator.getLayerName();
String versionWms = validator.getValueOfParsedWMSParameter(WmsParameters.VERSION); String versionWms = validator.getValueOfParsedWMSParameter(WmsParameters.VERSION);
@ -289,7 +290,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
? new ZAxis(layerZAxis.getUnits(), layerZAxis.isPositive(), layerZAxis.getValues()) ? new ZAxis(layerZAxis.getUnits(), layerZAxis.isPositive(), layerZAxis.getValues())
: null; : null;
return new GeoInformationForWMSRequest(wmsServiceHost, validWMSRequest, layerName, versionWms, crs, return new GeoInformationForWMSRequest(wmsServiceServiceEndpoint, validWMSRequest, layerName, versionWms, crs,
mapWmsNotStandard, styles, styles.isNcWms(), zAxis); mapWmsNotStandard, styles, styles.isNcWms(), zAxis);
} catch (Exception e) { } catch (Exception e) {
String msg = "An error occurred during wms request validation for layer: " + layerName; String msg = "An error occurred during wms request validation for layer: " + layerName;
@ -705,7 +706,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
GCubeSDILayer indexLayer = index.getLayer(); GCubeSDILayer indexLayer = index.getLayer();
HashMap<String, String> ogcLinks = indexLayer.getOgcLinks(); HashMap<String, String> ogcLinks = indexLayer.getOgcLinks();
String wmsLink = ogcLinks.get("wms"); String wmsLink = ogcLinks.get("wms");
LOG.info("wms link is {}", wmsLink); LOG.info("wms link is {}", StringUtil.ellipsize(wmsLink, 150));
int lastCharOfthePath = wmsLink.indexOf("?"); int lastCharOfthePath = wmsLink.indexOf("?");
String wmsPath = wmsLink.substring(0, lastCharOfthePath); String wmsPath = wmsLink.substring(0, lastCharOfthePath);
for (GeoServerPlatformInfoDV geoserver : indexLayer.getPlatformInfos()) { for (GeoServerPlatformInfoDV geoserver : indexLayer.getPlatformInfos()) {
@ -715,7 +716,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
LOG.debug("purged wmsPath from the 'workspace' is {}", wmsPath); LOG.debug("purged wmsPath from the 'workspace' is {}", wmsPath);
wmsLink = wmsPath + wmsLink.substring(lastCharOfthePath, wmsLink.length()); wmsLink = wmsPath + wmsLink.substring(lastCharOfthePath, wmsLink.length());
ogcLinks.put("wms", wmsLink); ogcLinks.put("wms", wmsLink);
LOG.info("wms link without {} is {}", geoserver.getWorkspace(), wmsLink); LOG.info("wms link without {} is {}", geoserver.getWorkspace(), StringUtil.ellipsize(wmsLink, 150));
} }
} }
return index; return index;
@ -863,7 +864,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
*/ */
@Override @Override
protected void onBeforeRequestDeserialized(String serializedRequest) { protected void onBeforeRequestDeserialized(String serializedRequest) {
LOG.info("onBeforeRequestDeserialized called"); LOG.debug("onBeforeRequestDeserialized called");
String scope = ""; String scope = "";
try { try {

View File

@ -61,8 +61,8 @@ public class GisMakers {
public static String buildWFSFeatureQuery(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, public static String buildWFSFeatureQuery(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX,
int maxFeatures, String outputFormat) { int maxFeatures, String outputFormat) {
String link = layerItem.getMapServerHost(); String link = layerItem.getMapServerEndpoint();
LOG.debug("Map server host URL: " + link); LOG.debug("Map server endpoint: " + link);
LOG.debug("CQL filter is: " + layerItem.getCqlFilter()); LOG.debug("CQL filter is: " + layerItem.getCqlFilter());
LOG.debug("MAX FEATURES: " + maxFeatures); LOG.debug("MAX FEATURES: " + maxFeatures);
LOG.debug("BBOX: " + mapBBOX); LOG.debug("BBOX: " + mapBBOX);

View File

@ -24,7 +24,7 @@ public class WMSUrlValidator {
private static final String OWS = "ows"; private static final String OWS = "ows";
private HashMap<String, String> parametersValue = new HashMap<String, String>(); private HashMap<String, String> parametersValue = new HashMap<String, String>();
private String wmsRequestURI; private String wmsRequestURI;
private String wmsServiceHost; private String wmsServiceEndPoint;
private String layerName; private String layerName;
private String wmsNoStandardParameters = ""; private String wmsNoStandardParameters = "";
@ -48,34 +48,29 @@ public class WMSUrlValidator {
throw new Exception("WMS request is null or empty"); throw new Exception("WMS request is null or empty");
this.wmsRequestURI = wmsRequest.trim(); this.wmsRequestURI = wmsRequest.trim();
boolean isOwsService = GeoWmsServiceUtility.isOWSSerice(this.wmsRequestURI);
WebMapServerHost webMapServerHost;
// IS WMS?
if (GeoWmsServiceUtility.isWMSService(wmsRequestURI)) {
LOG.trace("found " + GeoWmsServiceUtility.SERVICE_WMS + " in wms request: " + wmsRequestURI);
webMapServerHost = getWebMapServerHost(wmsRequestURI);
} else
throw new Exception("WMS service not found for layer: " + inputLayerName);
// VALIDATION WMS // VALIDATION WMS
String baseWmsService = webMapServerHost.getHost(); int endpointLastCharIndex = wmsRequest.lastIndexOf("?");
// IS OWS OR WMS? // No '?' char found
this.wmsServiceHost = appendWmsServiceToBaseUrl(wmsRequest.substring(0, wmsRequest.indexOf("?")), isOwsService); if (endpointLastCharIndex == -1) {
this.layerName = inputLayerName; LOG.info("Char '?' not found, setting last index the end of the URI");
endpointLastCharIndex = wmsRequest.length();
}
String readWMSServiceEndpoint = wmsRequest.substring(0, endpointLastCharIndex);
this.wmsServiceEndPoint = readWMSServiceEndpoint;
try { try {
// VALIDATE WMS SERVICE FOR WEB MAP SERVER // VALIDATE WMS SERVICE FOR WEB MAP SERVER
if (!HttpRequestUtil.urlExists(this.wmsServiceHost, true)) { if (!HttpRequestUtil.urlExists(this.wmsServiceEndPoint, true)) {
LOG.info("baseWmsServiceUrl: " + wmsServiceHost LOG.warn("baseWmsServiceUrl: " + wmsServiceEndPoint + " is not valid URL!!");
+ " is not a geoserver, setting as input base wms server: " + baseWmsService); this.wmsServiceEndPoint = readWMSServiceEndpoint;
this.wmsServiceHost = baseWmsService;
} }
} catch (Exception e) { } catch (Exception e) {
LOG.error("error on validating geoserver wms service: " + e); LOG.error("Error on validating the endpoint: " + this.wmsServiceEndPoint, e);
LOG.info("setting baseWmsService as input base wms server: " + baseWmsService); boolean isOwsService = GeoWmsServiceUtility.isOWSSerice(this.wmsRequestURI);
this.wmsServiceHost = baseWmsService; LOG.info("Retrying by appending suffix WMS or WFS...");
this.wmsServiceEndPoint = appendWmsServiceToBaseUrl(readWMSServiceEndpoint, isOwsService);
} }
// VALIDATION FOR THREDDS - FIND LAYER NAME INTO WMS PATH // VALIDATION FOR THREDDS - FIND LAYER NAME INTO WMS PATH
@ -87,6 +82,7 @@ public class WMSUrlValidator {
} }
LOG.info("WMSURLValidator found endpoint: " + wmsServiceEndPoint);
parametersValue.put(WmsParameters.LAYERS.getParameter(), this.layerName); parametersValue.put(WmsParameters.LAYERS.getParameter(), this.layerName);
} }
@ -230,13 +226,13 @@ public class WMSUrlValidator {
} }
/** /**
* Gets the wms service host. * Gets the wms service end point.
* *
* @return the wms service host * @return the wms service end point
*/ */
public String getWmsServiceHost() { public String getWmsServiceEndPoint() {
return wmsServiceHost; return wmsServiceEndPoint;
} }
/** /**

View File

@ -36,7 +36,7 @@ public class LayerItem implements Serializable, Cloneable {
private String url; private String url;
/** The base map server URL. */ /** The base map server URL. */
private String mapServerHost; private String mapServerEndpoint;
/** The style. */ /** The style. */
private String style; private String style;
@ -774,21 +774,21 @@ public class LayerItem implements Serializable, Cloneable {
} }
/** /**
* Gets the map server host. * Gets the map server endpoint.
* *
* @return the map server host * @return the map server endpoint
*/ */
public String getMapServerHost() { public String getMapServerEndpoint() {
return mapServerHost; return mapServerEndpoint;
} }
/** /**
* Sets the map server host. * Sets the map server host.
* *
* @param mapServerHost the new map server host * @param mapServerEndpoint the new map server host
*/ */
public void setMapServerHost(String mapServerHost) { public void setMapServerHost(String mapServerEndpoint) {
this.mapServerHost = mapServerHost; this.mapServerEndpoint = mapServerEndpoint;
} }
/** /**
@ -881,6 +881,11 @@ public class LayerItem implements Serializable, Cloneable {
return maxResolution; return maxResolution;
} }
/**
* To string.
*
* @return the string
*/
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
@ -890,8 +895,8 @@ public class LayerItem implements Serializable, Cloneable {
builder.append(title); builder.append(title);
builder.append(", url="); builder.append(", url=");
builder.append(url); builder.append(url);
builder.append(", mapServerHost="); builder.append(", mapServerEndpoint=");
builder.append(mapServerHost); builder.append(mapServerEndpoint);
builder.append(", style="); builder.append(", style=");
builder.append(style); builder.append(style);
builder.append(", isTrasparent="); builder.append(", isTrasparent=");

View File

@ -15,8 +15,7 @@ public class GeoInformationForWMSRequest implements Serializable {
/** The Constant serialVersionUID. */ /** The Constant serialVersionUID. */
private static final long serialVersionUID = -6846636281073641003L; private static final long serialVersionUID = -6846636281073641003L;
/** The base wms service host. */ private String serviceEndPoint;
private String baseWmsServiceHost;
/** The wms request. */ /** The wms request. */
private String wmsRequest; private String wmsRequest;
@ -53,7 +52,7 @@ public class GeoInformationForWMSRequest implements Serializable {
/** /**
* Instantiates a new geo information for wms request. * Instantiates a new geo information for wms request.
* *
* @param baseWmsServiceHost the base wms service host * @param serviceEndPoint the base wms service host
* @param wmsRequest the wms request * @param wmsRequest the wms request
* @param layerName the layer name * @param layerName the layer name
* @param versionWms the version wms * @param versionWms the version wms
@ -63,10 +62,9 @@ public class GeoInformationForWMSRequest implements Serializable {
* @param isNcWMS the is nc WMS * @param isNcWMS the is nc WMS
* @param zAxis the z axis * @param zAxis the z axis
*/ */
public GeoInformationForWMSRequest(String baseWmsServiceHost, String wmsRequest, String layerName, public GeoInformationForWMSRequest(String serviceEndPoint, String wmsRequest, String layerName, String versionWms,
String versionWms, String crs, HashMap<String, String> mapWmsNoStandard, Styles styles, boolean isNcWMS, String crs, HashMap<String, String> mapWmsNoStandard, Styles styles, boolean isNcWMS, ZAxis zAxis) {
ZAxis zAxis) { this.serviceEndPoint = serviceEndPoint;
this.baseWmsServiceHost = baseWmsServiceHost;
this.wmsRequest = wmsRequest; this.wmsRequest = wmsRequest;
this.layerName = layerName; this.layerName = layerName;
this.versionWMS = versionWms; this.versionWMS = versionWms;
@ -98,13 +96,21 @@ public class GeoInformationForWMSRequest implements Serializable {
} }
/** /**
* Gets the base wms service host. * Gets the service end point.
* *
* @return the baseWmsServiceHost * @return the service end point
*/ */
public String getBaseWmsServiceHost() { public String getServiceEndPoint() {
return serviceEndPoint;
}
return baseWmsServiceHost; /**
* Sets the service end point.
*
* @param serviceEndPoint the new service end point
*/
public void setServiceEndPoint(String serviceEndPoint) {
this.serviceEndPoint = serviceEndPoint;
} }
/** /**
@ -180,11 +186,11 @@ public class GeoInformationForWMSRequest implements Serializable {
/** /**
* Sets the base wms service host. * Sets the base wms service host.
* *
* @param baseWmsServiceHost the baseWmsServiceHost to set * @param baseWmsServiceHost the new base wms service host
*/ */
public void setBaseWmsServiceHost(String baseWmsServiceHost) { public void setBaseWmsServiceHost(String baseWmsServiceHost) {
this.baseWmsServiceHost = baseWmsServiceHost; this.serviceEndPoint = baseWmsServiceHost;
} }
/** /**
@ -271,8 +277,8 @@ public class GeoInformationForWMSRequest implements Serializable {
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append("GeoInformationForWMSRequest [baseWmsServiceHost="); builder.append("GeoInformationForWMSRequest [serviceEndPoint=");
builder.append(baseWmsServiceHost); builder.append(serviceEndPoint);
builder.append(", wmsRequest="); builder.append(", wmsRequest=");
builder.append(wmsRequest); builder.append(wmsRequest);
builder.append(", layerName="); builder.append(", layerName=");

View File

@ -877,10 +877,14 @@ RESPONSIVE
.dand-layer { .dand-layer {
width: 336px; width: 336px;
} }
.search-facility {
width: 100%;
}
.thePopDataTable { .thePopDataTable {
}
.search-facility {
max-width: 680px;
}
.search-field {
width: 97%;
} }
.ol-popup { .ol-popup {
min-width: 220px; min-width: 220px;
@ -889,6 +893,9 @@ RESPONSIVE
.thePopDataTable tr:last-of-type { .thePopDataTable tr:last-of-type {
display: none; display: none;
} }
.layer-panel {
width: 355px;
}
} }
@media all and (max-width: 1024px) { @media all and (max-width: 1024px) {
#timeline-data { #timeline-data {
@ -900,8 +907,8 @@ RESPONSIVE
width: 400px; width: 400px;
} }
.search-facility { .search-facility {
width: 250px; /*width: 250px;
max-width: 300px; max-width: 300px;*/
} }
.inner-toolbar { .inner-toolbar {
/*width: 100px;*/ /*width: 100px;*/