Compare commits

...

5 Commits

19 changed files with 256 additions and 117 deletions

View File

@ -4,6 +4,6 @@
All notable changes to this project will be documented in this file. 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). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.0.0] - 2020-12-03 ## [v1.0.0-SNAPSHOT] - 2020-12-03
[#20004] First release [#20004] First release

View File

@ -14,7 +14,7 @@
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-viewer-app</artifactId> <artifactId>geoportal-data-viewer-app</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>1.0.0</version> <version>1.0.0-SNAPSHOT</version>
<name>GeoPortal Data Viewer App</name> <name>GeoPortal Data Viewer App</name>
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Gis GUI</description> <description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Gis GUI</description>
@ -128,25 +128,21 @@
<dependency> <dependency>
<groupId>org.gcube.resources.discovery</groupId> <groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId> <artifactId>ic-client</artifactId>
<!-- <version>[1.0.0, 2.0.0-SNAPSHOT)</version> -->
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.core</groupId> <groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId> <artifactId>common-scope-maps</artifactId>
<!-- <version>[1.1.0, 2.0.0-SNAPSHOT)</version> --> <scope>compile</scope>
<!-- <scope>compile</scope> -->
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.common.portal</groupId> <groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId> <artifactId>portal-manager</artifactId>
<!-- <version>[2.4.1,3.0.0-SNAPSHOT)</version> -->
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.dvos</groupId> <groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId> <artifactId>usermanagement-core</artifactId>
<!-- <version>[2.4.1,3.0.0-SNAPSHOT)</version> -->
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -249,8 +249,7 @@ public class GeoportalDataViewer implements EntryPoint {
@Override @Override
public void onLayerRendered(AddedLayerToMapEvent addedLayerToMapEvent) { public void onLayerRendered(AddedLayerToMapEvent addedLayerToMapEvent) {
GWT.log("Fired AddedLayerToMapEvent "+addedLayerToMapEvent.getLayerItem()); GWT.log("Fired AddedLayerToMapEvent "+addedLayerToMapEvent.getLayerItem());
GeoportalDataViewerConstants.print("Fired AddedLayerToMapEvent "+addedLayerToMapEvent.getLayerItem()); //GeoportalDataViewerConstants.print("Fired AddedLayerToMapEvent "+addedLayerToMapEvent.getLayerItem());
try { try {
@ -268,7 +267,7 @@ public class GeoportalDataViewer implements EntryPoint {
if(record!=null) { if(record!=null) {
this.cancel(); this.cancel();
GWT.log("cancelled timer"); GWT.log("cancelled timer");
performWFS(); performWFSQueryOnCentroid(record);
} }
if(attempt>MAX_RETRY) { if(attempt>MAX_RETRY) {
@ -285,22 +284,6 @@ public class GeoportalDataViewer implements EntryPoint {
// TODO: handle exception // TODO: handle exception
} }
// //the parameter gid has been passed in the query string
// if(paramGeonaItemID!=null && mainPanel.getDisplyedRecord()!=null) {
// RecordDV record = mainPanel.getDisplyedRecord();
// GWT.log("record instanceof ConcessioneDV: " +(record instanceof ConcessioneDV));
// GeoportalDataViewerConstants.print("record instanceof ConcessioneDV: " +(record instanceof ConcessioneDV));
// if(record instanceof ConcessioneDV) {
// ConcessioneDV concessioneDV = (ConcessioneDV) record;
// Double x = concessioneDV.getCentroidLong();
// Double y = concessioneDV.getCentroidLat();
// Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y), GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
// GeoQuery select = olMapMng.toDataPointQuery(transfCoord);
// GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
// layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, transfCoord, record.getId()));
// }
// }
} }
}); });
@ -326,20 +309,18 @@ public class GeoportalDataViewer implements EntryPoint {
} }
private void performWFS() { private void performWFSQueryOnCentroid(RecordDV record) {
//the parameter gid has been passed in the query string if(record!=null) {
if(mainPanel.getDisplyedRecord()!=null) {
RecordDV record = mainPanel.getDisplyedRecord();
GWT.log("record instanceof ConcessioneDV: " +(record instanceof ConcessioneDV)); GWT.log("record instanceof ConcessioneDV: " +(record instanceof ConcessioneDV));
GeoportalDataViewerConstants.print("record instanceof ConcessioneDV: " +(record instanceof ConcessioneDV)); //GeoportalDataViewerConstants.print("record instanceof ConcessioneDV: " +(record instanceof ConcessioneDV));
if(record instanceof ConcessioneDV) { if(record instanceof ConcessioneDV) {
ConcessioneDV concessioneDV = (ConcessioneDV) record; ConcessioneDV concessioneDV = (ConcessioneDV) record;
Double x = concessioneDV.getCentroidLong(); Double x = concessioneDV.getCentroidLong();
Double y = concessioneDV.getCentroidLat(); Double y = concessioneDV.getCentroidLat();
Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y), GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857); Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y), GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
GeoQuery select = olMapMng.toDataPointQuery(transfCoord); GeoQuery select = olMapMng.toDataPointQuery(transfCoord);
GeoportalDataViewerConstants.print("fireEvent QueryDataEvent"); //GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, transfCoord, record.getId())); layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, transfCoord, record.getId(), true));
} }
} }
} }

View File

@ -52,9 +52,9 @@ public class GeoportalDataViewerConstants {
* *
* @param msg the msg * @param msg the msg
*/ */
public static native void print(String msg)/*-{ // public static native void print(String msg)/*-{
console.log("js console: "+msg); // console.log("js console: "+msg);
}-*/; // }-*/;
} }

View File

@ -61,6 +61,8 @@ import ol.Coordinate;
*/ */
public class LayerManager { public class LayerManager {
/** The ol map. */ /** The ol map. */
private OpenLayerOSM olMap; private OpenLayerOSM olMap;
@ -90,7 +92,7 @@ public class LayerManager {
@Override @Override
public void onQueryInteraction(final QueryDataEvent queryEvent) { public void onQueryInteraction(final QueryDataEvent queryEvent) {
GeoportalDataViewerConstants.print("fired QueryDataEvent: "+queryEvent.toString()); //GeoportalDataViewerConstants.print("fired QueryDataEvent: "+queryEvent.toString());
if(queryEvent.getGeoQuery()!=null) { if(queryEvent.getGeoQuery()!=null) {
GeoQuery selectDataInfo = queryEvent.getGeoQuery(); GeoQuery selectDataInfo = queryEvent.getGeoQuery();
@ -136,21 +138,20 @@ public class LayerManager {
GWT.log("Bounds is: "+mapBBOX); GWT.log("Bounds is: "+mapBBOX);
GWT.log("MAX_WFS_FEATURES is: "+GeoportalDataViewerConstants.MAX_WFS_FEATURES); GWT.log("MAX_WFS_FEATURES is: "+GeoportalDataViewerConstants.MAX_WFS_FEATURES);
//GeoportalDataViewerConstants.print("calling getDataResult");
GeoportalDataViewerConstants.print("calling getDataResult");
GeoportalDataViewerServiceAsync.Util.getInstance().getDataResult(layerObjects, olMap.getProjectionCode(), mapBBOX, GeoportalDataViewerConstants.MAX_WFS_FEATURES, olMap.getCurrentZoomLevel(), new AsyncCallback<List<GeoNaSpatialQueryResult>>() { GeoportalDataViewerServiceAsync.Util.getInstance().getDataResult(layerObjects, olMap.getProjectionCode(), mapBBOX, GeoportalDataViewerConstants.MAX_WFS_FEATURES, olMap.getCurrentZoomLevel(), new AsyncCallback<List<GeoNaSpatialQueryResult>>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
GeoportalDataViewerConstants.print("on Failure DataResult: "+caught.getMessage()); //GeoportalDataViewerConstants.print("on Failure DataResult: "+caught.getMessage());
} }
@Override @Override
public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) { public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) {
GWT.log("GeoNaDataObject's: "+listGeonaDataObjects); GWT.log("GeoNaDataObject's: "+listGeonaDataObjects);
GeoportalDataViewerConstants.print("GeoNaDataObject's: "+listGeonaDataObjects); //GeoportalDataViewerConstants.print("GeoNaDataObject's: "+listGeonaDataObjects);
if(listGeonaDataObjects==null || listGeonaDataObjects.isEmpty()) if(listGeonaDataObjects==null || listGeonaDataObjects.isEmpty())
return; return;
@ -215,7 +216,7 @@ public class LayerManager {
} }
} }
GeoportalDataViewerConstants.print("0: "+nome); //GeoportalDataViewerConstants.print("0: "+nome);
flex.setHTML(0, 0, new HTML(nome).toString()); flex.setHTML(0, 0, new HTML(nome).toString());
try { try {
descrizione = StringUtil.ellipsize(descrizione, 100); descrizione = StringUtil.ellipsize(descrizione, 100);
@ -223,9 +224,10 @@ public class LayerManager {
} catch (Exception e) { } catch (Exception e) {
GWT.log("error: "+e.getMessage()); GWT.log("error: "+e.getMessage());
} }
GeoportalDataViewerConstants.print("1: "+descrizione); //GeoportalDataViewerConstants.print("1: "+descrizione);
flex.setText(1, 0, descrizione); flex.setText(1, 0, descrizione);
GeoportalDataViewerConstants.print("2: "+date); //GeoportalDataViewerConstants.print("2: "+date);
date = StringUtil.formatDate(date);
flex.setHTML(2, 0, new HTML("<code>"+date+"</code>").toString()); flex.setHTML(2, 0, new HTML("<code>"+date+"</code>").toString());
if(geoNaDataObject.getMapImages()!=null) { if(geoNaDataObject.getMapImages()!=null) {
@ -238,7 +240,7 @@ public class LayerManager {
WorkspaceContentDV wsContent = img.getListWsContent().get(img.getListWsContent().size()-1); WorkspaceContentDV wsContent = img.getListWsContent().get(img.getListWsContent().size()-1);
String theImgHTML = "<img src=\""+wsContent.getLink()+"\"></img>"; String theImgHTML = "<img src=\""+wsContent.getLink()+"\"></img>";
GWT.log("theImgHTML: "+theImgHTML); GWT.log("theImgHTML: "+theImgHTML);
GeoportalDataViewerConstants.print("The row are: "+flex.getRowCount()); //GeoportalDataViewerConstants.print("The row are: "+flex.getRowCount());
flex.setHTML(flex.getRowCount()+1, 0, theImgHTML); flex.setHTML(flex.getRowCount()+1, 0, theImgHTML);
} }
} }
@ -253,7 +255,7 @@ public class LayerManager {
return; return;
GWT.log("The selected Feature is: "+feature); GWT.log("The selected Feature is: "+feature);
GeoportalDataViewerConstants.print("The selected Feature is: "+feature); //GeoportalDataViewerConstants.print("The selected Feature is: "+feature);
FeatureRow theFeature = feature; FeatureRow theFeature = feature;
Button button = null; Button button = null;
if(!featureFound) { if(!featureFound) {
@ -293,8 +295,9 @@ public class LayerManager {
} }
} }
//fallback
if(centerTo==null) if(centerTo==null)
centerTo = queryEvent.getoLCoordinate(); centerTo = queryEvent.getOnFailureCenterTo();
olMap.showPopup(vpPanel.toString(), centerTo); olMap.showPopup(vpPanel.toString(), centerTo);

View File

@ -66,7 +66,7 @@ public class OLMapManager {
// } // }
GeoQuery select = toDataPointQuery(coordinate); GeoQuery select = toDataPointQuery(coordinate);
layerManagerBus.fireEvent(new QueryDataEvent(select, coordinate, null)); layerManagerBus.fireEvent(new QueryDataEvent(select, coordinate, null, true));
} }
@ -188,7 +188,7 @@ public class OLMapManager {
GWT.log("the distance is: " + dist); GWT.log("the distance is: " + dist);
if (dist > 5000 || startExt.containsExtent(endExt)) { if (dist > 5000 || startExt.containsExtent(endExt)) {
GeoQuery select = toDataBoxQuery(dragEndExtent); GeoQuery select = toDataBoxQuery(dragEndExtent);
layerManagerBus.fireEvent(new QueryDataEvent(select, endExt.getCenter(), null)); layerManagerBus.fireEvent(new QueryDataEvent(select, endExt.getCenter(), null, false));
} }
} }
else if(zoomStart!=null && zoomEnd!=null) { else if(zoomStart!=null && zoomEnd!=null) {

View File

@ -16,17 +16,24 @@ import ol.Coordinate;
public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> { public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
public static Type<QueryDataEventHandler> TYPE = new Type<QueryDataEventHandler>(); public static Type<QueryDataEventHandler> TYPE = new Type<QueryDataEventHandler>();
private GeoQuery select; private GeoQuery select;
private Coordinate oLCoordinate; private Coordinate onFailureCenterTo;
private Long recordId; private Long recordId;
private boolean onInit;
/** /**
* Instantiates a new table row selected event. * Instantiates a new query data event.
* @param coordinate *
* @param select the select
* @param onFailureCenterTo the on failure center to
* @param recordId the record id
* @param onInit the on init
*/ */
public QueryDataEvent(GeoQuery select, Coordinate coordinate, Long recordId) { public QueryDataEvent(GeoQuery select, Coordinate onFailureCenterTo, Long recordId, boolean onInit) {
this.select = select; this.select = select;
this.oLCoordinate = coordinate; this.onFailureCenterTo = onFailureCenterTo;
this.recordId = recordId; this.recordId = recordId;
this.onInit = onInit;
} }
/** /**
@ -49,6 +56,14 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
return recordId; return recordId;
} }
/**
* Checks if is on init.
*
* @return true, if is on init
*/
public boolean isOnInit() {
return onInit;
}
/** /**
* Dispatch. * Dispatch.
* *
@ -60,12 +75,18 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
} }
/**
* Gets the geo query.
*
* @return the geo query
*/
public GeoQuery getGeoQuery() { public GeoQuery getGeoQuery() {
return select; return select;
} }
public Coordinate getoLCoordinate() {
return oLCoordinate; public Coordinate getOnFailureCenterTo() {
return onFailureCenterTo;
} }
@Override @Override
@ -73,13 +94,19 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append("QueryDataEvent [select="); builder.append("QueryDataEvent [select=");
builder.append(select); builder.append(select);
builder.append(", oLCoordinate="); builder.append(", onFailureCenterTo=");
builder.append(oLCoordinate); builder.append(onFailureCenterTo);
builder.append(", recordId="); builder.append(", recordId=");
builder.append(recordId); builder.append(recordId);
builder.append(", onInit=");
builder.append(onInit);
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }
} }

View File

@ -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.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.Images; 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;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
@ -65,15 +66,12 @@ import ol.style.TextOptions;
private String markerURL = Images.ICONS.mapMarkerIcon().getURL(); private String markerURL = Images.ICONS.mapMarkerIcon().getURL();
/** /**
* Instantiates a new open layer OSM. * Instantiates a new light open layer OSM.
* *
* @param divTargetId the div target id * @param divTargetId the div target id
*/ */
/* (non-Javadoc)
* @see de.desjardins.ol3.demo.client.example.Example#show()
*/
public LightOpenLayerOSM(String divTargetId) { public LightOpenLayerOSM(String divTargetId) {
// create a OSM-layer // create a OSM-layer
@ -90,18 +88,10 @@ import ol.style.TextOptions;
Projection projection = new Projection(projectionOptions); Projection projection = new Projection(projectionOptions);
viewOptions.setProjection(projection); viewOptions.setProjection(projection);
viewOptions.setMaxZoom(19); viewOptions.setMaxZoom(20);
//viewOptions.setExtent(new Extent(-180, -90, 180, 90));
// create a view // create a view
view = new View(viewOptions); view = new View(viewOptions);
// //EPSG_4326_TO_ITALY
// Coordinate centerCoordinate = OLFactory.createCoordinate(12.45, 42.98);
// Coordinate transformedCenterCoordinate = Projection.transform(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
//
// view.setCenter(transformedCenterCoordinate);
// view.setZoom(5);
// create the map // create the map
MapOptions mapOptions = OLFactory.createOptions(); MapOptions mapOptions = OLFactory.createOptions();
@ -113,10 +103,6 @@ import ol.style.TextOptions;
map.addLayer(osmLayer); map.addLayer(osmLayer);
//map.addLayer(tileDebugLayer); //map.addLayer(tileDebugLayer);
// add some controls
// map.addControl(OLFactory.createScaleLine());
// DemoUtils.addDefaultControls(map.getControls());
Attribution attribution = new Attribution(); Attribution attribution = new Attribution();
attribution.setCollapsed(true); attribution.setCollapsed(true);
@ -177,7 +163,7 @@ import ol.style.TextOptions;
/** /**
* Sets the center. * Sets the center.
* *
* @param centerCoordinate the new center * @param zoom the new zoom
*/ */
public void setZoom(int zoom) { public void setZoom(int zoom) {
view.setZoom(zoom); view.setZoom(zoom);
@ -188,13 +174,18 @@ import ol.style.TextOptions;
* *
* @param mapServerHost the map server host * @param mapServerHost the map server host
* @param layerName the layer name * @param layerName the layer name
* @param bbox
* @return the image * @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); GWT.log("Adding wmsLayer with mapServerHost: "+mapServerHost+", layerName: "+layerName);
ImageWmsParams imageWMSParams = OLFactory.createOptions(); ImageWmsParams imageWMSParams = OLFactory.createOptions();
imageWMSParams.setLayers(layerName); 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 imageWMSOptions = OLFactory.createOptions();
imageWMSOptions.setUrl(mapServerHost); imageWMSOptions.setUrl(mapServerHost);

View File

@ -215,7 +215,7 @@ public abstract class OpenLayerOSM {
public void showPopup(String html, Coordinate coordinate) { public void showPopup(String html, Coordinate coordinate) {
GWT.log("Showing popup on: "+coordinate); GWT.log("Showing popup on: "+coordinate);
GeoportalDataViewerConstants.print("Showing popup on: "+coordinate); //GeoportalDataViewerConstants.print("Showing popup on: "+coordinate);
Element elPopup = DOM.getElementById("popup"); Element elPopup = DOM.getElementById("popup");
elPopup.getStyle().setVisibility(Visibility.VISIBLE); elPopup.getStyle().setVisibility(Visibility.VISIBLE);
if(popupOverlay==null) { if(popupOverlay==null) {

View File

@ -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.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType; import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT; 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.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiBinder;
@ -40,6 +41,9 @@ public class ImageView extends Composite {
@UiField @UiField
Paragraph paragraph1; Paragraph paragraph1;
@UiField
Paragraph paragraph2;
@UiField @UiField
Button openImage; Button openImage;
@ -54,6 +58,12 @@ public class ImageView extends Composite {
heading.setText(imageDV.getTitolo()); heading.setText(imageDV.getTitolo());
paragraph1.setText(imageDV.getDidascalia()); 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) { if(imageDV.getListWsContent()!=null && imageDV.getListWsContent().size()>0) {
latest = imageDV.getListWsContent().get(imageDV.getListWsContent().size()-1); latest = imageDV.getListWsContent().get(imageDV.getListWsContent().size()-1);

View File

@ -21,7 +21,7 @@
<b:Heading size="4" ui:field="heading"></b:Heading> <b:Heading size="4" ui:field="heading"></b:Heading>
<b:Paragraph ui:field="paragraph1"> <b:Paragraph ui:field="paragraph1">
</b:Paragraph> </b:Paragraph>
<b:Paragraph ui:field="paragraph2"> <b:Paragraph ui:field="paragraph2" visible="false">
</b:Paragraph> </b:Paragraph>
</b:Caption> </b:Caption>
</g:HTMLPanel> </g:HTMLPanel>

View File

@ -45,7 +45,7 @@ public class ThumbnailImageView extends Composite {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
ImageView imageView = new ImageView(imageDV, showView, showOpen); ImageView imageView = new ImageView(imageDV, showView, showOpen);
String title = StringUtil.ellipsize(imageDV.getTitolo(), 20); String title = StringUtil.ellipsize(imageDV.getTitolo(), 25);
imageView.setHeading(title); imageView.setHeading(title);
String didascalia = StringUtil.ellipsize(imageDV.getDidascalia(), 50); String didascalia = StringUtil.ellipsize(imageDV.getDidascalia(), 50);

View File

@ -128,9 +128,12 @@ import ol.OLFactory;
@Override @Override
public void execute() { public void execute() {
olsm.addWMSLayer(mapServerHost, layerName);
ExtentWrapped ew = null;
BoundsMap theBBOX = bbox;
if (bbox != null) { if (bbox != null) {
Coordinate lower = OLFactory.createCoordinate(bbox.getLowerLeftX(), bbox.getLowerLeftY()); Coordinate lower = OLFactory.createCoordinate(bbox.getLowerLeftX(), bbox.getLowerLeftY());
Coordinate lowerCoord = MapUtils.transformCoordiante(lower, GeoportalDataViewerConstants.EPSG_4326, Coordinate lowerCoord = MapUtils.transformCoordiante(lower, GeoportalDataViewerConstants.EPSG_4326,
@ -139,14 +142,15 @@ import ol.OLFactory;
Coordinate upper = OLFactory.createCoordinate(bbox.getUpperRightX(), bbox.getUpperRightY()); Coordinate upper = OLFactory.createCoordinate(bbox.getUpperRightX(), bbox.getUpperRightY());
Coordinate upperCoord = MapUtils.transformCoordiante(upper, GeoportalDataViewerConstants.EPSG_4326, Coordinate upperCoord = MapUtils.transformCoordiante(upper, GeoportalDataViewerConstants.EPSG_4326,
GeoportalDataViewerConstants.EPSG_3857); GeoportalDataViewerConstants.EPSG_3857);
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);
ExtentWrapped ew = new ExtentWrapped(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(), if (ew != null) {
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);
olsm.getMap().getView().fit(ew); olsm.getMap().getView().fit(ew);
} }

View File

@ -35,13 +35,14 @@ public class LayerConcessioneView extends Composite {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
GWT.log("Showing: "+layerDV); GWT.log("Showing: "+layerDV);
//customTable.addNextKeyValue("Created", relazioneScavoDV.getCreationTime()); customTable.addNextKeyValue("Abstract", layerDV.getAbstractSection());
customTable.addNextKeyValue("Valutazione qualità", layerDV.getValutazioneQualita()); customTable.addNextKeyValue("Valutazione qualità", layerDV.getValutazioneQualita());
customTable.addNextKeyValue("Metodo raccolta dati", layerDV.getMetodoRaccoltaDati()); customTable.addNextKeyValue("Metodo raccolta dati", layerDV.getMetodoRaccoltaDati());
customTable.addNextKeyValue("Scala acquisizione dati", layerDV.getScalaAcquisizione()); customTable.addNextKeyValue("Scala acquisizione dati", layerDV.getScalaAcquisizione());
customTable.addNextKeyValues("Autori", layerDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR); customTable.addNextKeyValues("Autori", layerDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR);
layerConcessionePanel.add(customTable); layerConcessionePanel.add(customTable);
GWT.log("WMS LINK: "+layerDV.getWmsLink());
if(layerDV.getLayerName()!=null && layerDV.getWmsLink()!=null) { if(layerDV.getLayerName()!=null && layerDV.getWmsLink()!=null) {
Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT); Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT);
Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857); Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);

View File

@ -35,7 +35,7 @@ public class RelazioneScavoView extends Composite {
abstractParagraph.setText(relazioneScavoDV.getAbstractSection()); abstractParagraph.setText(relazioneScavoDV.getAbstractSection());
//customTable.addNextKeyValue("Created", relazioneScavoDV.getCreationTime()); //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); customTable.addNextKeyValues("Responsabili", relazioneScavoDV.getResponsabili(), GeoportalDataViewerConstants.NEW_LINE_BR);
relazioneScavoPanel.add(customTable); relazioneScavoPanel.add(customTable);
} }

View File

@ -3,6 +3,10 @@
*/ */
package org.gcube.portlets.user.geoportaldataviewer.client.util; package org.gcube.portlets.user.geoportaldataviewer.client.util;
import java.util.Date;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.Window;
/** /**
* The Class StringUtil. * The Class StringUtil.
@ -12,6 +16,8 @@ package org.gcube.portlets.user.geoportaldataviewer.client.util;
* Nov 16, 2020 * Nov 16, 2020
*/ */
public class StringUtil { public class StringUtil {
private static final String NO_TIME = "_00-00-00";
/** /**
* Ellipsize. * Ellipsize.
@ -31,4 +37,27 @@ public class StringUtil {
return input.substring(0, maxCharacters)+"..."; return input.substring(0, maxCharacters)+"...";
} }
public static String formatDate(String date) {
if(date==null)
return date;
Date theDate = null;
try {
if(date.endsWith(NO_TIME)) {
date = date.replaceAll(NO_TIME, "");
theDate = DateTimeFormat.getFormat("yyyyMMdd").parse(date);
}else {
theDate = DateTimeFormat.getFormat("yyyyMMdd_HH-mm-ss").parse(date);
}
}catch (Exception e) {
Window.alert(e.toString());
}
if(theDate!=null) {
return DateTimeFormat.getFormat("dd-MM-yyyy").format(theDate);
}
return date;
}
} }

View File

@ -1,7 +1,7 @@
package org.gcube.portlets.user.geoportaldataviewer.server; package org.gcube.portlets.user.geoportaldataviewer.server;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatterBuilder; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -14,6 +14,7 @@ import org.gcube.application.geoportal.common.model.legacy.PersistedContent;
import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo; import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
import org.gcube.application.geoportal.common.model.legacy.UploadedImage; import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
import org.gcube.application.geoportal.common.model.legacy.WorkspaceContent; import org.gcube.application.geoportal.common.model.legacy.WorkspaceContent;
import org.gcube.portlets.user.geoportaldataviewer.server.util.URLParserUtil;
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.products.ConcessioneDV; import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.OtherContentDV; import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.OtherContentDV;
@ -33,17 +34,17 @@ import org.slf4j.LoggerFactory;
*/ */
public class ConvertToDataViewModel { public class ConvertToDataViewModel {
private static final String NO_TIME = "T00:00";
/** The Constant LOG. */ /** The Constant LOG. */
private static final Logger LOG = LoggerFactory.getLogger(ConvertToDataViewModel.class); private static final Logger LOG = LoggerFactory.getLogger(ConvertToDataViewModel.class);
public static final String DATE_FORMAT = "yyyy-MM-dd"; public static final String DATE_FORMAT = "dd-MM-yyyy";
public static final String HOURS_MINUTES_SEPARATOR = ":"; public static final String HOURS_MINUTES_SEPARATOR = ":";
public static final String TIME_FORMAT = "HH" + HOURS_MINUTES_SEPARATOR + "mm"; public static final String TIME_FORMAT = "HH" + HOURS_MINUTES_SEPARATOR + "mm";
public static final DateTimeFormatterBuilder dtf = new DateTimeFormatterBuilder()
.appendPattern(DATE_FORMAT + " " + TIME_FORMAT);
/** /**
* To concessione. * To concessione.
@ -66,10 +67,10 @@ public class ConvertToDataViewModel {
theConcessione.setCentroidLat(concessione.getCentroidLat()); theConcessione.setCentroidLat(concessione.getCentroidLat());
theConcessione.setCentroidLong(concessione.getCentroidLong()); theConcessione.setCentroidLong(concessione.getCentroidLong());
theConcessione.setContributore(concessione.getContributore()); theConcessione.setContributore(concessione.getContributore());
theConcessione.setCreationTime(toDateString(concessione.getCreationTime())); theConcessione.setCreationTime(toDateFormatString(concessione.getCreationTime()));
theConcessione.setCreationUser(toUser(concessione.getCreationUser())); theConcessione.setCreationUser(toUser(concessione.getCreationUser()));
theConcessione.setDataFineProgetto(toDateString(concessione.getDataFineProgetto())); theConcessione.setDataFineProgetto(toDateFormatString(concessione.getDataFineProgetto()));
theConcessione.setDataInizioProgetto(toDateString(concessione.getDataInizioProgetto())); theConcessione.setDataInizioProgetto(toDateFormatString(concessione.getDataInizioProgetto()));
theConcessione.setDescrizioneContenuto(concessione.getDescrizioneContenuto()); theConcessione.setDescrizioneContenuto(concessione.getDescrizioneContenuto());
theConcessione.setEditore(concessione.getEditore()); theConcessione.setEditore(concessione.getEditore());
theConcessione.setFontiFinanziamento(concessione.getFontiFinanziamento()); theConcessione.setFontiFinanziamento(concessione.getFontiFinanziamento());
@ -77,7 +78,7 @@ public class ConvertToDataViewModel {
theConcessione.setNome(concessione.getNome()); theConcessione.setNome(concessione.getNome());
theConcessione.setIntroduzione(concessione.getIntroduzione()); theConcessione.setIntroduzione(concessione.getIntroduzione());
theConcessione.setLastUpdateTime(toDateString(concessione.getLastUpdateTime())); theConcessione.setLastUpdateTime(toDateFormatString(concessione.getLastUpdateTime()));
theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser())); theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser()));
theConcessione.setLicenzaID(concessione.getLicenzaID()); theConcessione.setLicenzaID(concessione.getLicenzaID());
theConcessione.setNome(concessione.getNome()); theConcessione.setNome(concessione.getNome());
@ -172,11 +173,31 @@ public class ConvertToDataViewModel {
} }
public static String toDateString(LocalDateTime dateTime) { public static String toDateFormatString(LocalDateTime dateTime) {
if(dateTime==null) if(dateTime==null)
return null; return null;
String time = dateTime.toString();
DateTimeFormatter formatter = null;
try {
if(!time.endsWith(NO_TIME)) {
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT + " " + TIME_FORMAT);
}else {
time = time.replace(NO_TIME, "");
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT);
}
}catch (Exception e) {
LOG.warn("Parsing error: ",e);
}
try {
if(formatter!=null)
return dateTime.format(formatter);
}catch (Exception e) {
LOG.warn("Date format error: ",e);
}
return dateTime.toString(); return dateTime.toString();
} }
@ -194,7 +215,7 @@ public class ConvertToDataViewModel {
RelazioneScavoDV theRelazioneDiScavo = new RelazioneScavoDV(); RelazioneScavoDV theRelazioneDiScavo = new RelazioneScavoDV();
theRelazioneDiScavo.setAbstractSection(relazioneScavo.getAbstractSection()); theRelazioneDiScavo.setAbstractSection(relazioneScavo.getAbstractSection());
theRelazioneDiScavo.setCreationTime(toDateString(relazioneScavo.getCreationTime())); theRelazioneDiScavo.setCreationTime(toDateFormatString(relazioneScavo.getCreationTime()));
theRelazioneDiScavo.setId(relazioneScavo.getId()); theRelazioneDiScavo.setId(relazioneScavo.getId());
theRelazioneDiScavo.setLicenseID(relazioneScavo.getLicenseID()); theRelazioneDiScavo.setLicenseID(relazioneScavo.getLicenseID());
theRelazioneDiScavo.setPolicy(toPolicy(relazioneScavo.getPolicy())); theRelazioneDiScavo.setPolicy(toPolicy(relazioneScavo.getPolicy()));
@ -220,7 +241,7 @@ public class ConvertToDataViewModel {
return null; return null;
UploadedImageDV theUploadedImageDV = new UploadedImageDV(); UploadedImageDV theUploadedImageDV = new UploadedImageDV();
theUploadedImageDV.setCreationTime(toDateString(uploadedImage.getCreationTime())); theUploadedImageDV.setCreationTime(toDateFormatString(uploadedImage.getCreationTime()));
theUploadedImageDV.setDidascalia(uploadedImage.getDidascalia()); theUploadedImageDV.setDidascalia(uploadedImage.getDidascalia());
theUploadedImageDV.setFormat(uploadedImage.getFormat()); theUploadedImageDV.setFormat(uploadedImage.getFormat());
theUploadedImageDV.setId(uploadedImage.getId()); theUploadedImageDV.setId(uploadedImage.getId());
@ -279,15 +300,40 @@ public class ConvertToDataViewModel {
if (layerConcessione == null) if (layerConcessione == null)
return null; return null;
LOG.debug("Converting: "+layerConcessione);
LayerConcessioneDV theLayerConessione = new LayerConcessioneDV(); LayerConcessioneDV theLayerConessione = new LayerConcessioneDV();
theLayerConessione.setAbstractSection(layerConcessione.getAbstractSection()); theLayerConessione.setAbstractSection(layerConcessione.getAbstractSection());
theLayerConessione.setLayerName(layerConcessione.getLayerName());
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)
theLayerConessione.setLayerName(layerName);
else
theLayerConessione.setLayerName(layerConcessione.getLayerName());
theLayerConessione.setWmsLink(wmsLink);
theLayerConessione.setLayerID(layerConcessione.getLayerID()); theLayerConessione.setLayerID(layerConcessione.getLayerID());
theLayerConessione.setLayerUUID(layerConcessione.getLayerUUID()); theLayerConessione.setLayerUUID(layerConcessione.getLayerUUID());
theLayerConessione.setAuthors(layerConcessione.getAuthors()); theLayerConessione.setAuthors(layerConcessione.getAuthors());
BoundsMap bounds = toBoundMap(layerConcessione.getBbox());
if(bounds==null)
bounds = toBoundMap(layerConcessione.getBbox());
theLayerConessione.setBbox(bounds); theLayerConessione.setBbox(bounds);
theLayerConessione.setCreationTime(toDateString(layerConcessione.getCreationTime())); theLayerConessione.setCreationTime(toDateFormatString(layerConcessione.getCreationTime()));
theLayerConessione.setId(layerConcessione.getId()); theLayerConessione.setId(layerConcessione.getId());
theLayerConessione.setLicenseID(layerConcessione.getLicenseID()); theLayerConessione.setLicenseID(layerConcessione.getLicenseID());
theLayerConessione.setMetodoRaccoltaDati(layerConcessione.getMetodoRaccoltaDati()); theLayerConessione.setMetodoRaccoltaDati(layerConcessione.getMetodoRaccoltaDati());
@ -298,7 +344,7 @@ public class ConvertToDataViewModel {
theLayerConessione.setTitolo(layerConcessione.getTitolo()); theLayerConessione.setTitolo(layerConcessione.getTitolo());
theLayerConessione.setTopicCategory(layerConcessione.getTopicCategory()); theLayerConessione.setTopicCategory(layerConcessione.getTopicCategory());
theLayerConessione.setValutazioneQualita(layerConcessione.getValutazioneQualita()); theLayerConessione.setValutazioneQualita(layerConcessione.getValutazioneQualita());
theLayerConessione.setWmsLink(layerConcessione.getWmsLink());
LOG.debug("Returning: " + theLayerConessione); LOG.debug("Returning: " + theLayerConessione);
return theLayerConessione; return theLayerConessione;
@ -318,7 +364,7 @@ public class ConvertToDataViewModel {
return null; return null;
OtherContentDV theOtherContent = new OtherContentDV(); OtherContentDV theOtherContent = new OtherContentDV();
theOtherContent.setCreationTime(toDateString(otherContent.getCreationTime())); theOtherContent.setCreationTime(toDateFormatString(otherContent.getCreationTime()));
theOtherContent.setId(otherContent.getId()); theOtherContent.setId(otherContent.getId());
theOtherContent.setLicenseID(otherContent.getLicenseID()); theOtherContent.setLicenseID(otherContent.getLicenseID());
theOtherContent.setPolicy(toPolicy(otherContent.getPolicy())); theOtherContent.setPolicy(toPolicy(otherContent.getPolicy()));
@ -341,5 +387,50 @@ public class ConvertToDataViewModel {
return new BoundsMap(bbox.getMinLong(), bbox.getMinLat(), bbox.getMaxLong(), bbox.getMaxLat(), null); 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;
}
}
} }

View File

@ -124,6 +124,10 @@ public class LayerConcessioneDV extends SDILayerDescriptorDV implements IsSerial
builder.append(scalaAcquisizione); builder.append(scalaAcquisizione);
builder.append(", authors="); builder.append(", authors=");
builder.append(authors); builder.append(authors);
builder.append(", wmsLink=");
builder.append(super.getWmsLink());
builder.append(", layerName=");
builder.append(super.getLayerName());
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }

View File

@ -91,6 +91,7 @@ body {
#page-view-details .page-header { #page-view-details .page-header {
margin-bottom: 22px; margin-bottom: 22px;
padding-top: 5px;
} }
@ -107,14 +108,15 @@ body {
} }
#page-view-details .my-custom-flex-table { #page-view-details .my-custom-flex-table {
margin-left: 20px; margin-left: 10px;
margin-right: 40px; /*margin-right: 40px;*/
font-size: 13px; font-size: 13px;
max-width: 98%; max-width: 95%;
} }
#page-view-details .my-custom-flex-table td { #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 { #page-view-details .my-custom-flex-table tbody tr>td:first-child {
@ -211,7 +213,7 @@ body {
border: 1px solid #ddd; border: 1px solid #ddd;
border-radius: 4px; border-radius: 4px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
padding-right: 10px; /*padding-right: 10px;*/
margin-bottom: 10px; margin-bottom: 10px;
width: 98%; width: 98%;
} }