From 5def7389c27d693392c565e449761ddb100632c1 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Wed, 9 Dec 2020 14:28:32 +0100 Subject: [PATCH] merged with branch 1.0.0-SNAPSHOT --- .classpath | 5 +- CHANGELOG.md | 2 +- README.md | 2 +- pom.xml | 2 +- .../client/gis/LightOpenLayerOSM.java | 8 ++- .../client/ui/images/ImageView.java | 10 ++++ .../client/ui/images/ImageView.ui.xml | 2 +- .../client/ui/images/ThumbnailImageView.java | 2 +- .../client/ui/map/MapView.java | 22 +++++--- .../concessioni/RelazioneScavoView.java | 2 +- .../server/ConvertToDataViewModel.java | 56 ++++++++++++++++++- src/main/webapp/GeoportalDataViewer.css | 12 ++-- 12 files changed, 101 insertions(+), 24 deletions(-) diff --git a/.classpath b/.classpath index 4247d22..2fe0d3a 100644 --- a/.classpath +++ b/.classpath @@ -13,15 +13,15 @@ + - - + @@ -35,5 +35,6 @@ + diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e91fbd..7ee8b58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,6 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [v1.0.0] - 2020-12-03 +## [v1.0.0] - 2020-12-09 [#20004] First release diff --git a/README.md b/README.md index 1b89764..76b58a0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # GeoPortal Data Viewer App -The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Gis GUI +The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Web-Map Interface ## Built With diff --git a/pom.xml b/pom.xml index edc0958..216fdc5 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ war 1.0.0 GeoPortal Data Viewer App - The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Gis GUI + The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Web-Map Interface diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/gis/LightOpenLayerOSM.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/gis/LightOpenLayerOSM.java index 7f8115e..5637774 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/gis/LightOpenLayerOSM.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/gis/LightOpenLayerOSM.java @@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client.gis; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants; import org.gcube.portlets.user.geoportaldataviewer.client.resources.Images; +import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE; @@ -173,13 +174,18 @@ import ol.style.TextOptions; * * @param mapServerHost the map server host * @param layerName the layer name + * @param bbox * @return the image */ - public Image addWMSLayer(String mapServerHost, String layerName) { + public Image addWMSLayer(String mapServerHost, String layerName, BoundsMap bbox) { GWT.log("Adding wmsLayer with mapServerHost: "+mapServerHost+", layerName: "+layerName); ImageWmsParams imageWMSParams = OLFactory.createOptions(); imageWMSParams.setLayers(layerName); + //imageWMSParams.setSize(new Size(400,400)); + //imageWMSParams.setVersion("1.1.0"); +// if(bbox!=null) +// imageWMSParams.set("BBOX", bbox.getLowerLeftX()+","+bbox.getLowerLeftY()+","+bbox.getUpperRightX()+","+bbox.getUpperRightY()); ImageWmsOptions imageWMSOptions = OLFactory.createOptions(); imageWMSOptions.setUrl(mapServerHost); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ImageView.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ImageView.java index 2a3202f..2b3b6ec 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ImageView.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ImageView.java @@ -13,6 +13,7 @@ import com.github.gwtbootstrap.client.ui.Paragraph; import com.github.gwtbootstrap.client.ui.constants.ButtonType; import com.github.gwtbootstrap.client.ui.constants.IconType; import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Style.TextAlign; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.uibinder.client.UiBinder; @@ -40,6 +41,9 @@ public class ImageView extends Composite { @UiField Paragraph paragraph1; + @UiField + Paragraph paragraph2; + @UiField Button openImage; @@ -54,6 +58,12 @@ public class ImageView extends Composite { heading.setText(imageDV.getTitolo()); paragraph1.setText(imageDV.getDidascalia()); + paragraph1.getElement().getStyle().setTextAlign(TextAlign.LEFT); + + if(!showView && imageDV.getLicenseID()!=null) { + paragraph2.setVisible(true); + paragraph2.setText("ID Licenza: "+imageDV.getLicenseID()); + } if(imageDV.getListWsContent()!=null && imageDV.getListWsContent().size()>0) { latest = imageDV.getListWsContent().get(imageDV.getListWsContent().size()-1); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ImageView.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ImageView.ui.xml index 41f977d..a38389e 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ImageView.ui.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ImageView.ui.xml @@ -21,7 +21,7 @@ - + diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ThumbnailImageView.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ThumbnailImageView.java index ff93e2f..9f45b7d 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ThumbnailImageView.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ThumbnailImageView.java @@ -45,7 +45,7 @@ public class ThumbnailImageView extends Composite { initWidget(uiBinder.createAndBindUi(this)); ImageView imageView = new ImageView(imageDV, showView, showOpen); - String title = StringUtil.ellipsize(imageDV.getTitolo(), 20); + String title = StringUtil.ellipsize(imageDV.getTitolo(), 25); imageView.setHeading(title); String didascalia = StringUtil.ellipsize(imageDV.getDidascalia(), 50); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/MapView.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/MapView.java index 2f71783..d3ad38e 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/MapView.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/MapView.java @@ -128,10 +128,12 @@ import ol.OLFactory; @Override public void execute() { - olsm.addWMSLayer(mapServerHost, layerName); - - if (bbox != null) { + ExtentWrapped ew = null; + BoundsMap theBBOX = bbox; + + if (bbox != null) { + Coordinate lower = OLFactory.createCoordinate(bbox.getLowerLeftX(), bbox.getLowerLeftY()); Coordinate lowerCoord = MapUtils.transformCoordiante(lower, GeoportalDataViewerConstants.EPSG_4326, @@ -141,12 +143,14 @@ import ol.OLFactory; Coordinate upperCoord = MapUtils.transformCoordiante(upper, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857); - ExtentWrapped ew = new ExtentWrapped(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(), upperCoord.getY()); - //Coordinate center = ew.getCenter(); - //GWT.log("center: "+center); - //Coordinate invertCoordinate = new Coordinate(center.getY(), center.getX()); -// Size size = new Size(300, 300); - //olsm.getMap().getView().setCenter(invertCoordinate); + ew = new ExtentWrapped(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(), upperCoord.getY()); + theBBOX = new BoundsMap(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(), upperCoord.getY(), null); + } + + olsm.addWMSLayer(mapServerHost, layerName, theBBOX); + + if (ew != null) { + olsm.getMap().getView().fit(ew); } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/concessioni/RelazioneScavoView.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/concessioni/RelazioneScavoView.java index 598eedc..d9eef04 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/concessioni/RelazioneScavoView.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/concessioni/RelazioneScavoView.java @@ -35,7 +35,7 @@ public class RelazioneScavoView extends Composite { abstractParagraph.setText(relazioneScavoDV.getAbstractSection()); //customTable.addNextKeyValue("Created", relazioneScavoDV.getCreationTime()); - customTable.addNextKeyValue("ID Licenza", relazioneScavoDV.getLicenseID()); + //customTable.addNextKeyValue("ID Licenza", relazioneScavoDV.getLicenseID()); customTable.addNextKeyValues("Responsabili", relazioneScavoDV.getResponsabili(), GeoportalDataViewerConstants.NEW_LINE_BR); relazioneScavoPanel.add(customTable); } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/ConvertToDataViewModel.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/ConvertToDataViewModel.java index abb5b05..236321b 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/ConvertToDataViewModel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/ConvertToDataViewModel.java @@ -306,10 +306,16 @@ public class ConvertToDataViewModel { String wmsLink = layerConcessione.getWmsLink(); String layerName = null; + BoundsMap bounds = null; //reading layer name from wmsLink + //string bbox if(wmsLink!=null) { layerName = URLParserUtil.extractValueOfParameterFromURL("layers", wmsLink); + String bbox = URLParserUtil.extractValueOfParameterFromURL("bbox", wmsLink); + String wmsVersion = URLParserUtil.extractValueOfParameterFromURL("version", wmsLink); + bounds = toBoundMap(wmsVersion, bbox, ","); + LOG.debug("Built bounds from wmsLInk: "+bounds); } if(layerName!=null) @@ -322,7 +328,10 @@ public class ConvertToDataViewModel { theLayerConessione.setLayerID(layerConcessione.getLayerID()); theLayerConessione.setLayerUUID(layerConcessione.getLayerUUID()); theLayerConessione.setAuthors(layerConcessione.getAuthors()); - BoundsMap bounds = toBoundMap(layerConcessione.getBbox()); + + if(bounds==null) + bounds = toBoundMap(layerConcessione.getBbox()); + theLayerConessione.setBbox(bounds); theLayerConessione.setCreationTime(toDateFormatString(layerConcessione.getCreationTime())); theLayerConessione.setId(layerConcessione.getId()); @@ -378,5 +387,50 @@ public class ConvertToDataViewModel { return new BoundsMap(bbox.getMinLong(), bbox.getMinLat(), bbox.getMaxLong(), bbox.getMaxLat(), null); } + + + /** + * To bound map. + * + * @param bbox the bbox + * @return the bounds map + */ + public static BoundsMap toBoundMap(String wmsVersion, String bbox, String separator) { + + if (bbox == null) + return null; + + if(wmsVersion==null) + return null; + + if(separator==null) + separator = ","; + + try { + + String[] bboxArr = bbox.split(separator); + + if(wmsVersion.startsWith("1.3")) { + //is 1.3.x + return new BoundsMap(toDouble(bboxArr[1]), toDouble(bboxArr[0]), toDouble(bboxArr[3]), toDouble(bboxArr[2]), wmsVersion); + }else { + //should be 1.1.X + return new BoundsMap(toDouble(bboxArr[0]), toDouble(bboxArr[1]), toDouble(bboxArr[2]), toDouble(bboxArr[3]), wmsVersion); + } + }catch (Exception e) { + LOG.warn("Error on creating Bounds for wmsVersion "+wmsVersion+" and bbox "+bbox+" : ",e); + return null; + } + } + + public static Double toDouble(String value) { + try { + return Double.parseDouble(value); + }catch (Exception e) { + LOG.warn("Error on parsing "+value+" as double: ",e); + return null; + } + } + } diff --git a/src/main/webapp/GeoportalDataViewer.css b/src/main/webapp/GeoportalDataViewer.css index f3f55f0..9eb0fc3 100644 --- a/src/main/webapp/GeoportalDataViewer.css +++ b/src/main/webapp/GeoportalDataViewer.css @@ -91,6 +91,7 @@ body { #page-view-details .page-header { margin-bottom: 22px; + padding-top: 5px; } @@ -107,14 +108,15 @@ body { } #page-view-details .my-custom-flex-table { - margin-left: 20px; - margin-right: 40px; + margin-left: 10px; + /*margin-right: 40px;*/ font-size: 13px; - max-width: 98%; + max-width: 95%; } #page-view-details .my-custom-flex-table td { - padding: 5px; + padding-top: 5px; + padding-bottom: 5px; } #page-view-details .my-custom-flex-table tbody tr>td:first-child { @@ -211,7 +213,7 @@ body { border: 1px solid #ddd; border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); - padding-right: 10px; + /*padding-right: 10px;*/ margin-bottom: 10px; width: 98%; }