merged with branch 'task_20004'
parent
c5c6823587
commit
e6c32701c5
@ -1,4 +1,4 @@
|
||||
eclipse.preferences.version=1
|
||||
lastWarOutDir=/home/francesco/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-1.0.0-SNAPSHOT
|
||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-1.0.0-SNAPSHOT
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
||||
|
@ -0,0 +1,245 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
|
||||
import ol.Coordinate;
|
||||
import ol.MapBrowserEvent;
|
||||
import ol.MapEvent;
|
||||
import ol.OLFactory;
|
||||
|
||||
/**
|
||||
* The Class OLMapManager.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 19, 2020
|
||||
*/
|
||||
public class OLMapManager {
|
||||
|
||||
private String targetId;
|
||||
private HandlerManager layerManagerBus;
|
||||
private OpenLayerOSM olMap;
|
||||
private ol.Extent dragStartExtent = null;
|
||||
private Double zoomStart = null;
|
||||
private Double zoomEnd = null;
|
||||
private ol.Extent dragEndExtent = null;
|
||||
private static final int QUERY_MIN_ZOOM_LEVEL = 13;
|
||||
|
||||
/**
|
||||
* Instantiates a new OL map manager.
|
||||
*
|
||||
* @param targetId the target id
|
||||
* @param layerManagerBus the layer manager bus
|
||||
*/
|
||||
public OLMapManager(String targetId, HandlerManager layerManagerBus) {
|
||||
this.targetId = targetId;
|
||||
this.layerManagerBus = layerManagerBus;
|
||||
instanceOLMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instance OL map.
|
||||
*/
|
||||
public void instanceOLMap() {
|
||||
|
||||
olMap = new OpenLayerOSM(targetId, layerManagerBus) {
|
||||
|
||||
@Override
|
||||
public void clickListener(MapBrowserEvent event) {
|
||||
Coordinate coordinate = event.getCoordinate();
|
||||
if(!olMap.mapInstancied())
|
||||
return;
|
||||
|
||||
if (olMap.isQueryPointActive()) {
|
||||
GeoQuery select = toDataPointQuery(coordinate);
|
||||
layerManagerBus.fireEvent(new QueryDataEvent(select, coordinate));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveEndListener(MapEvent event) {
|
||||
//onInit
|
||||
if(!olMap.mapInstancied())
|
||||
return;
|
||||
|
||||
checkSelectQuery();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveStartListener(MapEvent event) {
|
||||
|
||||
//onInit
|
||||
if(!olMap.mapInstancied())
|
||||
return;
|
||||
|
||||
setDragStart();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mapZoomListener(MapEvent event) {
|
||||
|
||||
//onInit
|
||||
if(!olMap.mapInstancied())
|
||||
return;
|
||||
|
||||
setDragStart();
|
||||
zoomStart = olMap.getCurrentZoomLevel();
|
||||
GWT.log("zoomStart: "+zoomStart);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mapZoomEndListener(MapEvent event) {
|
||||
//onInit
|
||||
//onInit
|
||||
if(!olMap.mapInstancied())
|
||||
return;
|
||||
|
||||
setDragStart();
|
||||
zoomEnd = olMap.getCurrentZoomLevel();
|
||||
GWT.log("zoomEnd: "+zoomEnd);
|
||||
checkSelectQuery();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// EPSG_4326_TO_ITALY
|
||||
Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG,
|
||||
GeoportalDataViewerConstants.ITALY_CENTER_LAT);
|
||||
Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate,
|
||||
GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
||||
|
||||
olMap.setCenter(transformedCenterCoordinate);
|
||||
olMap.setZoom(GeoportalDataViewerConstants.ITALY_FIT_ZOOM_ON);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* To data point query.
|
||||
*
|
||||
* @param coordinate the coordinate
|
||||
* @return the geo query
|
||||
*/
|
||||
public GeoQuery toDataPointQuery(Coordinate coordinate) {
|
||||
|
||||
double lon = coordinate.getX();
|
||||
double lat = coordinate.getY();
|
||||
|
||||
int w = (int) olMap.getSize().getWidth();
|
||||
int h = (int) olMap.getSize().getHeight();
|
||||
// handler.clickOnMap(x, y, w, h);
|
||||
|
||||
// ratio - mapPixelWeight : bboxWeight = 20px : geoRectangleWidth
|
||||
// where 10px is the pixel diameter dimension of the clicked point
|
||||
double bboxWidth = Math.abs(olMap.getExtent().getLowerLeftX() - olMap.getExtent().getUpperRightX());
|
||||
double geoWidth = (bboxWidth / w) * (20 / 2);
|
||||
double x1 = Math.min(lon + geoWidth, lon - geoWidth);
|
||||
double x2 = Math.max(lon + geoWidth, lon - geoWidth);
|
||||
double y1 = Math.min(lat + geoWidth, lat - geoWidth);
|
||||
double y2 = Math.max(lat + geoWidth, lat - geoWidth);
|
||||
// GWT.log("("+x1+","+y1+")("+x2+","+y2+")");
|
||||
|
||||
// Point pt = new Point(coordinate);
|
||||
// ol.Extent extent = pt.getExtent();
|
||||
// //new ClickDataInfo(x1, y1, x2, y2)
|
||||
// SelectDataInfo selectDataInfo
|
||||
// selectBox(new GeoQuery(x1, y1, x2, y2, GeoQuery.TYPE.POINT));
|
||||
GeoQuery select = new GeoQuery(x1, y1, x2, y2, TYPE.POINT);
|
||||
return select;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the OLOSM map.
|
||||
*
|
||||
* @return the OLOSM map
|
||||
*/
|
||||
public OpenLayerOSM getOLOSMMap() {
|
||||
return olMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check select query.
|
||||
*/
|
||||
private void checkSelectQuery() {
|
||||
|
||||
GWT.log("Zoom is:" + olMap.getCurrentZoomLevel());
|
||||
|
||||
if (dragStartExtent != null && olMap.getCurrentZoomLevel() > QUERY_MIN_ZOOM_LEVEL) {
|
||||
dragEndExtent = olMap.getExtent();
|
||||
// GWT.log("Drag end is: "+dragEndExtent);
|
||||
ExtentWrapped startExt = new ExtentWrapped(dragStartExtent.getLowerLeftX(), dragStartExtent.getLowerLeftY(),
|
||||
dragStartExtent.getUpperRightX(), dragStartExtent.getUpperRightY());
|
||||
ExtentWrapped endExt = new ExtentWrapped(dragEndExtent.getLowerLeftX(), dragEndExtent.getLowerLeftY(),
|
||||
dragEndExtent.getUpperRightX(), dragEndExtent.getUpperRightY());
|
||||
// GWT.log("start Ext: "+startExt);
|
||||
// GWT.log("endExt Ext: "+endExt);
|
||||
long dist = MapUtils.distanceBetweenCentroid(startExt, endExt);
|
||||
GWT.log("the distance is: " + dist);
|
||||
if (dist > 5000 || startExt.containsExtent(endExt)) {
|
||||
GeoQuery select = toDataBoxQuery(dragEndExtent);
|
||||
layerManagerBus.fireEvent(new QueryDataEvent(select, endExt.getCenter()));
|
||||
}
|
||||
}
|
||||
else if(zoomStart!=null && zoomEnd!=null) {
|
||||
|
||||
if(zoomEnd<QUERY_MIN_ZOOM_LEVEL) {
|
||||
layerManagerBus.fireEvent(new ZoomOutOverMinimumEvent(zoomStart, zoomEnd, QUERY_MIN_ZOOM_LEVEL));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the drag start.
|
||||
*/
|
||||
private void setDragStart() {
|
||||
if (olMap.getCurrentZoomLevel() > QUERY_MIN_ZOOM_LEVEL) {
|
||||
dragStartExtent = olMap.getExtent();
|
||||
GWT.log("Drag Start is: " + dragStartExtent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To data point query.
|
||||
*
|
||||
* @param extent the extent
|
||||
* @return the geo query
|
||||
*/
|
||||
private GeoQuery toDataBoxQuery(ol.Extent extent) {
|
||||
|
||||
return new GeoQuery(extent.getLowerLeftX(), extent.getLowerLeftY(), extent.getUpperRightX(), extent.getUpperRightY(), TYPE.BOX);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if is query point active.
|
||||
*
|
||||
* @return true, if is query point active
|
||||
*/
|
||||
public boolean isQueryPointActive() {
|
||||
return olMap.isQueryPointActive();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide pop info.
|
||||
*/
|
||||
public void hidePopInfo() {
|
||||
olMap.hidePopup();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Class AddedLayerToMapEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 18, 2020
|
||||
*/
|
||||
public class AddedLayerToMapEvent extends GwtEvent<AddedLayerToMapEventHandler> {
|
||||
public static Type<AddedLayerToMapEventHandler> TYPE = new Type<AddedLayerToMapEventHandler>();
|
||||
private LayerItem layerItem;
|
||||
|
||||
/**
|
||||
* Instantiates a new added layer to map event.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
*/
|
||||
public AddedLayerToMapEvent(LayerItem layerItem) {
|
||||
this.layerItem = layerItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
@Override
|
||||
public Type<AddedLayerToMapEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(AddedLayerToMapEventHandler handler) {
|
||||
handler.onLayerRendered(this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the layer item.
|
||||
*
|
||||
* @return the layer item
|
||||
*/
|
||||
public LayerItem getLayerItem() {
|
||||
return layerItem;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
/**
|
||||
* The Interface AddedLayerToMapEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 18, 2020
|
||||
*/
|
||||
public interface AddedLayerToMapEventHandler extends EventHandler {
|
||||
/**
|
||||
* On layer rendered.
|
||||
*
|
||||
* @param addedLayerToMapEvent the added layer to map event
|
||||
*/
|
||||
void onLayerRendered(AddedLayerToMapEvent addedLayerToMapEvent);
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
/**
|
||||
* The Class ClosedViewDetailsEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 19, 2020
|
||||
*/
|
||||
public class ClosedViewDetailsEvent extends GwtEvent<ClosedViewDetailsEventHandler> {
|
||||
public static Type<ClosedViewDetailsEventHandler> TYPE = new Type<ClosedViewDetailsEventHandler>();
|
||||
|
||||
public ClosedViewDetailsEvent() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
@Override
|
||||
public Type<ClosedViewDetailsEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(ClosedViewDetailsEventHandler handler) {
|
||||
handler.onClosed(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
/**
|
||||
* The Interface ClosedViewDetailsEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 19, 2020
|
||||
*/
|
||||
public interface ClosedViewDetailsEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On closed.
|
||||
*
|
||||
* @param closedViewDetailsEvent the closed view details event
|
||||
*/
|
||||
void onClosed(ClosedViewDetailsEvent closedViewDetailsEvent);
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
/**
|
||||
* The Class ZoomOutEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 19, 2020
|
||||
*/
|
||||
public class ZoomOutOverMinimumEvent extends GwtEvent<ZoomOutOverMinimumEventHandler> {
|
||||
public static Type<ZoomOutOverMinimumEventHandler> TYPE = new Type<ZoomOutOverMinimumEventHandler>();
|
||||
private double startZoom;
|
||||
private double endZoom;
|
||||
private double minimum;
|
||||
|
||||
/**
|
||||
* Instantiates a new zoom out event.
|
||||
*
|
||||
* @param startZoom the start zoom
|
||||
* @param endZoom the end zoom
|
||||
* @param minimum the minimum
|
||||
*/
|
||||
public ZoomOutOverMinimumEvent(double startZoom, double endZoom, double minimum) {
|
||||
this.startZoom = startZoom;
|
||||
this.endZoom = endZoom;
|
||||
this.minimum = minimum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
@Override
|
||||
public Type<ZoomOutOverMinimumEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(ZoomOutOverMinimumEventHandler handler) {
|
||||
handler.onZoomOut(this);
|
||||
|
||||
}
|
||||
|
||||
public double getStartZoom() {
|
||||
return startZoom;
|
||||
}
|
||||
|
||||
public double getEndZoom() {
|
||||
return endZoom;
|
||||
}
|
||||
|
||||
public double getMinimum() {
|
||||
return minimum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
/**
|
||||
* The Interface ZoomOutEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 19, 2020
|
||||
*/
|
||||
public interface ZoomOutOverMinimumEventHandler extends EventHandler {
|
||||
|
||||
|
||||
/**
|
||||
* On zoom out.
|
||||
*
|
||||
* @param zoomOutEvent the zoom out event
|
||||
*/
|
||||
void onZoomOut(ZoomOutOverMinimumEvent zoomOutEvent);
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
|
||||
import com.google.gwt.dom.client.Document;
|
||||
import com.google.gwt.dom.client.LinkElement;
|
||||
import com.google.gwt.dom.client.Style.Display;
|
||||
import com.google.gwt.dom.client.Style.Overflow;
|
||||
import com.google.gwt.dom.client.Style.Position;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
|
||||
import ol.Collection;
|
||||
import ol.Coordinate;
|
||||
import ol.OLFactory;
|
||||
import ol.OLUtil;
|
||||
import ol.control.Control;
|
||||
import ol.control.ControlOptions;
|
||||
import ol.control.FullScreen;
|
||||
import ol.control.MousePosition;
|
||||
import ol.control.ZoomSlider;
|
||||
import ol.geom.Polygon;
|
||||
import ol.layer.Base;
|
||||
import ol.layer.LayerOptions;
|
||||
import ol.layer.Tile;
|
||||
import ol.source.Osm;
|
||||
import ol.source.XyzOptions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Tino Desjardins
|
||||
*
|
||||
*/
|
||||
public final class DemoUtils {
|
||||
|
||||
private DemoUtils() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates some default controls and adds it to the collection.
|
||||
*
|
||||
* @param controls collection with controls
|
||||
*/
|
||||
public static void addDefaultControls(final Collection<Control> controls) {
|
||||
|
||||
controls.push(new FullScreen());
|
||||
controls.push(new ZoomSlider());
|
||||
MousePosition mousePosition = new MousePosition();
|
||||
mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
|
||||
controls.push(mousePosition);
|
||||
//controls.push(new ZoomToExtent());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a MapBox logo.
|
||||
*
|
||||
* @return MapBox logo
|
||||
*/
|
||||
public static Control createMapboxLogo() {
|
||||
|
||||
ControlOptions controlOptions = new ControlOptions();
|
||||
|
||||
LinkElement mapboxLogo = Document.get().createLinkElement();
|
||||
mapboxLogo.setHref("https://mapbox.com/about/maps");
|
||||
mapboxLogo.setTarget("_blank");
|
||||
|
||||
mapboxLogo.getStyle().setPosition(Position.ABSOLUTE);
|
||||
mapboxLogo.getStyle().setLeft(2, Unit.PX);
|
||||
mapboxLogo.getStyle().setBottom(5, Unit.PX);
|
||||
mapboxLogo.getStyle().setWidth(126, Unit.PX);
|
||||
mapboxLogo.getStyle().setHeight(40, Unit.PX);
|
||||
mapboxLogo.getStyle().setDisplay(Display.BLOCK);
|
||||
mapboxLogo.getStyle().setOverflow(Overflow.HIDDEN);
|
||||
|
||||
mapboxLogo.getStyle().setBackgroundImage("url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAAAoCAMAAAAFWtJHAAAAwFBMVEUAAAAAAAAAAABtbW0AAAAAAAAAAAAAAAAAAAAAAAClpaUAAADp6ekAAAD5+fna2toAAAAMDAzv7+/Nzc0AAAA2Njb8/Pz9/f3T09MAAAAAAAD7+/sAAAArKyuxsbH39/fs7OwbGxuIiIjz8/N8fHyenp7u7u74+PgAAAC8vLxWVlbx8fF1dXXl5eVcXFyUlJTQ0NDFxcVCQkLAwMC4uLj19fXo6OjW1tarq6ve3t77+/vi4uL6+vrKysrNzc3///8w7gSSAAAAP3RSTlMAOQNdPSYBPywKexLLGPCxNEHXnzFL+v2nGwf1IEiE6dBFad9jd9PuLo1V2mDDV3Cjl06SiuXIq4C3973ym6BQMVUPAAAEXElEQVR4Ae2WCVP6OBiH05L0l1IqrVbkKHJ54I0oHn+PfP9vtUle0z/YdhbH2XVnd58ZnRJIeHiPJOx//mH4vQSAN+8FjAhFxgHIaPvJeZ99hxwEElon5iAQbj85Y98g8ODwjEOMAvGFyeE3FEKgodTBqj0BJGN9DhyNd5Ta3ean9QEopfaA+LsKhnEKRExqg4FSP6Og7oEkAjBWnxSCgBX4xF+kcLoPcOBQrSv0e5kH7s1j37jECQieCTPiFGxL5VHw2zQWCeeJiPt6kjRQw0XSkIdVChf67xGa4alSnZlT6HEQ8CK9ANbhvXUF9xlDkBfTuHDWScgC9+z5FQpPI12TlwC6+sV7ixR8CUMKiwjm2GQeOQWHMGuHGdbnObJAwCEqFJpNU5H6uaPUaEIKiQfg+PHk1+u4OwW9PlWW2ctbA4BHCtp+cNK+H8Jos4gDmC5ar4Nx9waaG/2B13NgDqS7+vm2RgEtEws82P+kwIHhs/pgkQKcFIhfd7CogtGNjYMHTLpurD0ERbYFw4JaD3GlQuNAL/JEsSAF4HqlCnaHACk4WhOn4OgCkMD5hSpYNYDJTD8Y46n+jsE1kPhVCuR6QBXhFK7MUOu9O6b1SWF3b+/9ZVWMGOlu93E8UDaAhgc7bfH+0DHqKXCkHzoNDFfU+zxiVQrUC9QXTuHYtKpN59OA3IxCG4b7jh6ZFuVockaNTW09mkJzOaPU49a6mE9cAchZpQJNpUWcwgV9r6FJswsFKrITp2B5pMBMdnS0z2HZNy2+BNKxSZxZfglkrFYBJxQnpzA5sN/HheR2aFQoZBLAi149dQoyAYYjW0hHlHguBAdMcR0DuDZ5omevX6+AI8qcU7ikKT3GBHCnXwydgmCC0tRwCnGQ2Wp6Be71yNIWfQSkOl9vAI1SBCNWrwC01RROgX7BuT2HI4r7tFAw086p/NwZEdOEa7R1uAFuNmQPuKAEAjYNQ0CyeoUEWHYBnpQVQgpvc0Ph+gsKlAnKg1+vEHsw5LKciLKCAJobiWBzYFGbCKpHqkZZrxBFHEASyFI59vJPCskcwNVGOWZAOqsrR+pKbaNeAMT1CixMEtlnsqopNxUMzVJT3tY35aXZm6a6Y9QhwMN6BUJWbE1lhbMO1WehkO7poO0sK7em9MJGxp1XSbC1gtugzzSLQmGsX7VntJGSwsPZ2d2z3bIPKzdoOp3Wzqt8G4XyMVUoFIxLx1S7+piaHtCvR3FeRVsq0GFdp9C5TbGpcNqsPqyHKxcfd14h21KhuLKUFU4f3osrC7F6uV3WXFnadL7wyAPeKDXw2RoJCO5GY4DouYvb/gepVXheLoewzPseQG9N/vzilrMIjoStE3++zvle4eSurw7XEe76ynI4aq+v7lEyt1x5awiFlFLQbHKIpabnM3eJLym4Szzzc/du7SU+zOXv9UNpECH7IoH/gecURPlN9vdQpeD47yhIFNX0U0QgvID9nENm+yxk/xb+AGAjNfRZuk9qAAAAAElFTkSuQmCC)");
|
||||
|
||||
controlOptions.setElement(mapboxLogo);
|
||||
|
||||
return new Control(controlOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a test polygon geometry (triangle).
|
||||
*
|
||||
* @return test polygon geometry (EPSG:3857)
|
||||
*/
|
||||
public static Polygon createTestPolygon() {
|
||||
|
||||
Coordinate[][] coordinates = new Coordinate[1][4];
|
||||
|
||||
Coordinate point1 = new Coordinate(13.36, 52.53);
|
||||
Coordinate point2 = new Coordinate(13.36, 52.51);
|
||||
Coordinate point3 = new Coordinate(13.37, 52.52);
|
||||
Coordinate point4 = new Coordinate(13.36, 52.53);
|
||||
|
||||
coordinates[0][0] = point1;
|
||||
coordinates[0][1] = point2;
|
||||
coordinates[0][2] = point3;
|
||||
coordinates[0][3] = point4;
|
||||
|
||||
Coordinate[][] tranformedCoordinates = new Coordinate[coordinates.length][];
|
||||
|
||||
tranformedCoordinates[0] = OLUtil.transform(coordinates[0], GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
||||
return OLFactory.createPolygon(tranformedCoordinates);
|
||||
|
||||
}
|
||||
|
||||
public static Base createOsmLayer() {
|
||||
XyzOptions osmSourceOptions = OLFactory.createOptions();
|
||||
|
||||
Osm osmSource = new Osm(osmSourceOptions);
|
||||
LayerOptions osmLayerOptions = OLFactory.createOptions();
|
||||
osmLayerOptions.setSource(osmSource);
|
||||
|
||||
return new Tile(osmLayerOptions);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
||||
|
||||
import jsinterop.annotations.JsMethod;
|
||||
import jsinterop.annotations.JsOverlay;
|
||||
import jsinterop.annotations.JsPackage;
|
||||
import jsinterop.annotations.JsType;
|
||||
import ol.Coordinate;
|
||||
import ol.Extent;
|
||||
|
||||
/**
|
||||
* The Class ExtentWrapped.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 11, 2020
|
||||
*/
|
||||
@JsType(isNative = true, name = "Array", namespace = JsPackage.GLOBAL)
|
||||
public class ExtentWrapped extends ol.Extent {
|
||||
|
||||
@JsOverlay
|
||||
private static final String PACKAGE_EXTENT = "ol.extent";
|
||||
|
||||
/**
|
||||
* Instantiates a new extent wrapped.
|
||||
*
|
||||
* @param minX the min X
|
||||
* @param minY the min Y
|
||||
* @param maxX the max X
|
||||
* @param maxY the max Y
|
||||
*/
|
||||
public ExtentWrapped(double minX, double minY, double maxX, double maxY) {
|
||||
super(minX, minY, maxX, maxY);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param coordinate coordinate to check.
|
||||
* @return true if the passed coordinate is contained or on the edge of the
|
||||
* extent.
|
||||
*/
|
||||
@JsOverlay
|
||||
public final Coordinate getCenter() {
|
||||
return getCenter((ol.Extent) this);
|
||||
}
|
||||
|
||||
@JsMethod(name = "getCenter", namespace = PACKAGE_EXTENT)
|
||||
private static native Coordinate getCenter(Extent extent);
|
||||
|
||||
}
|
@ -0,0 +1,338 @@
|
||||
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.GeoQuery;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
||||
import ol.Coordinate;
|
||||
import ol.Feature;
|
||||
import ol.Map;
|
||||
import ol.MapBrowserEvent;
|
||||
import ol.MapOptions;
|
||||
import ol.OLFactory;
|
||||
import ol.View;
|
||||
import ol.ViewOptions;
|
||||
import ol.control.Attribution;
|
||||
import ol.event.EventListener;
|
||||
import ol.geom.Point;
|
||||
import ol.interaction.KeyboardPan;
|
||||
import ol.interaction.KeyboardZoom;
|
||||
import ol.layer.Image;
|
||||
import ol.layer.LayerOptions;
|
||||
import ol.layer.Tile;
|
||||
import ol.layer.VectorLayerOptions;
|
||||
import ol.proj.Projection;
|
||||
import ol.proj.ProjectionOptions;
|
||||
import ol.source.ImageWms;
|
||||
import ol.source.ImageWmsOptions;
|
||||
import ol.source.ImageWmsParams;
|
||||
import ol.source.Osm;
|
||||
import ol.source.XyzOptions;
|
||||
import ol.style.Icon;
|
||||
import ol.style.IconOptions;
|
||||
import ol.style.Style;
|
||||
import ol.style.Text;
|
||||
import ol.style.TextOptions;
|
||||
|
||||
/**
|
||||
* The Class LightOpenLayerOSM.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 11, 2020
|
||||
*/
|
||||
public class LightOpenLayerOSM {
|
||||
|
||||
/** The map. */
|
||||
private Map map;
|
||||
|
||||
/** The view. */
|
||||
private View view;
|
||||
|
||||
/** The view options. */
|
||||
private ViewOptions viewOptions = OLFactory.createOptions();
|
||||
|
||||
/** The projection options. */
|
||||
private ProjectionOptions projectionOptions = OLFactory.createOptions();
|
||||
|
||||
private boolean isQueryPointActive;
|
||||
|
||||
private ol.layer.Vector geometryLayer;
|
||||
|
||||
private String markerURL = Images.ICONS.mapMarkerIcon().getURL();
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new open layer OSM.
|
||||
*
|
||||
* @param divTargetId the div target id
|
||||
*/
|
||||
/* (non-Javadoc)
|
||||
* @see de.desjardins.ol3.demo.client.example.Example#show()
|
||||
*/
|
||||
public LightOpenLayerOSM(String divTargetId) {
|
||||
|
||||
// create a OSM-layer
|
||||
XyzOptions osmSourceOptions = OLFactory.createOptions();
|
||||
|
||||
Osm osmSource = new Osm(osmSourceOptions);
|
||||
LayerOptions osmLayerOptions = OLFactory.createOptions();
|
||||
osmLayerOptions.setSource(osmSource);
|
||||
|
||||
Tile osmLayer = new Tile(osmLayerOptions);
|
||||
// create a projection
|
||||
projectionOptions.setCode(GeoportalDataViewerConstants.EPSG_3857);
|
||||
projectionOptions.setUnits("m");
|
||||
|
||||
Projection projection = new Projection(projectionOptions);
|
||||
viewOptions.setProjection(projection);
|
||||
viewOptions.setMaxZoom(19);
|
||||
//viewOptions.setExtent(new Extent(-180, -90, 180, 90));
|
||||
|
||||
// create a view
|
||||
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
|
||||
MapOptions mapOptions = OLFactory.createOptions();
|
||||
mapOptions.setTarget(divTargetId);
|
||||
mapOptions.setView(view);
|
||||
|
||||
map = new Map(mapOptions);
|
||||
|
||||
map.addLayer(osmLayer);
|
||||
//map.addLayer(tileDebugLayer);
|
||||
|
||||
// add some controls
|
||||
// map.addControl(OLFactory.createScaleLine());
|
||||
// DemoUtils.addDefaultControls(map.getControls());
|
||||
|
||||
Attribution attribution = new Attribution();
|
||||
attribution.setCollapsed(true);
|
||||
|
||||
map.addClickListener(new EventListener<MapBrowserEvent>() {
|
||||
|
||||
@Override
|
||||
public void onEvent(MapBrowserEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
Coordinate coordinate = event.getCoordinate();
|
||||
if(isQueryPointActive) {
|
||||
|
||||
double lon = coordinate.getX();
|
||||
double lat = coordinate.getY();
|
||||
|
||||
int w = (int) map.getSize().getWidth();
|
||||
int h = (int) map.getSize().getHeight();
|
||||
// handler.clickOnMap(x, y, w, h);
|
||||
|
||||
// ratio - mapPixelWeight : bboxWeight = 10px : geoRectangleWidth
|
||||
// where 10px is the pixel diameter dimension of the clicked point
|
||||
double bboxWidth = Math.abs(getExtent().getLowerLeftX() - getExtent().getUpperRightX());
|
||||
double geoWidth = (bboxWidth / w) * (20 / 2);
|
||||
double x1 = Math.min(lon+geoWidth, lon-geoWidth);
|
||||
double x2 = Math.max(lon+geoWidth, lon-geoWidth);
|
||||
double y1 = Math.min(lat+geoWidth, lat-geoWidth);
|
||||
double y2 = Math.max(lat+geoWidth, lat-geoWidth);
|
||||
//GWT.log("("+x1+","+y1+")("+x2+","+y2+")");
|
||||
|
||||
// Point pt = new Point(coordinate);
|
||||
// ol.Extent extent = pt.getExtent();
|
||||
// //new ClickDataInfo(x1, y1, x2, y2)
|
||||
// SelectDataInfo selectDataInfo
|
||||
//selectBox(new GeoQuery(x1, y1, x2, y2, GeoQuery.TYPE.POINT));
|
||||
GeoQuery select = new GeoQuery(x1, y1, x2, y2, TYPE.POINT);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
map.addControl(attribution);
|
||||
|
||||
// add some interactions
|
||||
map.addInteraction(new KeyboardPan());
|
||||
map.addInteraction(new KeyboardZoom());
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the center.
|
||||
*
|
||||
* @param centerCoordinate the new center
|
||||
*/
|
||||
public void setCenter(Coordinate centerCoordinate) {
|
||||
view.setCenter(centerCoordinate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the center.
|
||||
*
|
||||
* @param centerCoordinate the new center
|
||||
*/
|
||||
public void setZoom(int zoom) {
|
||||
view.setZoom(zoom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the WMS layer.
|
||||
*
|
||||
* @param mapServerHost the map server host
|
||||
* @param layerName the layer name
|
||||
* @return the image
|
||||
*/
|
||||
public Image addWMSLayer(String mapServerHost, String layerName) {
|
||||
GWT.log("Adding wmsLayer with mapServerHost: "+mapServerHost+", layerName: "+layerName);
|
||||
|
||||
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||
imageWMSParams.setLayers(layerName);
|
||||
|
||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||
imageWMSOptions.setUrl(mapServerHost);
|
||||
imageWMSOptions.setParams(imageWMSParams);
|
||||
//imageWMSOptions.setRatio(1.5f);
|
||||
|
||||
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
|
||||
|
||||
LayerOptions layerOptions = OLFactory.createOptions();
|
||||
layerOptions.setSource(imageWMSSource);
|
||||
|
||||
ol.layer.Image wmsLayer = new ol.layer.Image(layerOptions);
|
||||
//visibleLayerItems
|
||||
map.addLayer(wmsLayer);
|
||||
|
||||
return wmsLayer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the first layer.
|
||||
*
|
||||
* @return the first layer
|
||||
*/
|
||||
public Image getFirstLayer() {
|
||||
if(map.getLayers()!=null) {
|
||||
return (Image) map.getLayers().getArray()[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the point.
|
||||
*
|
||||
* @param coordinate the coordinate
|
||||
* @param showCoordinateText the show coordinate text
|
||||
* @param asMarker the as marker
|
||||
*/
|
||||
public void addPoint(Coordinate coordinate, boolean showCoordinateText, boolean asMarker) {
|
||||
|
||||
if(geometryLayer!=null) {
|
||||
map.removeLayer(geometryLayer);
|
||||
}else {
|
||||
|
||||
}
|
||||
Style style = new Style();
|
||||
|
||||
if(asMarker) {
|
||||
IconOptions iconOptions = new IconOptions();
|
||||
iconOptions.setSrc(markerURL);
|
||||
Icon icon = new Icon(iconOptions);
|
||||
style.setImage(icon);
|
||||
}
|
||||
|
||||
if(showCoordinateText) {
|
||||
TextOptions textOptions = new TextOptions();
|
||||
textOptions.setOffsetY(-25);
|
||||
// StrokeOptions strokeOptions = new StrokeOptions();
|
||||
// strokeOptions.setColor(new Color(0, 0, 255, 0.0));
|
||||
// strokeOptions.setWidth(4);
|
||||
// Stroke stroke = new Stroke(strokeOptions);
|
||||
// textOptions.setStroke(stroke);
|
||||
// FillOptions fillOptions = new FillOptions();
|
||||
// fillOptions.setColor(new Color(0, 0, 0, 0.0));
|
||||
// textOptions.setFill(new Fill(fillOptions));
|
||||
|
||||
Coordinate transfCoord = MapUtils.transformCoordiante(coordinate, GeoportalDataViewerConstants.EPSG_3857, GeoportalDataViewerConstants.EPSG_4326);
|
||||
textOptions.setText("Long: "+transfCoord.getX() + ", Lat: "+transfCoord.getY());
|
||||
|
||||
|
||||
Text text = new Text(textOptions);
|
||||
// FillOptions fillOptions = new FillOptions();
|
||||
// Color color = new Color(217, 217, 223, 0.0);
|
||||
// fillOptions.setColor(color);
|
||||
// Fill fill = new Fill(fillOptions);
|
||||
// style.setFill(fill);
|
||||
style.setText(text);
|
||||
|
||||
|
||||
}
|
||||
Point thePoint = new Point(coordinate);
|
||||
Feature vf = new Feature(thePoint);
|
||||
vf.setStyle(style);
|
||||
ol.source.Vector vector = new ol.source.Vector();
|
||||
vector.addFeature(vf);
|
||||
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
||||
vectorLayerOptions.setSource(vector);
|
||||
geometryLayer = new ol.layer.Vector(vectorLayerOptions);
|
||||
map.addLayer(geometryLayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the map.
|
||||
*
|
||||
* @return the map
|
||||
*/
|
||||
public Map getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the projection code.
|
||||
*
|
||||
* @return the projection code
|
||||
*/
|
||||
public String getProjectionCode() {
|
||||
return map.getView().getProjection().getCode();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the current zoom level.
|
||||
*
|
||||
* @return the current zoom level
|
||||
*/
|
||||
public double getCurrentZoomLevel() {
|
||||
return map.getView().getZoom();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the bbox.
|
||||
*
|
||||
* @return the bbox
|
||||
*/
|
||||
public ol.Extent getBBOX() {
|
||||
return getExtent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the extent.
|
||||
*
|
||||
* @return the extent
|
||||
*/
|
||||
public ol.Extent getExtent() {
|
||||
return this.map.getView().calculateExtent(map.getSize());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,93 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
||||
|
||||
import ol.Collection;
|
||||
import ol.Coordinate;
|
||||
import ol.control.Control;
|
||||
import ol.control.FullScreen;
|
||||
import ol.control.MousePosition;
|
||||
import ol.control.ZoomSlider;
|
||||
import ol.geom.LineString;
|
||||
import ol.proj.Projection;
|
||||
|
||||
|
||||
/**
|
||||
* The Class MapUtils.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 12, 2020
|
||||
*/
|
||||
public final class MapUtils {
|
||||
|
||||
|
||||
/**
|
||||
* Creates some default controls and adds it to the collection.
|
||||
*
|
||||
* @param controls collection with controls
|
||||
*/
|
||||
public static void addDefaultControls(final Collection<Control> controls) {
|
||||
|
||||
controls.push(new FullScreen());
|
||||
controls.push(new ZoomSlider());
|
||||
MousePosition mousePosition = new MousePosition();
|
||||
mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
|
||||
controls.push(mousePosition);
|
||||
//controls.push(new ZoomToExtent());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform coordiante.
|
||||
*
|
||||
* @param centerCoordinate the center coordinate
|
||||
* @param source the source
|
||||
* @param target the target
|
||||
* @return the coordinate
|
||||
*/
|
||||
public static Coordinate transformCoordiante(Coordinate centerCoordinate, String source, String target) {
|
||||
return Projection.transform(centerCoordinate, source, target);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Distance between centroid.
|
||||
*
|
||||
* @param ex1 the ex 1
|
||||
* @param ex2 the ex 2
|
||||
* @return the long
|
||||
*/
|
||||
public static long distanceBetweenCentroid(ExtentWrapped ex1, ExtentWrapped ex2) {
|
||||
return distanceBetween(ex1.getCenter(),ex2.getCenter());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Distance between.
|
||||
*
|
||||
* @param c1 the c 1
|
||||
* @param c2 the c 2
|
||||
* @return the long
|
||||
*/
|
||||
public static long distanceBetween(Coordinate c1, Coordinate c2) {
|
||||
|
||||
Coordinate[] arrayCoordinate = new Coordinate[2];
|
||||
arrayCoordinate[0] = c1;
|
||||
arrayCoordinate[1] = c2;
|
||||
|
||||
LineString ls = new LineString(arrayCoordinate);
|
||||
// GWT.log("Line length is: "+ls);
|
||||
return Math.round(ls.getLength() * 100) / 100;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse coordinate.
|
||||
*
|
||||
* @param coord the coord
|
||||
* @return the coordinate
|
||||
*/
|
||||
public static Coordinate reverseCoordinate(Coordinate coord){
|
||||
return new Coordinate(coord.getY(), coord.getX());
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 731 B |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1,88 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni.ConcessioneView;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordDV;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
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.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class DetailsPanel extends Composite {
|
||||
|
||||
private static DetailsPanelUiBinder uiBinder = GWT.create(DetailsPanelUiBinder.class);
|
||||
|
||||
@UiField
|
||||
Button closeButton;
|
||||
|
||||
@UiField
|
||||
HTMLPanel datailsContainerPanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel detailsHTMLPanel;
|
||||
|
||||
private RecordDV displayedRecord = null;
|
||||
|
||||
private HandlerManager applicationBus;
|
||||
|
||||
interface DetailsPanelUiBinder extends UiBinder<Widget, DetailsPanel> {
|
||||
}
|
||||
|
||||
|
||||
public DetailsPanel() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
closeButton.setType(ButtonType.LINK);
|
||||
closeButton.setIcon(IconType.REMOVE_SIGN);
|
||||
|
||||
closeButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
hidePanelDetails();
|
||||
applicationBus.fireEvent(new ClosedViewDetailsEvent());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setApplicationBus(HandlerManager applicationBus) {
|
||||
this.applicationBus = applicationBus;
|
||||
}
|
||||
|
||||
|
||||
public void showDetailsFor(ConcessioneDV cdv, GeoNaItemRef geonaItemRef) {
|
||||
this.displayedRecord = cdv;
|
||||
datailsContainerPanel.clear();
|
||||
if(detailsHTMLPanel.getParent()!=null)
|
||||
detailsHTMLPanel.getParent().getElement().setScrollTop(0);
|
||||
|
||||
datailsContainerPanel.add(new ConcessioneView(geonaItemRef, cdv));
|
||||
showPanelDetails();
|
||||
}
|
||||
|
||||
private void showPanelDetails() {
|
||||
detailsHTMLPanel.setVisible(true);
|
||||
}
|
||||
|
||||
public void hidePanelDetails() {
|
||||
this.displayedRecord = null;
|
||||
datailsContainerPanel.clear();
|
||||
detailsHTMLPanel.setVisible(false);
|
||||
}
|
||||
|
||||
public RecordDV getDisplayedRecord() {
|
||||
return displayedRecord;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
.to-align-right{
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="detailsHTMLPanel" visible="false">
|
||||
<b:Button ui:field="closeButton" addStyleNames="{style.to-align-right}"></b:Button>
|
||||
<g:HTMLPanel ui:field="datailsContainerPanel"></g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,474 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs;
|
||||
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.PublicLink;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.Fieldset;
|
||||
import com.github.gwtbootstrap.client.ui.Modal;
|
||||
import com.github.gwtbootstrap.client.ui.ModalFooter;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.Tooltip;
|
||||
import com.github.gwtbootstrap.client.ui.constants.VisibilityChange;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.MouseOverEvent;
|
||||
import com.google.gwt.event.dom.client.MouseOverHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Random;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* The Class DialogShareableLink.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Sep 19, 2019
|
||||
*/
|
||||
public class DialogShareableLink extends Composite {
|
||||
|
||||
private static DialogShareableLinkUiBinder uiBinder = GWT.create(DialogShareableLinkUiBinder.class);
|
||||
|
||||
private Modal modalBox = new Modal();
|
||||
|
||||
@UiField
|
||||
ControlGroup cgPublicLink;
|
||||
|
||||
@UiField
|
||||
ControlGroup cgPrivateLongLink;
|
||||
|
||||
@UiField
|
||||
ControlGroup cgPublicLongLink;
|
||||
|
||||
@UiField
|
||||
TextBox textPublicLink;
|
||||
|
||||
@UiField
|
||||
TextBox textPrivateLink;
|
||||
|
||||
@UiField
|
||||
TextBox textPrivateLongLink;
|
||||
|
||||
@UiField
|
||||
TextBox textPublicLongLink;
|
||||
|
||||
@UiField
|
||||
Alert errorAlert;
|
||||
|
||||
@UiField
|
||||
Alert actionAlert;
|
||||
|
||||
// @UiField
|
||||
// Well alertFilePublicLink;
|
||||
|
||||
@UiField
|
||||
Fieldset fieldSetPrivate;
|
||||
|
||||
@UiField
|
||||
Fieldset fieldSetPublic;
|
||||
|
||||
@UiField
|
||||
VerticalPanel fieldPrivateSharing;
|
||||
|
||||
// @UiField
|
||||
// VerticalPanel filedEnableDisableSharing;
|
||||
|
||||
@UiField
|
||||
Label labelLinkSharing;
|
||||
|
||||
@UiField
|
||||
Button privateLinkCopyButton;
|
||||
|
||||
@UiField
|
||||
Button privateLongLinkCopyButton;
|
||||
|
||||
@UiField
|
||||
Button publicLinkCopyButton;
|
||||
|
||||
@UiField
|
||||
Button publicLongLinkCopyButton;
|
||||
//
|
||||
// @UiField
|
||||
// Well wellPrivateLinkDescription;
|
||||
|
||||
@UiField
|
||||
Button showPrivateLongLinkButton;
|
||||
|
||||
@UiField
|
||||
Button showPublicLongLinkButton;
|
||||
|
||||
// @UiField
|
||||
// HTMLPanel panelFieldsContainer;
|
||||
|
||||
private GeoNaItemRef geonItemRef;
|
||||
|
||||
private String fileVersion;
|
||||
|
||||
private boolean itemIsPublicStatus;
|
||||
|
||||
private PublicLink openPublicLink;
|
||||
|
||||
private PublicLink restrictedPublicLink;
|
||||
|
||||
private final String privateShareToFileDescription = "By sharing the following Private Link "
|
||||
+ "with your coworkers, you will enact the users of the group the folder is shared with, "
|
||||
+ "to access the file and the shared folder content. Login required";
|
||||
|
||||
|
||||
/**
|
||||
* The Interface DialogShareableLinkUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Sep 19, 2019
|
||||
*/
|
||||
interface DialogShareableLinkUiBinder extends UiBinder<Widget, DialogShareableLink> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new dialog shareable link.
|
||||
*
|
||||
* @param item the item
|
||||
* @param version the version
|
||||
*/
|
||||
public DialogShareableLink(GeoNaItemRef item, String version) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
this.geonItemRef = item;
|
||||
this.fileVersion = version;
|
||||
this.actionAlert.setAnimation(true);
|
||||
|
||||
//cgRemovePublicLink.setVisible(false);
|
||||
// fieldSetPrivate.setVisible(false);
|
||||
// fieldPrivateSharing.setVisible(false);
|
||||
cgPublicLink.setVisible(true);
|
||||
|
||||
fieldPrivateSharing.setVisible(false);
|
||||
fieldSetPrivate.setVisible(false);
|
||||
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
if(result!=null) {
|
||||
fieldPrivateSharing.setVisible(true);
|
||||
fieldSetPrivate.setVisible(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
showMessage("", false);
|
||||
|
||||
//alertFilePublicLink.setVisible(true);
|
||||
loadAndShowPublicLinksForItem(item);
|
||||
//getElement().setClassName("gwt-DialogBoxNew");
|
||||
modalBox.setTitle("Share Link...");
|
||||
ModalFooter modalFooter = new ModalFooter();
|
||||
final Button buttClose = new Button("Close");
|
||||
modalFooter.add(buttClose);
|
||||
|
||||
buttClose.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
modalBox.hide();
|
||||
}
|
||||
});
|
||||
|
||||
addEvents();
|
||||
|
||||
textPrivateLink.setId(Random.nextInt()+Random.nextInt()+"");
|
||||
textPrivateLongLink.setId(Random.nextInt()+Random.nextInt()+"");
|
||||
textPublicLink.setId(Random.nextInt()+Random.nextInt()+"");
|
||||
textPublicLongLink.setId(Random.nextInt()+Random.nextInt()+"");
|
||||
|
||||
modalBox.add(this);
|
||||
modalBox.add(modalFooter);
|
||||
modalBox.show();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the events.
|
||||
*/
|
||||
private void addEvents() {
|
||||
|
||||
showPrivateLongLinkButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
showPrivateLongLinkButton.setVisible(false);
|
||||
cgPrivateLongLink.setVisible(true);
|
||||
textPrivateLongLink.setText(restrictedPublicLink.getCompleteURL());
|
||||
}
|
||||
});
|
||||
|
||||
showPublicLongLinkButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
if(openPublicLink!=null && openPublicLink.getCompleteURL()!=null) {
|
||||
showPublicLongLinkButton.setVisible(false);
|
||||
cgPublicLongLink.setVisible(true);
|
||||
textPublicLongLink.setText(openPublicLink.getCompleteURL());
|
||||
}else {
|
||||
textPublicLongLink.setText("Not available");
|
||||
showPublicLongLinkButton.setText("Not available");
|
||||
showPublicLongLinkButton.addStyleName("href-disabled");
|
||||
publicLongLinkCopyButton.setEnabled(false);
|
||||
// showPublicLongLinkButton.setVisible(false);
|
||||
disableTextBox(textPublicLongLink);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
privateLinkCopyButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
final Element elem = event.getRelativeElement();
|
||||
elem.setTitle("Copied to clipboard");
|
||||
Tooltip.changeVisibility(elem, VisibilityChange.TOGGLE.get());
|
||||
Timer timer = new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Tooltip.changeVisibility(elem, VisibilityChange.HIDE.get());
|
||||
}
|
||||
};
|
||||
|
||||
timer.schedule(1000);
|
||||
copyToClipboard(textPrivateLink.getId());
|
||||
}
|
||||
});
|
||||
|
||||
privateLinkCopyButton.addMouseOverHandler(new MouseOverHandler() {
|
||||
|
||||
@Override
|
||||
public void onMouseOver(MouseOverEvent event) {
|
||||
final Element elem = event.getRelativeElement();
|
||||
elem.setTitle("Copy");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
privateLongLinkCopyButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
final Element elem = event.getRelativeElement();
|
||||
Tooltip.changeVisibility(elem, VisibilityChange.TOGGLE.get());
|
||||
Timer timer = new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Tooltip.changeVisibility(elem, VisibilityChange.HIDE.get());
|
||||
}
|
||||
};
|
||||
|
||||
timer.schedule(1000);
|
||||
copyToClipboard(textPrivateLongLink.getId());
|
||||
}
|
||||
});
|
||||
|
||||
privateLongLinkCopyButton.addMouseOverHandler(new MouseOverHandler() {
|
||||
|
||||
@Override
|
||||
public void onMouseOver(MouseOverEvent event) {
|
||||
final Element elem = event.getRelativeElement();
|
||||
elem.setTitle("Copy");
|
||||
}
|
||||
});
|
||||
|
||||
publicLinkCopyButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
final Element elem = event.getRelativeElement();
|
||||
Tooltip.changeVisibility(elem, VisibilityChange.TOGGLE.get());
|
||||
Timer timer = new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Tooltip.changeVisibility(elem, VisibilityChange.HIDE.get());
|
||||
}
|
||||
};
|
||||
|
||||
timer.schedule(1000);
|
||||
copyToClipboard(textPublicLink.getId());
|
||||
}
|
||||
});
|
||||
|
||||
publicLinkCopyButton.addMouseOverHandler(new MouseOverHandler() {
|
||||
|
||||
@Override
|
||||
public void onMouseOver(MouseOverEvent event) {
|
||||
final Element elem = event.getRelativeElement();
|
||||
elem.setTitle("Copy");
|
||||
}
|
||||
});
|
||||
|
||||
publicLongLinkCopyButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
final Element elem = event.getRelativeElement();
|
||||
Tooltip.changeVisibility(elem, VisibilityChange.TOGGLE.get());
|
||||
Timer timer = new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Tooltip.changeVisibility(elem, VisibilityChange.HIDE.get());
|
||||
}
|
||||
};
|
||||
|
||||
timer.schedule(1000);
|
||||
copyToClipboard(textPublicLongLink.getId());
|
||||
}
|
||||
});
|
||||
|
||||
publicLongLinkCopyButton.addMouseOverHandler(new MouseOverHandler() {
|
||||
|
||||
@Override
|
||||
public void onMouseOver(MouseOverEvent event) {
|
||||
final Element elem = event.getRelativeElement();
|
||||
elem.setTitle("Copy");
|
||||
}
|
||||
});
|
||||
|
||||
textPrivateLink.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
textPrivateLink.selectAll();
|
||||
}
|
||||
});
|
||||
|
||||
textPrivateLongLink.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
textPrivateLongLink.selectAll();
|
||||
}
|
||||
});
|
||||
|
||||
textPublicLongLink.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
textPublicLongLink.selectAll();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy to clipboard.
|
||||
*
|
||||
* @param myDivId the my div id
|
||||
*/
|
||||
private native void copyToClipboard(String myDivId) /*-{
|
||||
|
||||
var copyText = $doc.getElementById(myDivId);
|
||||
console.log("text copied is :"+copyText.value);
|
||||
copyText.select();
|
||||
//For mobile devices
|
||||
copyText.setSelectionRange(0, 99999);
|
||||
$doc.execCommand("copy");
|
||||
//alert("Copied the text: " + copyText.value);
|
||||
}-*/;
|
||||
|
||||
|
||||
/**
|
||||
* Load and show public links for item.
|
||||
*
|
||||
* @param item the item
|
||||
*/
|
||||
private void loadAndShowPublicLinksForItem(GeoNaItemRef item) {
|
||||
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getPublicLinksFor(item,
|
||||
new AsyncCallback<GeoNaItemRef>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(GeoNaItemRef itemReferences) {
|
||||
openPublicLink = itemReferences.getOpenLink();
|
||||
restrictedPublicLink = itemReferences.getRestrictedLink();
|
||||
String toPublicURL = openPublicLink.getShortURL() != null && !openPublicLink.getShortURL().isEmpty()
|
||||
? openPublicLink.getShortURL()
|
||||
: openPublicLink.getCompleteURL();
|
||||
|
||||
textPublicLink.setValue(toPublicURL);
|
||||
textPublicLongLink.setValue(openPublicLink.getCompleteURL());
|
||||
|
||||
String toPrivateURL = restrictedPublicLink.getShortURL() != null && !restrictedPublicLink.getShortURL().isEmpty()
|
||||
? restrictedPublicLink.getShortURL()
|
||||
: restrictedPublicLink.getCompleteURL();
|
||||
|
||||
textPrivateLink.setValue(toPrivateURL);
|
||||
textPrivateLongLink.setValue(restrictedPublicLink.getCompleteURL());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
openPublicLink = null;
|
||||
disableTextBox(textPublicLink);
|
||||
disableTextBox(textPrivateLink);
|
||||
showError(caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable text box.
|
||||
*
|
||||
* @param textBox the text box
|
||||
*/
|
||||
private void disableTextBox(TextBox textBox) {
|
||||
textBox.setEnabled(false);
|
||||
textBox.getElement().getStyle().setOpacity(0.3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show error.
|
||||
*
|
||||
* @param msg the msg
|
||||
*/
|
||||
private void showError(String msg) {
|
||||
errorAlert.setVisible(true);
|
||||
errorAlert.setText(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show message.
|
||||
*
|
||||
* @param msg the msg
|
||||
* @param visible the visible
|
||||
*/
|
||||
private void showMessage(String msg, boolean visible) {
|
||||
actionAlert.setVisible(visible);
|
||||
actionAlert.setText(msg==null?"":msg);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
.back-color-info {
|
||||
background-color: #fafaff !important;
|
||||
}
|
||||
|
||||
.margin-bottom-20 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.padding-left-10 {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.margin-left-5 {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.margin-left-25 {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.text-bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.not-active {
|
||||
pointer-events: none;
|
||||
cursor: default;
|
||||
opacity: .5;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.to-top-alignment {
|
||||
vertical-align: top;
|
||||
padding-top: 0px !important;
|
||||
}
|
||||
|
||||
.no-border {
|
||||
border: 0px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<b:Form type="HORIZONTAL">
|
||||
<b:Alert ui:field="actionAlert" close="false" type="INFO"
|
||||
visible="false">
|
||||
<b:Icon type="ROTATE_RIGHT" spin="true" />
|
||||
</b:Alert>
|
||||
|
||||
<g:VerticalPanel ui:field="fieldPrivateSharing"
|
||||
addStyleNames="{style.margin-bottom-20}">
|
||||
<g:HorizontalPanel>
|
||||
<b:Label type="INFO" addStyleNames="sharelabel">With
|
||||
coworkers</b:Label>
|
||||
</g:HorizontalPanel>
|
||||
<g:VerticalPanel
|
||||
addStyleNames="{style.margin-left-5}">
|
||||
<g:Label ui:field="labelLinkPrivateSharing">(Only the) Members of the VRE are enacted
|
||||
to access it. Login required</g:Label>
|
||||
</g:VerticalPanel>
|
||||
</g:VerticalPanel>
|
||||
|
||||
<b:Fieldset ui:field="fieldSetPrivate"
|
||||
styleName="{style.noBorder}">
|
||||
<g:HTMLPanel>
|
||||
<!-- <b:Legend>sharing....</b:Legend> -->
|
||||
<b:ControlGroup ui:field="cgPrivateLink"
|
||||
addStyleNames="my-control-group">
|
||||
|
||||
<!-- <b:Well ui:field="wellPrivateLinkDescription"> -->
|
||||
<!-- The following Restricted Link for this product -->
|
||||
<!-- is accessible by the users of the VRE. Login required</b:Well> -->
|
||||
<b:ControlLabel>Restricted Link</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:InputAddOn prependIcon="LINK"
|
||||
addStyleNames="my-prepend-width">
|
||||
<b:TextBox ui:field="textPrivateLink" readOnly="true">
|
||||
</b:TextBox>
|
||||
<b:Tooltip text='Copied to clipboard' trigger="MANUAL">
|
||||
<b:Button icon="COPY" ui:field="privateLinkCopyButton"
|
||||
type="PRIMARY"></b:Button>
|
||||
</b:Tooltip>
|
||||
</b:InputAddOn>
|
||||
<b:Button ui:field="showPrivateLongLinkButton"
|
||||
type="LINK" addStyleNames="{style.margin-left-25}">Show as Long URL</b:Button>
|
||||
</b:Controls>
|
||||
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup addStyleNames="my-control-group"
|
||||
ui:field="cgPrivateLongLink" visible="false">
|
||||
<b:ControlLabel></b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:InputAddOn prependIcon="LINK"
|
||||
addStyleNames="my-prepend-width">
|
||||
<b:TextBox ui:field="textPrivateLongLink"
|
||||
readOnly="true">
|
||||
</b:TextBox>
|
||||
<b:Tooltip text='Copied to clipboard' trigger="MANUAL">
|
||||
<b:Button icon="COPY"
|
||||
ui:field="privateLongLinkCopyButton" type="PRIMARY"></b:Button>
|
||||
</b:Tooltip>
|
||||
</b:InputAddOn>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</g:HTMLPanel>
|
||||
</b:Fieldset>
|
||||
|
||||
<g:VerticalPanel ui:field="filedEnableDisableSharing"
|
||||
addStyleNames="{style.margin-bottom-20}">
|
||||
<g:HorizontalPanel>
|
||||
<b:Label type="INFO" addStyleNames="sharelabel">With
|
||||
everyone</b:Label>
|
||||
</g:HorizontalPanel>
|
||||
<g:VerticalPanel
|
||||
addStyleNames="{style.margin-left-5}">
|
||||
<g:Label ui:field="labelLinkSharing">Anyone with
|
||||
this link can access it. No
|
||||
login is required</g:Label>
|
||||
</g:VerticalPanel>
|
||||
</g:VerticalPanel>
|
||||
|
||||
|
||||
<b:Fieldset ui:field="fieldSetPublic">
|
||||
<b:ControlGroup ui:field="cgPublicLink"
|
||||
addStyleNames="my-control-group">
|
||||
<!-- <b:Well ui:field="alertFilePublicLink" visible="true">Anyone with -->
|
||||
<!-- this link can access it, no login is required.</b:Well> -->
|
||||
<b:ControlLabel>Open Link</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:InputAddOn prependIcon="GLOBE"
|
||||
addStyleNames="my-prepend-width">
|
||||
<b:TextBox ui:field="textPublicLink" readOnly="true">
|
||||
</b:TextBox>
|
||||
<b:Tooltip text='Copied to clipboard' trigger="MANUAL">
|
||||
<b:Button icon="COPY" ui:field="publicLinkCopyButton"
|
||||
type="PRIMARY"></b:Button>
|
||||
</b:Tooltip>
|
||||
</b:InputAddOn>
|
||||
<b:Button ui:field="showPublicLongLinkButton" type="LINK"
|
||||
addStyleNames="{style.margin-left-25}">Show as Long URL</b:Button>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup addStyleNames="my-control-group"
|
||||
ui:field="cgPublicLongLink" visible="false">
|
||||
<b:ControlLabel></b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:InputAddOn prependIcon="GLOBE"
|
||||
addStyleNames="my-prepend-width">
|
||||
<b:TextBox ui:field="textPublicLongLink"
|
||||
readOnly="true">
|
||||
</b:TextBox>
|
||||
<b:Tooltip text='Copied to clipboard' trigger="MANUAL">
|
||||
<b:Button icon="COPY"
|
||||
ui:field="publicLongLinkCopyButton" type="PRIMARY"></b:Button>
|
||||
</b:Tooltip>
|
||||
</b:InputAddOn>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</b:Fieldset>
|
||||
<b:Alert close="false" ui:field="errorAlert" type="ERROR"
|
||||
visible="false"></b:Alert>
|
||||
</b:Form>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,134 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.map;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.LightOpenLayerOSM;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Random;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
import ol.Coordinate;
|
||||
import ol.OLFactory;
|
||||
|
||||
/**
|
||||
* The Class MapView.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 11, 2020
|
||||
*/
|
||||
public class MapView extends Composite{
|
||||
|
||||
private static MapViewUiBinder uiBinder = GWT.create(MapViewUiBinder.class);
|
||||
|
||||
/**
|
||||
* The Interface MapViewUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 11, 2020
|
||||
*/
|
||||
interface MapViewUiBinder extends UiBinder<Widget, MapView> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
HTMLPanel theMap;
|
||||
|
||||
@UiField
|
||||
HorizontalPanel coordinatePanel;
|
||||
|
||||
private LightOpenLayerOSM olsm;
|
||||
|
||||
/**
|
||||
* Instantiates a new map view.
|
||||
*/
|
||||
public MapView() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
String theMapId = "map"+Random.nextInt();
|
||||
theMap.getElement().setId(theMapId);
|
||||
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
olsm = new LightOpenLayerOSM(theMapId);
|
||||
//EPSG_4326_TO_ITALY
|
||||
Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT);
|
||||
Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
||||
|
||||
olsm.setCenter(transformedCenterCoordinate);
|
||||
olsm.setZoom(GeoportalDataViewerConstants.ITALY_FIT_ZOOM_ON);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the marker.
|
||||
*
|
||||
* @param coordinate the coordinate
|
||||
* @param showCoordinateText the show coordinate text
|
||||
*/
|
||||
public void addMarker(Coordinate coordinate, boolean showCoordinateText) {
|
||||
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
if(olsm!=null) {
|
||||
olsm.addPoint(coordinate, showCoordinateText, true);
|
||||
olsm.getMap().getView().setCenter(coordinate);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the WMS layer.
|
||||
*
|
||||
* @param mapServerHost the map server host
|
||||
* @param layerName the layer name
|
||||
* @param bbox the bbox
|
||||
*/
|
||||
public void addWMSLayer(String mapServerHost, String layerName, BoundsMap bbox) {
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
olsm.addWMSLayer(mapServerHost, layerName);
|
||||
|
||||
if (bbox != null) {
|
||||
|
||||
Coordinate lower = OLFactory.createCoordinate(bbox.getLowerLeftX(), bbox.getLowerLeftY());
|
||||
Coordinate lowerCoord = MapUtils.transformCoordiante(lower, GeoportalDataViewerConstants.EPSG_4326,
|
||||
GeoportalDataViewerConstants.EPSG_3857);
|
||||
|
||||
Coordinate upper = OLFactory.createCoordinate(bbox.getUpperRightX(), bbox.getUpperRightY());
|
||||
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);
|
||||
olsm.getMap().getView().fit(ew);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||
<ui:style>
|
||||
.internalMap {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="theMap"
|
||||
addStyleNames="{style.internalMap}">
|
||||
</g:HTMLPanel>
|
||||
<g:HorizontalPanel ui:field="coordinatePanel"
|
||||
visible="false"></g:HorizontalPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -1,106 +0,0 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.images.ImageView;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Column;
|
||||
import com.github.gwtbootstrap.client.ui.Heading;
|
||||
import com.github.gwtbootstrap.client.ui.Label;
|
||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
import com.github.gwtbootstrap.client.ui.Thumbnails;
|
||||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
|
||||
public class ConcessioneView extends Composite {
|
||||
|
||||
private static ConcessioneViewUiBinder uiBinder = GWT.create(ConcessioneViewUiBinder.class);
|
||||
|
||||
interface ConcessioneViewUiBinder extends UiBinder<Widget, ConcessioneView> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
Heading titolo;
|
||||
|
||||
@UiField
|
||||
Paragraph introduzione;
|
||||
|
||||
@UiField
|
||||
Column autori;
|
||||
|
||||
@UiField
|
||||
Column contributore;
|
||||
|
||||
@UiField
|
||||
HTMLPanel imagesPanel;
|
||||
|
||||
private ConcessioneDV concessioneDV;
|
||||
|
||||
private Thumbnails thumbNails = new Thumbnails();
|
||||
|
||||
public ConcessioneView() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
|
||||
public ConcessioneView(ConcessioneDV concessioneDV) {
|
||||
this();
|
||||
this.concessioneDV = concessioneDV;
|
||||
titolo.setText(concessioneDV.getNome());
|
||||
introduzione.setText(concessioneDV.getIntroduzione());
|
||||
|
||||
for (String author : concessioneDV.getAuthors()) {
|
||||
addLabel(autori, author);
|
||||
//autori.add(new Label(author));
|
||||
}
|
||||
|
||||
addLabel(contributore, concessioneDV.getContributore());
|
||||
|
||||
addImages();
|
||||
}
|
||||
|
||||
private void addImages() {
|
||||
List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative();
|
||||
if(immagini!=null && immagini.size()>0) {
|
||||
imagesPanel.setVisible(true);
|
||||
int i = 0;
|
||||
for (UploadedImageDV uploadedImageDV : immagini) {
|
||||
if(i==0)
|
||||
imagesPanel.add(thumbNails);
|
||||
|
||||
thumbNails.add(new ImageView(uploadedImageDV));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void addLabel(FlowPanel w, String labelValue, LabelType type){
|
||||
Label label = new Label(labelValue);
|
||||
label.setType(type);
|
||||
label.getElement().getStyle().setMarginRight(5, Unit.PX);
|
||||
w.add(label);
|
||||
}
|
||||
|
||||
public void addLabel(FlowPanel w, String labelValue){
|
||||
com.google.gwt.user.client.ui.Label label = new com.google.gwt.user.client.ui.Label(labelValue);
|
||||
label.getElement().getStyle().setMarginRight(5, Unit.PX);
|
||||
w.add(label);
|
||||
}
|
||||
|
||||
public ConcessioneDV getConcessioneDV() {
|
||||
return concessioneDV;
|
||||
}
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.margin-left-10 {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.font-size-h1-22 h1{
|
||||
font-size: 22px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<b:Hero>
|
||||
<b:Heading size="2" ui:field="titolo">Hero Unit</b:Heading>
|
||||
<b:Paragraph ui:field="introduzione">Some Text for the Hero Unit.</b:Paragraph>
|
||||
</b:Hero>
|
||||
<g:HTMLPanel ui:field="concessioniPanel"
|
||||
addStyleNames="{style.margin-left-10}">
|
||||
<b:Row>
|
||||
<b:Column size="2">
|
||||
<g:Label>Autori</g:Label>
|
||||
</b:Column>
|
||||
<b:Column size="8" ui:field="autori"></b:Column>
|
||||
</b:Row>
|
||||
<b:Row>
|
||||
<b:Column size="2">
|
||||
<g:Label>Contributore</g:Label>
|
||||
</b:Column>
|
||||
<b:Column size="8" ui:field="contributore"></b:Column>
|
||||
</b:Row>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="imagesPanel"
|
||||
addStyleNames="{style.margin-left-10}" visible="false">
|
||||
<b:PageHeader addStyleNames="{style.font-size-h1-22}">Immagini Rappresentative</b:PageHeader>
|
||||
</g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,49 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordDV;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class RecordView extends Composite {
|
||||
|
||||
private static RecordViewUiBinder uiBinder = GWT.create(RecordViewUiBinder.class);
|
||||
|
||||
interface RecordViewUiBinder extends UiBinder<Widget, RecordView> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
HTMLPanel recordDVPanel;
|
||||
|
||||
private CustomFlexTable customTable = new CustomFlexTable();
|
||||
|
||||
public RecordView() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public RecordView(RecordDV record) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
customTable.addNextKeyValue("Created", record.getCreationTime());
|
||||
customTable.addNextKeyValue("Last Updated", record.getLastUpdateTime());
|
||||
customTable.addNextKeyValue("Updated by", record.getLastUpdateUser());
|
||||
recordDVPanel.add(customTable);
|
||||
}
|
||||
|
||||
public void addLabel(FlowPanel w, String labelValue){
|
||||
com.google.gwt.user.client.ui.Label label = new com.google.gwt.user.client.ui.Label(labelValue);
|
||||
label.getElement().getStyle().setMarginRight(5, Unit.PX);
|
||||
w.add(label);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="recordDVPanel">
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,329 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShareableLink;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.images.ImageView;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.LayerConcessioneDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RelazioneScavoDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Modal;
|
||||
import com.github.gwtbootstrap.client.ui.ModalFooter;
|
||||
import com.github.gwtbootstrap.client.ui.PageHeader;
|
||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
import com.github.gwtbootstrap.client.ui.Thumbnails;
|
||||
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.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
import ol.Coordinate;
|
||||
|
||||
public class ConcessioneView extends Composite {
|
||||
|
||||
|
||||
|
||||
private static ConcessioneViewUiBinder uiBinder = GWT.create(ConcessioneViewUiBinder.class);
|
||||
|
||||
interface ConcessioneViewUiBinder extends UiBinder<Widget, ConcessioneView> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
PageHeader titolo;
|
||||
|
||||
@UiField
|
||||
Paragraph introduzione;
|
||||
|
||||
@UiField
|
||||
HTMLPanel concessioniPanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel relazioneScavoPanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel imagesPanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel pageViewDetails;
|
||||
|
||||
@UiField
|
||||
HTMLPanel mapViewPanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel posizionamentoAreaIndaginePanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel piantaFineScavoPanel;
|
||||
|
||||
// @UiField
|
||||
// HTMLPanel sharePanel;
|
||||
|
||||
@UiField
|
||||
Button shareButton;
|
||||
|
||||
@UiField
|
||||
Button openButton;
|
||||
|
||||
private ConcessioneDV concessioneDV;
|
||||
|
||||
private Thumbnails thumbNails = new Thumbnails();
|
||||
|
||||
private CustomFlexTable customTable = new CustomFlexTable();
|
||||
|
||||
private GeoNaItemRef geonaItemRef;
|
||||
|
||||
private String myLogin;
|
||||
|
||||
private ConcessioneView() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
pageViewDetails.getElement().setId("page-view-details");
|
||||
}
|
||||
|
||||
public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV) {
|
||||
this();
|
||||
this.concessioneDV = concDV;
|
||||
this.geonaItemRef = item;
|
||||
|
||||
titolo.setText(concessioneDV.getNome());
|
||||
introduzione.setText(concessioneDV.getIntroduzione());
|
||||
|
||||
if (concessioneDV.getDataInizioProgetto() != null) {
|
||||
customTable.addNextKeyValue("Data Inizio Progetto", concessioneDV.getDataFineProgetto());
|
||||
}
|
||||
|
||||
if (concessioneDV.getDataFineProgetto() != null) {
|
||||
customTable.addNextKeyValue("Data Fine Progetto", concessioneDV.getDataFineProgetto());
|
||||
}
|
||||
|
||||
if (concessioneDV.getParoleChiaveLibere() != null) {
|
||||
customTable.addNextKeyValues("Parole chiave Libere", concessioneDV.getParoleChiaveICCD(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getParoleChiaveICCD() != null) {
|
||||
customTable.addNextKeyValues("Parole chiave Cronologia", concessioneDV.getParoleChiaveICCD(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getAuthors() != null) {
|
||||
customTable.addNextKeyValues("Autori", concessioneDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getContributore() != null) {
|
||||
customTable.addNextKeyValue("Contributore", concessioneDV.getContributore());
|
||||
}
|
||||
|
||||
if (concessioneDV.getEditore() != null) {
|
||||
customTable.addNextKeyValue("Editore", concessioneDV.getEditore());
|
||||
}
|
||||
|
||||
if (concessioneDV.getResponsabile() != null) {
|
||||
customTable.addNextKeyValue("Responsabile", concessioneDV.getResponsabile());
|
||||
}
|
||||
|
||||
if (concessioneDV.getRisorseCorrelate() != null) {
|
||||
customTable.addNextKeyValues("Risorse Correlate", concessioneDV.getRisorseCorrelate(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getTitolari() != null) {
|
||||
customTable.addNextKeyValues("Titolari dei dati", concessioneDV.getTitolari(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getSoggetto() != null) {
|
||||
customTable.addNextKeyValues("Soggetti", concessioneDV.getSoggetto(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getEditore() != null) {
|
||||
customTable.addNextKeyValue("Editore", concessioneDV.getEditore());
|
||||
}
|
||||
|
||||
if (concessioneDV.getFontiFinanziamento() != null) {
|
||||
customTable.addNextKeyValues("Fonti di Finanziamento", concessioneDV.getFontiFinanziamento(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getLicenzaID() != null) {
|
||||
customTable.addNextKeyValue("ID Licenza", concessioneDV.getLicenzaID());
|
||||
}
|
||||
|
||||
if (concessioneDV.getTitolareLicenza() != null) {
|
||||
customTable.addNextKeyValue("Titolare Licenza", concessioneDV.getTitolareLicenza());
|
||||
}
|
||||
|
||||
if (concessioneDV.getTitolareCopyright() != null) {
|
||||
customTable.addNextKeyValue("Titolare Copyright", concessioneDV.getTitolareCopyright());
|
||||
}
|
||||
|
||||
shareButton.setType(ButtonType.LINK);
|
||||
shareButton.setIcon(IconType.SHARE);
|
||||
shareButton.setTitle("Get a link to share with...");
|
||||
|
||||
shareButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
DialogShareableLink dg = new DialogShareableLink(geonaItemRef, null);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
openButton.setType(ButtonType.LINK);
|
||||
openButton.setIcon(IconType.EXPAND);
|
||||
openButton.setTitle("Open Details in New Dialog");
|
||||
|
||||
openButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Modal modal = new Modal(false);
|
||||
modal.hide(false);
|
||||
modal.setCloseVisible(true);
|
||||
modal.setWidth(900);
|
||||
modal.setTitle(concessioneDV.getNome());
|
||||
modal.add(new ConcessioneView(geonaItemRef, concessioneDV));
|
||||
ModalFooter modalFooter = new ModalFooter();
|
||||
final Button buttClose = new Button("Close");
|
||||
modalFooter.add(buttClose);
|
||||
|
||||
buttClose.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
modal.hide();
|
||||
}
|
||||
});
|
||||
modal.add(modalFooter);
|
||||
modal.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
concessioniPanel.add(customTable);
|
||||
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
myLogin = result;
|
||||
addCentroidMap();
|
||||
addRelazioneDiScavo();
|
||||
addPosizionamentoAreaIndagine();
|
||||
addPiantaFineScavo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
}
|
||||
});
|
||||
|
||||
addUploadedImages();
|
||||
|
||||
}
|
||||
|
||||
private void addPosizionamentoAreaIndagine() {
|
||||
|
||||
LayerConcessioneDV layer = concessioneDV.getPosizionamentoScavo();
|
||||
if(layer==null)
|
||||
return;
|
||||
|
||||
if(layer.getPolicy()==null || layer.getPolicy().equalsIgnoreCase("OPEN")) {
|
||||
posizionamentoAreaIndaginePanel.setVisible(true);
|
||||
posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer));
|
||||
}else {
|
||||
//I need to be authenticated to show the fields according to POLICY
|
||||
if(myLogin!=null) {
|
||||
posizionamentoAreaIndaginePanel.setVisible(true);
|
||||
posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void addPiantaFineScavo() {
|
||||
|
||||
List<LayerConcessioneDV> listLayersDV = concessioneDV.getPianteFineScavo();
|
||||
|
||||
if(listLayersDV==null)
|
||||
return;
|
||||
|
||||
for (LayerConcessioneDV layer : listLayersDV) {
|
||||
|
||||
if(layer.getPolicy()==null || layer.getPolicy().equalsIgnoreCase("OPEN")) {
|
||||
piantaFineScavoPanel.setVisible(true);
|
||||
piantaFineScavoPanel.add(new LayerConcessioneView(layer));
|
||||
}else {
|
||||
//I need to be authenticated to show the fields according to POLICY
|
||||
if(myLogin!=null) {
|
||||
piantaFineScavoPanel.setVisible(true);
|
||||
piantaFineScavoPanel.add(new LayerConcessioneView(layer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void addRelazioneDiScavo() {
|
||||
|
||||
RelazioneScavoDV relazioneScavo = concessioneDV.getRelazioneScavo();
|
||||
|
||||
if(relazioneScavo==null)
|
||||
return;
|
||||
|
||||
if(relazioneScavo.getPolicy()==null || relazioneScavo.getPolicy().equalsIgnoreCase("OPEN")) {
|
||||
relazioneScavoPanel.setVisible(true);
|
||||
relazioneScavoPanel.add(new RelazioneScavoView(relazioneScavo));
|
||||
}else {
|
||||
//I need to be authenticated to show the fields according to POLICY
|
||||
if(myLogin!=null) {
|
||||
relazioneScavoPanel.setVisible(true);
|
||||
relazioneScavoPanel.add(new RelazioneScavoView(relazioneScavo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addCentroidMap() {
|
||||
MapView mapView = new MapView();
|
||||
Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
|
||||
Coordinate transfCoord = MapUtils.transformCoordiante(coord, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
||||
//Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
|
||||
boolean authenticatedUser = myLogin!=null?true:false;
|
||||
mapView.addMarker(transfCoord, authenticatedUser);
|
||||
mapViewPanel.add(mapView);
|
||||
}
|
||||
|
||||
private void addUploadedImages() {
|
||||
List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative();
|
||||
if (immagini != null && immagini.size() > 0) {
|
||||
imagesPanel.setVisible(true);
|
||||
int i = 0;
|
||||
for (UploadedImageDV uploadedImageDV : immagini) {
|
||||
if (i == 0)
|
||||
imagesPanel.add(thumbNails);
|
||||
|
||||
thumbNails.add(new ImageView(uploadedImageDV));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ConcessioneDV getConcessioneDV() {
|
||||
return concessioneDV;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
|
||||
<ui:style>
|
||||
.margin-left-10 {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.font-size-h1-22 h1 {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.align-to-right {
|
||||
right: 20px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.margin-bottom-10 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="pageViewDetails">
|
||||
<!-- <g:HTMLPanel ui:field="sharePanel" -->
|
||||
<!-- addStyleNames="{style.align-to-right}"> -->
|
||||
<!-- </g:HTMLPanel> -->
|
||||
<b:PageHeader ui:field="titolo"></b:PageHeader>
|
||||
<g:HorizontalPanel
|
||||
addStyleNames="{style.margin-bottom-10}">
|
||||
<b:Button ui:field="shareButton">Share</b:Button>
|
||||
<b:Button ui:field="openButton">Open</b:Button>
|
||||
</g:HorizontalPanel>
|
||||
<b:Paragraph ui:field="introduzione"></b:Paragraph>
|
||||
<g:HorizontalPanel>
|
||||
<g:HTMLPanel ui:field="concessioniPanel">
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="mapViewPanel">
|
||||
</g:HTMLPanel>
|
||||
</g:HorizontalPanel>
|
||||
<g:HTMLPanel ui:field="relazioneScavoPanel"
|
||||
addStyleNames="{style.margin-left-10}" visible="false">
|
||||
<b:PageHeader addStyleNames="{style.font-size-h1-22}">Relazione Scavo</b:PageHeader>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="imagesPanel"
|
||||
addStyleNames="{style.margin-left-10}" visible="false">
|
||||
<b:PageHeader addStyleNames="{style.font-size-h1-22}">Immagini Rappresentative</b:PageHeader>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="posizionamentoAreaIndaginePanel"
|
||||
addStyleNames="{style.margin-left-10}" visible="false">
|
||||
<b:PageHeader addStyleNames="{style.font-size-h1-22}">Posizionamento Area di
|
||||
Indagine</b:PageHeader>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="piantaFineScavoPanel"
|
||||
addStyleNames="{style.margin-left-10}" visible="false">
|
||||
<b:PageHeader addStyleNames="{style.font-size-h1-22}">Pianta Fine Scavo</b:PageHeader>
|
||||
</g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,49 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.LayerConcessioneDV;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class LayerConcessioneView extends Composite {
|
||||
|
||||
private static LayerConcessioneUiBinder uiBinder = GWT.create(LayerConcessioneUiBinder.class);
|
||||
|
||||
interface LayerConcessioneUiBinder extends UiBinder<Widget, LayerConcessioneView> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
HTMLPanel layerConcessionePanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel mapViewPanel;
|
||||
|
||||
private CustomFlexTable customTable = new CustomFlexTable();
|
||||
|
||||
public LayerConcessioneView(LayerConcessioneDV layerDV) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
GWT.log("Showing: "+layerDV);
|
||||
|
||||
//customTable.addNextKeyValue("Created", relazioneScavoDV.getCreationTime());
|
||||
customTable.addNextKeyValue("Valutazione qualità", layerDV.getValutazioneQualita());
|
||||
customTable.addNextKeyValue("Metodo raccolta dati", layerDV.getMetodoRaccoltaDati());
|
||||
customTable.addNextKeyValue("Scala acquisizione dati", layerDV.getScalaAcquisizione());
|
||||
customTable.addNextKeyValues("Autori", layerDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
layerConcessionePanel.add(customTable);
|
||||
|
||||
if(layerDV.getLayerName()!=null && layerDV.getWmsLink()!=null) {
|
||||
MapView mapView = new MapView();
|
||||
mapViewPanel.add(mapView);
|
||||
String mapServerHost = layerDV.getWmsLink().contains("?")? layerDV.getWmsLink().substring(0,layerDV.getWmsLink().indexOf("?")):layerDV.getWmsLink();
|
||||
mapView.addWMSLayer(mapServerHost, layerDV.getLayerName(), layerDV.getBbox());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
|
||||
<ui:style>
|
||||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.style-layer {
|
||||
display: inline-block;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.055);
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
width: 673px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel addStyleNames="{style.style-layer}">
|
||||
<g:HorizontalPanel>
|
||||
<g:HTMLPanel ui:field="layerConcessionePanel"></g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="mapViewPanel">
|
||||
</g:HTMLPanel>
|
||||
</g:HorizontalPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,43 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RelazioneScavoDV;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class RelazioneScavoView extends Composite {
|
||||
|
||||
private static RelazioneScavoViewUiBinder uiBinder = GWT.create(RelazioneScavoViewUiBinder.class);
|
||||
|
||||
interface RelazioneScavoViewUiBinder extends UiBinder<Widget, RelazioneScavoView> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
HTMLPanel relazioneScavoPanel;
|
||||
|
||||
@UiField
|
||||
Paragraph abstractParagraph;
|
||||
|
||||
private CustomFlexTable customTable = new CustomFlexTable();
|
||||
|
||||
|
||||
public RelazioneScavoView(RelazioneScavoDV relazioneScavoDV) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
if(relazioneScavoDV.getAbstractSection()!=null)
|
||||
abstractParagraph.setText(relazioneScavoDV.getAbstractSection());
|
||||
|
||||
//customTable.addNextKeyValue("Created", relazioneScavoDV.getCreationTime());
|
||||
customTable.addNextKeyValue("ID Licenza", relazioneScavoDV.getLicenseID());
|
||||
customTable.addNextKeyValues("Responsabili", relazioneScavoDV.getResponsabili(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
relazioneScavoPanel.add(customTable);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
|
||||
<ui:style>
|
||||
|
||||
.description > p {
|
||||
font-size: 20px;
|
||||
padding: 10px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="relazioneScavoPanel" addStyleNames="{style.description}">
|
||||
<b:Paragraph ui:field="abstractParagraph"></b:Paragraph>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,91 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
/**
|
||||
* The Class CustomFlexTable.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 11, 2020
|
||||
*/
|
||||
public class CustomFlexTable extends FlexTable {
|
||||
|
||||
/**
|
||||
* Instantiates a new custom flex table.
|
||||
*/
|
||||
public CustomFlexTable() {
|
||||
|
||||
this.getElement().addClassName("my-custom-flex-table");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the next key values.
|
||||
*
|
||||
* @param key the key
|
||||
* @param listValues the list values
|
||||
* @param separator the separator
|
||||
*/
|
||||
public void addNextKeyValues(String key, List<String> listValues, String separator) {
|
||||
GWT.log("adding key "+key +", values: "+listValues);
|
||||
Label keyLabel = new Label(key);
|
||||
int row = getRowCount() + 1;
|
||||
setWidget(row, 0, keyLabel);
|
||||
|
||||
if(listValues==null)
|
||||
return;
|
||||
|
||||
String valuesAsString = "";
|
||||
for (String value : listValues) {
|
||||
String theValue = value;
|
||||
if(theValue.startsWith("http://") || (theValue.startsWith("https://"))){
|
||||
theValue = "<a href=\""+value+"\" target=\"_blank\">"+value+"</a>";
|
||||
}
|
||||
valuesAsString+=theValue+separator;
|
||||
}
|
||||
valuesAsString = valuesAsString.substring(0, valuesAsString.lastIndexOf(separator));
|
||||
HTML valuesLabel = new HTML(valuesAsString);
|
||||
setWidget(row, 1, valuesLabel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the next key value.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
*/
|
||||
public void addNextKeyValue(String key, String value) {
|
||||
Label keyLabel = new Label(key);
|
||||
|
||||
// keyLabel.getElement().getStyle().setMarginRight(5, Unit.PX);
|
||||
int row = getRowCount() + 1;
|
||||
setWidget(row, 0, keyLabel);
|
||||
if(value==null)
|
||||
return;
|
||||
|
||||
HTML valueLabel = new HTML(value);
|
||||
setWidget(row, 1, valueLabel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the next key widget.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
*/
|
||||
public void addNextKeyWidget(String key, Widget value) {
|
||||
Label keyLabel = new Label(key);
|
||||
int row = getRowCount() + 1;
|
||||
setWidget(row, 0, keyLabel);
|
||||
setWidget(row, 1, value);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.geoportaldataviewer.client.util;
|
||||
|
||||
|
||||
/**
|
||||
* The Class StringUtil.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 16, 2020
|
||||
*/
|
||||
public class StringUtil {
|
||||
|
||||
/**
|
||||
* Ellipsize.
|
||||
*
|
||||
* @param input the input string that may be subjected to shortening
|
||||
* @param maxCharacters the maximum characters that must be returned for the input string. Must be at least 3 (that is the ellipses size)
|
||||
* @return the string
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static String ellipsize(String input, int maxCharacters) throws Exception{
|
||||
if(maxCharacters < 3) {
|
||||
throw new IllegalArgumentException("maxCharacters must be at least 3 because the ellipsis already take up 3 characters");
|
||||
}
|
||||
|
||||
if (input == null || input.length() < maxCharacters) {
|
||||
return input;
|
||||
}
|
||||
return input.substring(0, maxCharacters)+"...";
|
||||
}
|
||||
}
|
@ -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,202 @@
|
||||
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 = "/Resource/Profile/Body";
|
||||
/**
|
||||
*
|
||||
*/
|
||||
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 xPathExp = RESOURCE_PROFILE_BODY+"/RestrictedPortletURL/text()";
|
||||
currValue = helper.evaluate(xPathExp);
|
||||
if (currValue != null && currValue.size() > 0) {
|
||||
profile.setRestrictedPortletURL(currValue.get(0));
|
||||
}else
|
||||
throw new Exception("I'm not able to read the path: "+xPathExp);
|
||||
|
||||
xPathExp = RESOURCE_PROFILE_BODY+"/OpenPortletURL/text()";
|
||||
currValue = helper.evaluate(xPathExp);
|
||||
if (currValue != null && currValue.size() > 0) {
|
||||
profile.setOpenPortletURL(currValue.get(0));
|
||||
}else
|
||||
throw new Exception("I'm not able to read the path: "+xPathExp);
|
||||
|
||||
|
||||
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("WMSLink").item(0).getTextContent();
|
||||
String decodedURL = URLDecoder.decode(wmsLink, "UTF-8");
|
||||
LayerItem layer = new LayerItem();
|
||||
layer.setWmsLink(decodedURL);
|
||||
mapLayers.put(layerType.toLowerCase(), layer);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
+ "]";
|
||||
}
|
||||
|
||||
/*
|
||||
public static void main(String[] args) throws Exception {
|
||||
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
||||
GeoNaDataViewerProfileReader gdvp = new GeoNaDataViewerProfileReader("geoportal-data-viewer-app");
|
||||
GeoNaDataViewerProfile profile = gdvp.readProfileFromInfrastrucure();
|
||||
System.out.println(profile.getRestrictedPortletURL());
|
||||
System.out.println(profile.getOpenPortletURL());
|
||||
|
||||
if(profile.getMapLayers()!=null) {
|
||||
for (String type : profile.getMapLayers().keySet()) {
|
||||
System.out.println("key: "+type+", value: "+profile.getMapLayers().get(type));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
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.products.ConcessioneDV;
|
||||
|
||||
|
||||
/**
|
||||
* The Class GeoNaDataObject.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Oct 29, 2020
|
||||
*/
|
||||
public class GeoNaDataObject implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5566069859060851625L;
|
||||
/** The form data entry fields. */
|
||||
private List<FeatureRow> features;
|
||||
private ProductType productType;
|
||||
private LayerItem layerItem;
|
||||
private ConcessioneDV concessioneDV;
|
||||
|
||||
/**
|
||||
* Instantiates a new geo na data object.
|
||||
*/
|
||||
public GeoNaDataObject(){
|
||||
|
||||
}
|
||||
|
||||
public List<FeatureRow> getFeatures() {
|
||||
return features;
|
||||
}
|
||||
|
||||
public void setFeatures(List<FeatureRow> features) {
|
||||
this.features = features;
|
||||
}
|
||||
|
||||
public ProductType getProductType() {
|
||||
return productType;
|
||||
}
|
||||
|
||||
public void setProductType(ProductType productType) {
|
||||
this.productType = productType;
|
||||
}
|
||||
|
||||
public LayerItem getLayerItem() {
|
||||
return layerItem;
|
||||
}
|
||||
|
||||
public void setLayerItem(LayerItem layerItem) {
|
||||
this.layerItem = layerItem;
|
||||
}
|
||||
|
||||
public ConcessioneDV getConcessioneDV() {
|
||||
return concessioneDV;
|
||||
}
|
||||
|
||||
public void setConcessioneDV(ConcessioneDV concessioneDV) {
|
||||
this.concessioneDV = concessioneDV;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GeoNaDataObject [features=");
|
||||
builder.append(features);
|
||||
builder.append(", productType=");
|
||||
builder.append(productType);
|
||||
builder.append(", layerItem=");
|
||||
builder.append(layerItem);
|
||||
builder.append(", concessioneDV=");
|
||||
builder.append(concessioneDV);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
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 13, 2020
|
||||
*/
|
||||
public class GeoNaDataViewerProfile implements IsSerializable, Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8583236018312392009L;
|
||||
private String restrictedPortletURL;
|
||||
private String openPortletURL;
|
||||
//the key is the layer type
|
||||
private Map<String, LayerItem> mapLayers;
|
||||
|
||||
/**
|
||||
* Instantiates a new geo na data viewer profile.
|
||||
*/
|
||||
public GeoNaDataViewerProfile() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the restricted portlet URL.
|
||||
*
|
||||
* @return the restricted portlet URL
|
||||
*/
|
||||
public String getRestrictedPortletURL() {
|
||||
return restrictedPortletURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the restricted portlet URL.
|
||||
*
|
||||
* @param restrictedPortletURL the new restricted portlet URL
|
||||
*/
|
||||
public void setRestrictedPortletURL(String restrictedPortletURL) {
|
||||
this.restrictedPortletURL = restrictedPortletURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the open portlet URL.
|
||||
*
|
||||
* @return the open portlet URL
|
||||
*/
|
||||
public String getOpenPortletURL() {
|
||||
return openPortletURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the open portlet URL.
|
||||
*
|
||||
* @param openPortletURL the new open portlet URL
|
||||
*/
|
||||
public void setOpenPortletURL(String openPortletURL) {
|
||||
this.openPortletURL = openPortletURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GeoNaDataViewerProfile [restrictedPortletURL=");
|
||||
builder.append(restrictedPortletURL);
|
||||
builder.append(", openPortletURL=");
|
||||
builder.append(openPortletURL);
|
||||
builder.append(", mapLayers=");
|
||||
builder.append(mapLayers);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* The Class GeoNaItemRef.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 17, 2020
|
||||
*/
|
||||
public class GeoNaItemRef implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -7021431511279022193L;
|
||||
|
||||
private Long itemId;
|
||||
private String itemType;
|
||||
private String itemName;
|
||||
|
||||
private PublicLink restrictedLink;
|
||||
private PublicLink openLink;
|
||||
|
||||
/**
|
||||
* Instantiates a new geo na object.
|
||||
*/
|
||||
public GeoNaItemRef() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new geo na object.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @param itemType the item type
|
||||
*/
|
||||
public GeoNaItemRef(Long itemId, String itemType) {
|
||||
super();
|
||||
this.itemId = itemId;
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item id.
|
||||
*
|
||||
* @return the item id
|
||||
*/
|
||||
public Long getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the item id.
|
||||
*
|
||||
* @param itemId the new item id
|
||||
*/
|
||||
public void setItemId(Long itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item type.
|
||||
*
|
||||
* @return the item type
|
||||
*/
|
||||
public String getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the item type.
|
||||
*
|
||||
* @param itemType the new item type
|
||||
*/
|
||||
public void setItemType(String itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item name.
|
||||
*
|
||||
* @return the item name
|
||||
*/
|
||||
public String getItemName() {
|
||||
return itemName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the item name.
|
||||
*
|
||||
* @param itemName the new item name
|
||||
*/
|
||||
public void setItemName(String itemName) {
|
||||
this.itemName = itemName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the restricted link.
|
||||
*
|
||||
* @return the restricted link
|
||||
*/
|
||||
public PublicLink getRestrictedLink() {
|
||||
return restrictedLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the restricted link.
|
||||
*
|
||||
* @param restrictedLink the new restricted link
|
||||
*/
|
||||
public void setRestrictedLink(PublicLink restrictedLink) {
|
||||
this.restrictedLink = restrictedLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the open link.
|
||||
*
|
||||
* @return the open link
|
||||
*/
|
||||
public PublicLink getOpenLink() {
|
||||
return openLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the open link.
|
||||
*
|
||||
* @param openLink the new open link
|
||||
*/
|
||||
public void setOpenLink(PublicLink openLink) {
|
||||
this.openLink = openLink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GeoNaItemRef [itemId=");
|
||||
builder.append(itemId);
|
||||
builder.append(", itemType=");
|
||||
builder.append(itemType);
|
||||
builder.append(", itemName=");
|
||||
builder.append(itemName);
|
||||
builder.append(", restrictedLink=");
|
||||
builder.append(restrictedLink);
|
||||
builder.append(", openLink=");
|
||||
builder.append(openLink);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
|
||||
|
||||
/**
|
||||
* The Class GeoNaSpatialQueryResult.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 17, 2020
|
||||
*/
|
||||
public class GeoNaSpatialQueryResult implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3513120677727206958L;
|
||||
private List<FeatureRow> features;
|
||||
private LayerObject sourceLayerObject;
|
||||
// Map with couple (id concessione, list of uplaoded Images for the concessione)
|
||||
private Map<Long, List<UploadedImageDV>> mapImages = null;
|
||||
|
||||
/**
|
||||
* Instantiates a new geo na data object.
|
||||
*/
|
||||
public GeoNaSpatialQueryResult() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the features.
|
||||
*
|
||||
* @return the features
|
||||
*/
|
||||
public List<FeatureRow> getFeatures() {
|
||||
return features;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the features.
|
||||
*
|
||||
* @param features the new features
|
||||
*/
|
||||
public void setFeatures(List<FeatureRow> features) {
|
||||
this.features = features;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source layer object.
|
||||
*
|
||||
* @return the source layer object
|
||||
*/
|
||||
public LayerObject getSourceLayerObject() {
|
||||
return sourceLayerObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the source layer object.
|
||||
*
|
||||
* @param sourceLayerObject the new source layer object
|
||||
*/
|
||||
public void setSourceLayerObject(LayerObject sourceLayerObject) {
|
||||
this.sourceLayerObject = sourceLayerObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the map images.
|
||||
*
|
||||
* @return the map images
|
||||
*/
|
||||
public Map<Long, List<UploadedImageDV>> getMapImages() {
|
||||
return mapImages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the map images.
|
||||
*
|
||||
* @param mapImages the map images
|
||||
*/
|
||||
public void setMapImages(Map<Long, List<UploadedImageDV>> mapImages) {
|
||||
this.mapImages = mapImages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GeoNaSpatialQueryResult [features=");
|
||||
builder.append(features);
|
||||
builder.append(", sourceLayerObject=");
|
||||
builder.append(sourceLayerObject);
|
||||
builder.append(", mapImages=");
|
||||
builder.append(mapImages);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared;
|
||||
|
||||
public enum ProductType {
|
||||
|
||||
CONCESSIONE
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* The Class PublicLink.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
||||
* Sep 13, 2016
|
||||
*/
|
||||
public class PublicLink implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8157172818802297440L;
|
||||
|
||||
private String completeURL;
|
||||
private String shortURL;
|
||||
|
||||
/**
|
||||
* Instantiates a new public link.
|
||||
*/
|
||||
public PublicLink() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new public link.
|
||||
*
|
||||
* @param completeURL the complete url
|
||||
* @param shortURL the short url
|
||||
*/
|
||||
public PublicLink(String completeURL, String shortURL) {
|
||||
super();
|
||||
this.completeURL = completeURL;
|
||||
this.shortURL = shortURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the complete url.
|
||||
*
|
||||
* @return the completeURL
|
||||
*/
|
||||
public String getCompleteURL() {
|
||||
return completeURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the short url.
|
||||
*
|
||||
* @return the shortURL
|
||||
*/
|
||||
public String getShortURL() {
|
||||
return shortURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the complete url.
|
||||
*
|
||||
* @param completeURL the completeURL to set
|
||||
*/
|
||||
public void setCompleteURL(String completeURL) {
|
||||
this.completeURL = completeURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the short url.
|
||||
*
|
||||
* @param shortURL the shortURL to set
|
||||
*/
|
||||
public void setShortURL(String shortURL) {
|
||||
this.shortURL = shortURL;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("PublicLink [completeURL=");
|
||||
builder.append(completeURL);
|
||||
builder.append(", shortURL=");
|
||||
builder.append(shortURL);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared;
|
||||
|
||||
/**
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
||||
* Sep 4, 2013
|
||||
*
|
||||
*/
|
||||
public class SessionExpiredException extends Exception{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8423680645305738442L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public SessionExpiredException() {
|
||||
super("Session expired");
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* The Class LayerObject.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 13, 2020
|
||||
*/
|
||||
public class LayerObject implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -2282478701630148774L;
|
||||
/* This is the layer/product type. E.g. Concessione */
|
||||
private String itemType;
|
||||
private LayerItem layerItem;
|
||||
|
||||
/**
|
||||
* Instantiates a new layer object.
|
||||
*/
|
||||
public LayerObject() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item type.
|
||||
*
|
||||
* @return the item type
|
||||
*/
|
||||
public String getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the item type.
|
||||
*
|
||||
* @param itemType the new item type
|
||||
*/
|
||||
public void setItemType(String itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the layer item.
|
||||
*
|
||||
* @return the layer item
|
||||
*/
|
||||
public LayerItem getLayerItem() {
|
||||
return layerItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the layer item.
|
||||
*
|
||||
* @param layerItem the new layer item
|
||||
*/
|
||||
public void setLayerItem(LayerItem layerItem) {
|
||||
this.layerItem = layerItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("LayerObject [itemType=");
|
||||
builder.append(itemType);
|
||||
builder.append(", layerItem=");
|
||||
builder.append(layerItem);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* The Class Coordinate.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 16, 2020
|
||||
*/
|
||||
public class Coordinate implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3352677110683481305L;
|
||||
|
||||
private Double x;
|
||||
private Double y;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new coordinate.
|
||||
*/
|
||||
public Coordinate() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new coordinate.
|
||||
*
|
||||
* @param x the x
|
||||
* @param y the y
|
||||
*/
|
||||
public Coordinate(Double x, Double y) {
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public Double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(Double x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public Double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(Double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Coordinate [x=");
|
||||
builder.append(x);
|
||||
builder.append(", y=");
|
||||
builder.append(y);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
/**
|
||||
* The Class PointsPath.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 16, 2020
|
||||
*/
|
||||
public class PointsPath implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3295493507974317970L;
|
||||
|
||||
private Coordinate[] coordinates;
|
||||
|
||||
/**
|
||||
* Instantiates a new points path.
|
||||
*/
|
||||
public PointsPath() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new points path.
|
||||
*
|
||||
* @param coordinates the coordinates
|
||||
*/
|
||||
public PointsPath(Coordinate[] coordinates) {
|
||||
super();
|
||||
this.coordinates = coordinates;
|
||||
}
|
||||
|
||||
public Coordinate[] getCoordinates() {
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("PointsPath [coordinates=");
|
||||
builder.append(Arrays.toString(coordinates));
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs;
|
||||
|
||||
|
||||
/**
|
||||
* The Interface WFSGeometry.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 16, 2020
|
||||
*/
|
||||
public interface WFSGeometry {
|
||||
|
||||
/**
|
||||
* Gets the type.
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
String getType();
|
||||
|
||||
|
||||
/**
|
||||
* Gets the path.
|
||||
*
|
||||
* @return the path
|
||||
*/
|
||||
PointsPath getPath();
|
||||
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared.products;
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared.products.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.SDILayerDescriptorDV;
|
||||
|
||||
public class LayerConcessioneDV extends SDILayerDescriptorDV {
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class LayerConcessioneDV extends SDILayerDescriptorDV implements IsSerializable, Serializable{
|
||||
|
||||
/**
|
||||
*
|
@ -1,4 +1,4 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared.products;
|
||||
package org.gcube.portlets.user.geoportaldataviewer.shared.products.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
@ -0,0 +1,38 @@
|
||||
package org.gcube.portlets.user.geoportaldataviewer;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.portlets.user.urlshortener.UrlShortener;
|
||||
|
||||
public class TestShortener {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
String toShort = "https://next.d4science.org/group/nextnext/geona-data-viewer";
|
||||
String[] splitted = toShort.split("\\?");
|
||||
System.out.println("Splitted is: "+Arrays.asList(splitted));
|
||||
String link = toShort;
|
||||
if (splitted.length > 1) {
|
||||
String encodedQuery = splitted[1];
|
||||
|
||||
try {
|
||||
encodedQuery = URLEncoder.encode(splitted[1], "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
System.out.println("encodedQuery is: "+encodedQuery);
|
||||
link = String.format("%s?%s", splitted[0], encodedQuery);
|
||||
}
|
||||
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
||||
UrlShortener shortener = new UrlShortener();
|
||||
System.out.println(shortener.shorten(link));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue