working on layer view
This commit is contained in:
parent
654ca73dcf
commit
fe9afe0bc2
|
@ -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(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsMethod(name = "getCenter", namespace = PACKAGE_EXTENT)
|
||||||
|
private static native Coordinate getCenter(Extent extent);
|
||||||
|
|
||||||
|
}
|
|
@ -5,6 +5,8 @@ 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;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
import ol.Feature;
|
import ol.Feature;
|
||||||
import ol.Map;
|
import ol.Map;
|
||||||
|
@ -18,6 +20,7 @@ import ol.event.EventListener;
|
||||||
import ol.geom.Point;
|
import ol.geom.Point;
|
||||||
import ol.interaction.KeyboardPan;
|
import ol.interaction.KeyboardPan;
|
||||||
import ol.interaction.KeyboardZoom;
|
import ol.interaction.KeyboardZoom;
|
||||||
|
import ol.layer.Image;
|
||||||
import ol.layer.LayerOptions;
|
import ol.layer.LayerOptions;
|
||||||
import ol.layer.Tile;
|
import ol.layer.Tile;
|
||||||
import ol.layer.VectorLayerOptions;
|
import ol.layer.VectorLayerOptions;
|
||||||
|
@ -34,6 +37,13 @@ import ol.style.Style;
|
||||||
import ol.style.Text;
|
import ol.style.Text;
|
||||||
import ol.style.TextOptions;
|
import ol.style.TextOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class LightOpenLayerOSM.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Nov 11, 2020
|
||||||
|
*/
|
||||||
public class LightOpenLayerOSM {
|
public class LightOpenLayerOSM {
|
||||||
|
|
||||||
/** The map. */
|
/** The map. */
|
||||||
|
@ -48,7 +58,6 @@ import ol.style.TextOptions;
|
||||||
/** The projection options. */
|
/** The projection options. */
|
||||||
private ProjectionOptions projectionOptions = OLFactory.createOptions();
|
private ProjectionOptions projectionOptions = OLFactory.createOptions();
|
||||||
|
|
||||||
|
|
||||||
private boolean isQueryPointActive;
|
private boolean isQueryPointActive;
|
||||||
|
|
||||||
private ol.layer.Vector geometryLayer;
|
private ol.layer.Vector geometryLayer;
|
||||||
|
@ -60,7 +69,6 @@ import ol.style.TextOptions;
|
||||||
* Instantiates a new open layer OSM.
|
* Instantiates a new open layer OSM.
|
||||||
*
|
*
|
||||||
* @param divTargetId the div target id
|
* @param divTargetId the div target id
|
||||||
* @param eventBus the event bus
|
|
||||||
*/
|
*/
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see de.desjardins.ol3.demo.client.example.Example#show()
|
* @see de.desjardins.ol3.demo.client.example.Example#show()
|
||||||
|
@ -160,8 +168,10 @@ import ol.style.TextOptions;
|
||||||
*
|
*
|
||||||
* @param mapServerHost the map server host
|
* @param mapServerHost the map server host
|
||||||
* @param layerName the layer name
|
* @param layerName the layer name
|
||||||
|
* @return the image
|
||||||
*/
|
*/
|
||||||
public void addWMSLayer(String mapServerHost, String layerName) {
|
public Image addWMSLayer(String mapServerHost, String layerName) {
|
||||||
|
GWT.log("Adding wmsLayer with mapServerHost: "+mapServerHost+", layerName: "+layerName);
|
||||||
|
|
||||||
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||||
imageWMSParams.setLayers(layerName);
|
imageWMSParams.setLayers(layerName);
|
||||||
|
@ -177,14 +187,21 @@ import ol.style.TextOptions;
|
||||||
layerOptions.setSource(imageWMSSource);
|
layerOptions.setSource(imageWMSSource);
|
||||||
|
|
||||||
ol.layer.Image wmsLayer = new ol.layer.Image(layerOptions);
|
ol.layer.Image wmsLayer = new ol.layer.Image(layerOptions);
|
||||||
|
|
||||||
//visibleLayerItems
|
//visibleLayerItems
|
||||||
|
|
||||||
map.addLayer(wmsLayer);
|
map.addLayer(wmsLayer);
|
||||||
|
|
||||||
|
return wmsLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
public void addPoint(Coordinate coordinate, boolean showCoordinateText) {
|
* 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) {
|
if(geometryLayer!=null) {
|
||||||
map.removeLayer(geometryLayer);
|
map.removeLayer(geometryLayer);
|
||||||
|
@ -192,10 +209,14 @@ import ol.style.TextOptions;
|
||||||
|
|
||||||
}
|
}
|
||||||
Style style = new Style();
|
Style style = new Style();
|
||||||
IconOptions iconOptions = new IconOptions();
|
|
||||||
iconOptions.setSrc(markerURL);
|
if(asMarker) {
|
||||||
Icon icon = new Icon(iconOptions);
|
IconOptions iconOptions = new IconOptions();
|
||||||
style.setImage(icon);
|
iconOptions.setSrc(markerURL);
|
||||||
|
Icon icon = new Icon(iconOptions);
|
||||||
|
style.setImage(icon);
|
||||||
|
}
|
||||||
|
|
||||||
if(showCoordinateText) {
|
if(showCoordinateText) {
|
||||||
TextOptions textOptions = new TextOptions();
|
TextOptions textOptions = new TextOptions();
|
||||||
textOptions.setOffsetY(-25);
|
textOptions.setOffsetY(-25);
|
||||||
|
@ -210,12 +231,6 @@ import ol.style.TextOptions;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// FillOptions fillOptions = new FillOptions();
|
|
||||||
//fillOptions.setColor(new Color(red, green, blue, alpha));
|
|
||||||
//style.setFill(new Fill(fillOptions));
|
|
||||||
// style.setFillColor("#00FF00");
|
|
||||||
// style.setGraphicName("circle");
|
|
||||||
// style.setPointRadius(10);
|
|
||||||
Point thePoint = new Point(coordinate);
|
Point thePoint = new Point(coordinate);
|
||||||
Feature vf = new Feature(thePoint);
|
Feature vf = new Feature(thePoint);
|
||||||
vf.setStyle(style);
|
vf.setStyle(style);
|
||||||
|
@ -227,6 +242,11 @@ import ol.style.TextOptions;
|
||||||
map.addLayer(geometryLayer);
|
map.addLayer(geometryLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the map.
|
||||||
|
*
|
||||||
|
* @return the map
|
||||||
|
*/
|
||||||
public Map getMap() {
|
public Map getMap() {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -270,10 +290,17 @@ import ol.style.TextOptions;
|
||||||
return this.map.getView().calculateExtent(map.getSize());
|
return this.map.getView().calculateExtent(map.getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform.
|
||||||
|
*
|
||||||
|
* @param centerCoordinate the center coordinate
|
||||||
|
* @param source the source
|
||||||
|
* @param target the target
|
||||||
|
* @return the coordinate
|
||||||
|
*/
|
||||||
public Coordinate transform (Coordinate centerCoordinate, String source, String target){
|
public Coordinate transform (Coordinate centerCoordinate, String source, String target){
|
||||||
return Projection.transform(centerCoordinate, source, target);
|
return Projection.transform(centerCoordinate, source, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.map;
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.map;
|
||||||
|
|
||||||
|
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.LightOpenLayerOSM;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
@ -14,11 +15,27 @@ import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
|
import ol.Extent;
|
||||||
|
import ol.layer.Image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class MapView.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Nov 11, 2020
|
||||||
|
*/
|
||||||
public class MapView extends Composite{
|
public class MapView extends Composite{
|
||||||
|
|
||||||
private static MapViewUiBinder uiBinder = GWT.create(MapViewUiBinder.class);
|
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> {
|
interface MapViewUiBinder extends UiBinder<Widget, MapView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,29 +47,84 @@ import ol.Coordinate;
|
||||||
|
|
||||||
private LightOpenLayerOSM olsm;
|
private LightOpenLayerOSM olsm;
|
||||||
|
|
||||||
public MapView(Double x, Double y, boolean showCoordinate) {
|
// public MapView(Double x, Double y, boolean showCoordinate) {
|
||||||
|
// initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
// String theMapId = "map"+Random.nextInt();
|
||||||
|
// theMap.getElement().setId(theMapId);
|
||||||
|
// //theMap.setSize("300px", "300px");
|
||||||
|
//
|
||||||
|
// Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void execute() {
|
||||||
|
// olsm = new LightOpenLayerOSM(theMapId);
|
||||||
|
// if(x!=null && y!=null) {
|
||||||
|
// Coordinate point = new Coordinate(x, y);
|
||||||
|
// addPoint(point);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new map view.
|
||||||
|
*/
|
||||||
|
public MapView() {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
String theMapId = "map"+Random.nextInt();
|
String theMapId = "map"+Random.nextInt();
|
||||||
theMap.getElement().setId(theMapId);
|
theMap.getElement().setId(theMapId);
|
||||||
//theMap.setSize("300px", "300px");
|
|
||||||
|
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
olsm = new LightOpenLayerOSM(theMapId);
|
olsm = new LightOpenLayerOSM(theMapId);
|
||||||
if(x!=null && y!=null) {
|
|
||||||
Coordinate point = new Coordinate(x, y);
|
|
||||||
addPoint(point);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPoint(Coordinate coordinate){
|
/**
|
||||||
olsm.addPoint(coordinate, true);
|
* Adds the marker.
|
||||||
olsm.getMap().getView().setCenter(coordinate);
|
*
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
public void addWMSLayer(String mapServerHost, String layerName){
|
||||||
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
Image layer = olsm.addWMSLayer(mapServerHost, layerName);
|
||||||
|
Extent ext = layer.getExtent();
|
||||||
|
GWT.log("WMS layer extent: "+ext);
|
||||||
|
if(ext!=null) {
|
||||||
|
ExtentWrapped ew = new ExtentWrapped(ext.getLowerLeftX(), ext.getLowerLeftY(), ext.getUpperRightX(), ext.getUpperRightY());
|
||||||
|
Coordinate center = ew.getCenter();
|
||||||
|
olsm.getMap().getView().setCenter(center);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,24 +8,23 @@ 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.map.MapView;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.LayerConcessioneDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RelazioneScavoDV;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RelazioneScavoDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Label;
|
|
||||||
import com.github.gwtbootstrap.client.ui.PageHeader;
|
import com.github.gwtbootstrap.client.ui.PageHeader;
|
||||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||||
import com.github.gwtbootstrap.client.ui.Thumbnails;
|
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.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
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.HTMLPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
import ol.Coordinate;
|
||||||
|
|
||||||
public class ConcessioneView extends Composite {
|
public class ConcessioneView extends Composite {
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,6 +54,12 @@ public class ConcessioneView extends Composite {
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HTMLPanel mapViewPanel;
|
HTMLPanel mapViewPanel;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel posizionamentoAreaIndaginePanel;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel piantaFineScavoPanel;
|
||||||
|
|
||||||
private ConcessioneDV concessioneDV;
|
private ConcessioneDV concessioneDV;
|
||||||
|
|
||||||
|
@ -145,7 +150,77 @@ public class ConcessioneView extends Composite {
|
||||||
//concessioniPanel.add(new RecordView(concessioneDV));
|
//concessioniPanel.add(new RecordView(concessioneDV));
|
||||||
addCentroidMap();
|
addCentroidMap();
|
||||||
addRelazioneDiScavo();
|
addRelazioneDiScavo();
|
||||||
addImages();
|
addUploadedImages();
|
||||||
|
addPosizionamentoAreaIndagine();
|
||||||
|
addPiantaFineScavo();
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String result) {
|
||||||
|
|
||||||
|
//Authenticated user
|
||||||
|
if(result!=null) {
|
||||||
|
posizionamentoAreaIndaginePanel.setVisible(true);
|
||||||
|
posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String result) {
|
||||||
|
|
||||||
|
//Authenticated user
|
||||||
|
if(result!=null) {
|
||||||
|
piantaFineScavoPanel.setVisible(true);
|
||||||
|
piantaFineScavoPanel.add(new LayerConcessioneView(layer));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addRelazioneDiScavo() {
|
private void addRelazioneDiScavo() {
|
||||||
|
@ -180,11 +255,12 @@ public class ConcessioneView extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCentroidMap() {
|
private void addCentroidMap() {
|
||||||
MapView mapView = new MapView(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat(), true);
|
MapView mapView = new MapView();
|
||||||
|
mapView.addMarker(new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat()), true);
|
||||||
mapViewPanel.add(mapView);
|
mapViewPanel.add(mapView);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addImages() {
|
private void addUploadedImages() {
|
||||||
List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative();
|
List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative();
|
||||||
if (immagini != null && immagini.size() > 0) {
|
if (immagini != null && immagini.size() > 0) {
|
||||||
imagesPanel.setVisible(true);
|
imagesPanel.setVisible(true);
|
||||||
|
@ -199,19 +275,6 @@ public class ConcessioneView extends Composite {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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() {
|
public ConcessioneDV getConcessioneDV() {
|
||||||
return concessioneDV;
|
return concessioneDV;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
|
|
||||||
<ui:style>
|
<ui:style>
|
||||||
.important {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.margin-left-10 {
|
.margin-left-10 {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
@ -15,24 +11,6 @@
|
||||||
.font-size-h1-22 h1 {
|
.font-size-h1-22 h1 {
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
<!--
|
|
||||||
.display-60 {--><!--
|
|
||||||
width: 60%; --> <!--
|
|
||||||
display: inline-block;
|
|
||||||
-->
|
|
||||||
<!--
|
|
||||||
}
|
|
||||||
|
|
||||||
-->
|
|
||||||
<!--
|
|
||||||
.display-400-px {--><!--
|
|
||||||
width: 400px; --> <!--
|
|
||||||
display: inline-block;
|
|
||||||
-->
|
|
||||||
<!--
|
|
||||||
}
|
|
||||||
-->
|
|
||||||
</ui:style>
|
</ui:style>
|
||||||
<g:HTMLPanel ui:field="pageViewDetails">
|
<g:HTMLPanel ui:field="pageViewDetails">
|
||||||
<b:PageHeader ui:field="titolo"></b:PageHeader>
|
<b:PageHeader ui:field="titolo"></b:PageHeader>
|
||||||
|
@ -51,5 +29,14 @@
|
||||||
addStyleNames="{style.margin-left-10}" visible="false">
|
addStyleNames="{style.margin-left-10}" visible="false">
|
||||||
<b:PageHeader addStyleNames="{style.font-size-h1-22}">Immagini Rappresentative</b:PageHeader>
|
<b:PageHeader addStyleNames="{style.font-size-h1-22}">Immagini Rappresentative</b:PageHeader>
|
||||||
</g:HTMLPanel>
|
</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>
|
</g:HTMLPanel>
|
||||||
</ui:UiBinder>
|
</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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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>
|
||||||
|
.important {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel>
|
||||||
|
<g:HorizontalPanel>
|
||||||
|
<g:HTMLPanel ui:field="layerConcessionePanel"></g:HTMLPanel>
|
||||||
|
<g:HTMLPanel ui:field="mapViewPanel">
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</g:HorizontalPanel>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -16,74 +16,70 @@ import org.gcube.application.geoportal.model.content.WorkspaceContent;
|
||||||
public class TestModel {
|
public class TestModel {
|
||||||
|
|
||||||
public static Concessione prepareEmptyConcessione() {
|
public static Concessione prepareEmptyConcessione() {
|
||||||
Concessione concessione=new Concessione();
|
Concessione concessione = new Concessione();
|
||||||
|
|
||||||
// Generic fields
|
// Generic fields
|
||||||
|
|
||||||
|
|
||||||
// Concessione fields
|
// Concessione fields
|
||||||
|
|
||||||
concessione.setNome("Italia, forse");
|
concessione.setNome("Italia, forse");
|
||||||
concessione.setIntroduzione("This is my project");
|
concessione.setIntroduzione("This is my project");
|
||||||
concessione.setDescrizioneContenuto("It contains this and that");
|
concessione.setDescrizioneContenuto("It contains this and that");
|
||||||
|
|
||||||
concessione.setAuthors(Arrays.asList(new String[] {"Some one","Some, oneelse"}));
|
concessione.setAuthors(Arrays.asList(new String[] { "Some one", "Some, oneelse" }));
|
||||||
|
|
||||||
concessione.setContributore("Contrib 1");
|
concessione.setContributore("Contrib 1");
|
||||||
concessione.setTitolari(Arrays.asList(new String[] {"Some one","Some, oneelse"}));
|
concessione.setTitolari(Arrays.asList(new String[] { "Some one", "Some, oneelse" }));
|
||||||
concessione.setResponsabile("Someone");
|
concessione.setResponsabile("Someone");
|
||||||
concessione.setEditore("Editore");
|
concessione.setEditore("Editore");
|
||||||
|
|
||||||
concessione.setFontiFinanziamento(Arrays.asList(new String[] {"Big pharma","Pentagon"}));
|
concessione.setFontiFinanziamento(Arrays.asList(new String[] { "Big pharma", "Pentagon" }));
|
||||||
|
|
||||||
|
concessione.setSoggetto(Arrays.asList(new String[] { "Research Excavation", "Archeology" }));
|
||||||
|
|
||||||
concessione.setSoggetto(Arrays.asList(new String[] {"Research Excavation","Archeology"}));
|
concessione
|
||||||
|
.setRisorseCorrelate(Arrays.asList(new String[] { "https://google.com", "https://www.repubblica.it" }));
|
||||||
concessione.setRisorseCorrelate(Arrays.asList(new String[] {"https://google.com","https://www.repubblica.it"}));
|
|
||||||
|
|
||||||
|
|
||||||
concessione.setDataInizioProgetto(LocalDateTime.now());
|
concessione.setDataInizioProgetto(LocalDateTime.now());
|
||||||
concessione.setDataFineProgetto(LocalDateTime.now());
|
concessione.setDataFineProgetto(LocalDateTime.now());
|
||||||
|
|
||||||
concessione.setLicenzaID("CC-BY");
|
concessione.setLicenzaID("CC-BY");
|
||||||
|
|
||||||
concessione.setTitolareLicenza("Qualcun altro");
|
concessione.setTitolareLicenza("Qualcun altro");
|
||||||
concessione.setTitolareCopyright("Chiedilo in giro");
|
concessione.setTitolareCopyright("Chiedilo in giro");
|
||||||
|
|
||||||
concessione.setParoleChiaveLibere(Arrays.asList(new String[] {"Robba","Stuff"}));
|
concessione.setParoleChiaveLibere(Arrays.asList(new String[] { "Robba", "Stuff" }));
|
||||||
concessione.setParoleChiaveICCD(Arrays.asList(new String[] {"vattelapesca","somthing something"}));
|
concessione.setParoleChiaveICCD(Arrays.asList(new String[] { "vattelapesca", "somthing something" }));
|
||||||
|
|
||||||
concessione.setLastUpdateTime(LocalDateTime.now());
|
concessione.setLastUpdateTime(LocalDateTime.now());
|
||||||
concessione.setCreationTime(LocalDateTime.now());
|
concessione.setCreationTime(LocalDateTime.now());
|
||||||
concessione.setLastUpdateUser("fake user");
|
concessione.setLastUpdateUser("fake user");
|
||||||
|
|
||||||
concessione.setCentroidLat(43.0); //N-S
|
concessione.setCentroidLat(43.0); // N-S
|
||||||
concessione.setCentroidLong(9.0); //E-W
|
concessione.setCentroidLong(9.0); // E-W
|
||||||
|
|
||||||
return concessione;
|
return concessione;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Concessione prepareConcessione() {
|
|
||||||
|
|
||||||
Concessione concessione=prepareEmptyConcessione();
|
|
||||||
|
|
||||||
|
public static Concessione prepareConcessione() {
|
||||||
|
|
||||||
|
Concessione concessione = prepareEmptyConcessione();
|
||||||
|
|
||||||
// Attachments
|
// Attachments
|
||||||
|
|
||||||
// Relazione scavo
|
// Relazione scavo
|
||||||
RelazioneScavo relScavo=new RelazioneScavo();
|
RelazioneScavo relScavo = new RelazioneScavo();
|
||||||
|
|
||||||
relScavo.setAbstractSection("simple abstract section");
|
relScavo.setAbstractSection("simple abstract section");
|
||||||
relScavo.setResponsabili(concessione.getAuthors());
|
relScavo.setResponsabili(concessione.getAuthors());
|
||||||
|
|
||||||
concessione.setRelazioneScavo(relScavo);
|
concessione.setRelazioneScavo(relScavo);
|
||||||
//Immagini rappresentative
|
// Immagini rappresentative
|
||||||
ArrayList<UploadedImage> imgs=new ArrayList<>();
|
ArrayList<UploadedImage> imgs = new ArrayList<>();
|
||||||
for(int i=0;i<5;i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
UploadedImage img=new UploadedImage();
|
UploadedImage img = new UploadedImage();
|
||||||
img.setTitolo("My image number "+i);
|
img.setTitolo("My image number " + i);
|
||||||
img.setDidascalia("You can see my image number "+i);
|
img.setDidascalia("You can see my image number " + i);
|
||||||
img.setFormat("TIFF");
|
img.setFormat("TIFF");
|
||||||
img.setCreationTime(LocalDateTime.now());
|
img.setCreationTime(LocalDateTime.now());
|
||||||
img.setResponsabili(concessione.getAuthors());
|
img.setResponsabili(concessione.getAuthors());
|
||||||
|
@ -95,27 +91,30 @@ public class TestModel {
|
||||||
imgs.add(img);
|
imgs.add(img);
|
||||||
}
|
}
|
||||||
concessione.setImmaginiRappresentative(imgs);
|
concessione.setImmaginiRappresentative(imgs);
|
||||||
//Posizionamento
|
// Posizionamento
|
||||||
LayerConcessione posizionamento=new LayerConcessione();
|
LayerConcessione posizionamento = new LayerConcessione();
|
||||||
posizionamento.setValutazioneQualita("Secondo me si");
|
posizionamento.setValutazioneQualita("Secondo me si");
|
||||||
posizionamento.setMetodoRaccoltaDati("Fattobbene");
|
posizionamento.setMetodoRaccoltaDati("Fattobbene");
|
||||||
posizionamento.setScalaAcquisizione("1:10000");
|
posizionamento.setScalaAcquisizione("1:10000");
|
||||||
posizionamento.setAuthors(concessione.getAuthors());
|
posizionamento.setAuthors(concessione.getAuthors());
|
||||||
concessione.setPosizionamentoScavo(posizionamento);
|
concessione.setPosizionamentoScavo(posizionamento);
|
||||||
|
|
||||||
// Piante fine scavo
|
// Piante fine scavo
|
||||||
ArrayList<LayerConcessione> piante=new ArrayList<LayerConcessione>();
|
ArrayList<LayerConcessione> piante = new ArrayList<LayerConcessione>();
|
||||||
for(int i=0;i<4;i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
LayerConcessione pianta=new LayerConcessione();
|
LayerConcessione pianta = new LayerConcessione();
|
||||||
pianta.setValutazioneQualita("Secondo me si");
|
pianta.setValutazioneQualita("Secondo me si");
|
||||||
pianta.setMetodoRaccoltaDati("Fattobbene");
|
pianta.setMetodoRaccoltaDati("Fattobbene");
|
||||||
pianta.setScalaAcquisizione("1:10000");
|
pianta.setScalaAcquisizione("1:10000");
|
||||||
pianta.setAuthors(concessione.getAuthors());
|
pianta.setAuthors(concessione.getAuthors());
|
||||||
pianta.setPolicy(AccessPolicy.RESTRICTED);
|
pianta.setPolicy(AccessPolicy.RESTRICTED);
|
||||||
|
pianta.setLayerName("gna_conc_12:pos");
|
||||||
|
pianta.setWmsLink(
|
||||||
|
"https://geoserver1.dev.d4science.org/geoserver/gna_conc_12/wms?service=WMS&version=1.1.0&request=GetMap&layers=gna_conc_12:pos&styles=&bbox=8.62091913167495,40.62975046683799,8.621178639172953,40.630257904721645&width=392&height=768&srs=EPSG:4326&format=application/openlayers#toggle");
|
||||||
piante.add(pianta);
|
piante.add(pianta);
|
||||||
}
|
}
|
||||||
concessione.setPianteFineScavo(piante);
|
concessione.setPianteFineScavo(piante);
|
||||||
|
|
||||||
return concessione;
|
return concessione;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue