Collections support
This commit is contained in:
parent
529ff44dc1
commit
b15dbf8a81
|
@ -30,6 +30,8 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.IndexLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
@ -272,6 +274,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
GWT.log("!! Collection "+collId+" is not available");
|
||||
Window.alert("Collection "+collId+" is not found.");
|
||||
}else {
|
||||
try {
|
||||
|
||||
GCubeCollection toOpen = GeoportalDataViewer.getStatus().getConfig().getAvailableCollections().get(collId);
|
||||
|
||||
// Check if indexes is empty
|
||||
|
@ -284,9 +288,15 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
IndexLayer layer = toOpen.getIndexes().get(0);
|
||||
// Open Index Layer
|
||||
|
||||
layerManager.addIndexLayer(layer);
|
||||
GWT.log("Opening index "+layer);
|
||||
|
||||
LayerObject toAdd = new LayerObject(toOpen.getUcd().getId(), layer, LayerItem.fromIndex(layer));
|
||||
layerManager.addLayer(toAdd);
|
||||
|
||||
}catch(Throwable t) {
|
||||
GWT.log("Unable to open collection.",t);
|
||||
Window.alert("Unable to open collection. Please contact administrators.");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -299,7 +309,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
// ???
|
||||
// Open details popup (if called on startup)
|
||||
// Opens layer manager panel
|
||||
|
||||
|
||||
|
||||
try {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -55,7 +55,7 @@ public class ViewerStatus {
|
|||
openedIndexes.get(ucid).add(indexId);
|
||||
}
|
||||
|
||||
public void addOpenedProject(String ucid, String projectId, LayerObject projectLayer) {
|
||||
public void addOpenedProjectLayer(String ucid, String projectId, LayerObject projectLayer) {
|
||||
if(openedProjects==null) openedProjects=new HashMap<String, Map<String,List<LayerObject>>>();
|
||||
if(!openedProjects.containsKey(ucid)) openedProjects.put(ucid, new HashMap<String, List<LayerObject>>());
|
||||
Map<String,List<LayerObject>> map=openedProjects.get(ucid);
|
||||
|
|
|
@ -11,12 +11,12 @@ public class OpenCollectionEvent extends GwtEvent<OpenCollectionEventHandler> {
|
|||
|
||||
@Override
|
||||
public Type<OpenCollectionEventHandler> getAssociatedType() {
|
||||
return null;
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatch(OpenCollectionEventHandler h) {
|
||||
|
||||
h.onOpenCollection(this);
|
||||
}
|
||||
|
||||
public OpenCollectionEvent(String collectionId) {
|
||||
|
|
|
@ -166,7 +166,7 @@ public class LightOpenLayerMap {
|
|||
map.addInteraction(new KeyboardPan());
|
||||
map.addInteraction(new KeyboardZoom());
|
||||
|
||||
List<BaseMapLayer> listBaseMapLayers = GeoportalDataViewer.getListBaseMapLayers();
|
||||
List<BaseMapLayer> listBaseMapLayers = GeoportalDataViewer.getStatus().getConfig().getBaseLayers();
|
||||
BaseMapLayer bml = null;
|
||||
if(listBaseMapLayers!=null)
|
||||
bml = listBaseMapLayers.get(0);
|
||||
|
|
|
@ -59,6 +59,7 @@ import ol.source.ImageWmsParams;
|
|||
import ol.source.Osm;
|
||||
import ol.source.Source;
|
||||
import ol.source.Vector;
|
||||
import ol.source.WmsServerType;
|
||||
import ol.source.Xyz;
|
||||
import ol.source.XyzOptions;
|
||||
|
||||
|
@ -435,14 +436,7 @@ public abstract class OpenLayerMap {
|
|||
|
||||
|
||||
|
||||
public void openLayer(LayerItem toOpen) {
|
||||
|
||||
// Check type
|
||||
switch() {
|
||||
case INDEX_LAYER
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -453,6 +447,8 @@ public abstract class OpenLayerMap {
|
|||
*/
|
||||
public synchronized void addWMSDetailLayer(LayerItem layerItem) {
|
||||
|
||||
GWT.log("Adding WMS Detail Layer on map "+layerItem);
|
||||
|
||||
if (wmsDetailsLayerMap == null)
|
||||
wmsDetailsLayerMap = new LinkedHashMap<String, Image>();
|
||||
|
||||
|
@ -464,9 +460,14 @@ public abstract class OpenLayerMap {
|
|||
GWT.log("The detail layer with key: " + key + " does not exist, creating and adding it to map");
|
||||
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||
imageWMSParams.setLayers(layerItem.getName());
|
||||
|
||||
|
||||
|
||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
||||
|
||||
imageWMSOptions.setServerType(WmsServerType.GEOSERVER);
|
||||
imageWMSOptions.setUrl(layerItem.getWmsLink().substring(0, layerItem.getWmsLink().lastIndexOf("?")));
|
||||
|
||||
imageWMSOptions.setParams(imageWMSParams);
|
||||
// imageWMSOptions.setRatio(1.5f);
|
||||
|
||||
|
|
|
@ -60,10 +60,12 @@ public class DragDropLayer extends FlowPanel {
|
|||
this.labelLayerName.setTitle(layerItem.getName());
|
||||
this.labelLayerName.setType(LabelType.INFO);
|
||||
|
||||
BaseConcessioneDV refConcessione = layerObject.getSourceConcessione();
|
||||
String nameConcessione = StringUtil.ellipsize(refConcessione.getNome(), 40);
|
||||
// TODO Manage Collection
|
||||
|
||||
// BaseConcessioneDV refConcessione = layerObject.getSourceConcessione();
|
||||
String nameConcessione = StringUtil.ellipsize("TODO : UCD", 40);
|
||||
com.google.gwt.user.client.ui.Label labelConcessione = new com.google.gwt.user.client.ui.Label(nameConcessione);
|
||||
labelConcessione.setTitle(refConcessione.getNome());
|
||||
labelConcessione.setTitle("TODO : PROJECT");
|
||||
|
||||
getElement().getStyle().setMarginTop(5, Unit.PX);
|
||||
getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||
|
|
|
@ -105,7 +105,9 @@ public class MapView extends Composite {
|
|||
}
|
||||
|
||||
protected void setBaseLayers() {
|
||||
List<BaseMapLayer> listBaseLayers = GeoportalDataViewer.getListBaseMapLayers();
|
||||
|
||||
// TODO pass layers as parameters?
|
||||
List<BaseMapLayer> listBaseLayers = GeoportalDataViewer.getStatus().getConfig().getBaseLayers();
|
||||
|
||||
if(listBaseLayers==null)
|
||||
return;
|
||||
|
|
|
@ -790,7 +790,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
// ************** LOAD AVAILABLE COLLECTIONS
|
||||
|
||||
LOG.debug("Loading available collections.. ");
|
||||
config.setAvailableCollections(new ArrayList<GCubeCollection>());
|
||||
config.setAvailableCollections(new HashMap<String,GCubeCollection>());
|
||||
|
||||
// TODO filter by
|
||||
// configured ?
|
||||
|
@ -844,7 +844,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
// Return only if gis indexed
|
||||
if(coll.getIndexes().isEmpty())
|
||||
LOG.info("No available GIS Index for collection "+coll.getUcd().getName());
|
||||
else config.getAvailableCollections().add(coll);
|
||||
else config.getAvailableCollections().put(coll.getUcd().getId(),coll);
|
||||
|
||||
}catch(Throwable t) {
|
||||
LOG.warn("Invalid UCD, can't translate to DV. UCID : "+u.getId(),t);
|
||||
|
|
|
@ -11,10 +11,10 @@ public class ViewerConfiguration implements IsSerializable{
|
|||
|
||||
|
||||
//TODO BaseLayers
|
||||
public List<BaseMapLayer> baseLayers;
|
||||
private List<BaseMapLayer> baseLayers;
|
||||
|
||||
|
||||
public Map<String,GCubeCollection> availableCollections;
|
||||
private Map<String,GCubeCollection> availableCollections;
|
||||
|
||||
|
||||
public List<BaseMapLayer> getBaseLayers() {
|
||||
|
|
|
@ -20,6 +20,35 @@ public class GCubeSDILayerDV implements IsSerializable{
|
|||
private BBOXDV bbox;
|
||||
@JsonProperty(value = "_ogcLinks")
|
||||
private HashMap<String,String> ogcLinks;
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
public List<GeoServerPlatformInfoDV> getPlatformInfos() {
|
||||
return platformInfos;
|
||||
}
|
||||
public void setPlatformInfos(List<GeoServerPlatformInfoDV> platformInfos) {
|
||||
this.platformInfos = platformInfos;
|
||||
}
|
||||
public BBOXDV getBbox() {
|
||||
return bbox;
|
||||
}
|
||||
public void setBbox(BBOXDV bbox) {
|
||||
this.bbox = bbox;
|
||||
}
|
||||
public HashMap<String, String> getOgcLinks() {
|
||||
return ogcLinks;
|
||||
}
|
||||
public void setOgcLinks(HashMap<String, String> ogcLinks) {
|
||||
this.ogcLinks = ogcLinks;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GCubeSDILayerDV [type=" + type + ", platformInfos=" + platformInfos + ", bbox=" + bbox + ", ogcLinks="
|
||||
+ ogcLinks + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -11,11 +11,13 @@ public class GeoServerPlatformInfoDV implements IsSerializable{
|
|||
private String type;
|
||||
private String workspace;
|
||||
private String storeName;
|
||||
private String layerName;
|
||||
|
||||
|
||||
|
||||
@JsonProperty(value = "_host")
|
||||
private String host;
|
||||
|
||||
private Map<String,String> ogcLinks;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
|
@ -49,13 +51,21 @@ public class GeoServerPlatformInfoDV implements IsSerializable{
|
|||
this.host = host;
|
||||
}
|
||||
|
||||
public Map<String, String> getOgcLinks() {
|
||||
return ogcLinks;
|
||||
|
||||
public String getLayerName() {
|
||||
return layerName;
|
||||
}
|
||||
|
||||
public void setLayerName(String layerName) {
|
||||
this.layerName = layerName;
|
||||
}
|
||||
|
||||
public void setOgcLinks(Map<String, String> ogcLinks) {
|
||||
this.ogcLinks = ogcLinks;
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GeoServerPlatformInfoDV [type=" + type + ", workspace=" + workspace + ", storeName=" + storeName
|
||||
+ ", layerName=" + layerName + ", host=" + host + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -46,6 +46,11 @@ public class IndexLayer implements IsSerializable{
|
|||
public void setFlag(String flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IndexLayer [type=" + type + ", layer=" + layer + ", indexName=" + indexName + ", records=" + records
|
||||
+ ", flag=" + flag + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Map;
|
|||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization.GeoServerPlatformInfoDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.Property;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
||||
|
||||
|
@ -969,6 +970,33 @@ public class LayerItem implements Serializable, Cloneable {
|
|||
}
|
||||
|
||||
|
||||
public static LayerItem fromIndex(IndexLayer layer) {
|
||||
|
||||
// Assuming only GS platform
|
||||
GeoServerPlatformInfoDV gsInfo = layer.getLayer().getPlatformInfos().get(0);
|
||||
|
||||
|
||||
GWT.log("PlatformInfo is "+gsInfo);
|
||||
|
||||
return new LayerItem(LayerType.FEATURE_TYPE,
|
||||
layer.getIndexName(),
|
||||
gsInfo.getWorkspace()+":"+gsInfo.getLayerName(),
|
||||
layer.getLayer().getOgcLinks().get("wms"), // ??
|
||||
gsInfo.getHost(),
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
null,
|
||||
layer.getLayer().getOgcLinks().get("wms"),
|
||||
true,
|
||||
null,
|
||||
false,
|
||||
null,
|
||||
null, // TODO ZAXIS
|
||||
null, // NO restrictions on resolution
|
||||
null);
|
||||
}
|
||||
|
||||
/**
|
||||
* To layer item.
|
||||
*
|
||||
|
@ -992,30 +1020,28 @@ public class LayerItem implements Serializable, Cloneable {
|
|||
* @return the layer item
|
||||
*/
|
||||
|
||||
|
||||
// TODO Constructor from IndexLayer, GCUBESDILAeryDV or direct info
|
||||
private LayerItem toLayerItem(LayerType layerType, String layerTitle, String layerName, String layerURL,
|
||||
private LayerItem(LayerType layerType, String layerTitle, String layerName, String layerURL,
|
||||
String mapServerHost, boolean isExternal, boolean isBase, boolean displayInLayerSwitcher,
|
||||
ArrayList<String> styles, String wmsLink, boolean onTop, HashMap<String, String> wmsNotStandardParams,
|
||||
boolean isNcWms, String UUID, ZAxis zAxis, Double minResolution, Double maxResolution) {
|
||||
|
||||
// GWT.log("Add addLayerByWms 1");
|
||||
LayerItem layerItem = new LayerItem();
|
||||
layerItem.setBaseLayer(isBase);
|
||||
layerItem.setTitle(layerTitle);
|
||||
layerItem.setName(layerName);
|
||||
layerItem.setUrl(layerURL);
|
||||
layerItem.setMapServerHost(mapServerHost);
|
||||
|
||||
this.setBaseLayer(isBase);
|
||||
this.setTitle(layerTitle);
|
||||
this.setName(layerName);
|
||||
this.setUrl(layerURL);
|
||||
this.setMapServerHost(mapServerHost);
|
||||
// l.setExternal(isExternal);
|
||||
layerItem.setOpacity(1d);
|
||||
layerItem.setBuffer(2);
|
||||
layerItem.setWmsLink(wmsLink);
|
||||
layerItem.setWmsNotStandardParams(wmsNotStandardParams);
|
||||
layerItem.setNcWms(isNcWms);
|
||||
layerItem.setUUID(UUID);
|
||||
layerItem.setZAxis(zAxis);
|
||||
layerItem.setMinResolution(minResolution);
|
||||
layerItem.setMaxResolution(maxResolution);
|
||||
this.setOpacity(1d);
|
||||
this.setBuffer(2);
|
||||
this.setWmsLink(wmsLink);
|
||||
this.setWmsNotStandardParams(wmsNotStandardParams);
|
||||
this.setNcWms(isNcWms);
|
||||
this.setUUID(UUID);
|
||||
this.setZAxis(zAxis);
|
||||
this.setMinResolution(minResolution);
|
||||
this.setMaxResolution(maxResolution);
|
||||
|
||||
switch (layerType) {
|
||||
|
||||
|
@ -1023,17 +1049,17 @@ public class LayerItem implements Serializable, Cloneable {
|
|||
case RASTER_BASELAYER:
|
||||
|
||||
// l.setHasLegend(false);
|
||||
layerItem.setBaseLayer(true);
|
||||
layerItem.setTrasparent(false);
|
||||
layerItem.setClickData(false);
|
||||
this.setBaseLayer(true);
|
||||
this.setTrasparent(false);
|
||||
this.setClickData(false);
|
||||
break;
|
||||
|
||||
case FEATURE_TYPE:
|
||||
|
||||
// CASE FEATURE TYPE
|
||||
layerItem.setBaseLayer(false);
|
||||
layerItem.setClickData(true);
|
||||
layerItem.setTrasparent(true);
|
||||
this.setBaseLayer(false);
|
||||
this.setClickData(true);
|
||||
this.setTrasparent(true);
|
||||
break;
|
||||
|
||||
}
|
||||
|
@ -1041,19 +1067,21 @@ public class LayerItem implements Serializable, Cloneable {
|
|||
GWT.log("styles " + styles);
|
||||
|
||||
if (styles != null && styles.size() > 0) {
|
||||
layerItem.setHasLegend(true);
|
||||
layerItem.setDefaultStyle(styles.get(0));
|
||||
layerItem.setStyle(styles.get(0));
|
||||
layerItem.setStyles(styles);
|
||||
this.setHasLegend(true);
|
||||
this.setDefaultStyle(styles.get(0));
|
||||
this.setStyle(styles.get(0));
|
||||
this.setStyles(styles);
|
||||
} else {
|
||||
String style = URLUtil.getValueOfParameter("styles", wmsLink);
|
||||
if (style != null) { // CASE OF STYLE ="";
|
||||
// TENTATIVE TO GET LEGEND
|
||||
layerItem.setHasLegend(true);
|
||||
this.setHasLegend(true);
|
||||
}
|
||||
}
|
||||
GWT.log("Built layer: " + layerItem);
|
||||
return layerItem;
|
||||
GWT.log("Built layer: " + this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,27 +1,21 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer;
|
||||
|
||||
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
|
||||
|
||||
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||
import org.gcube.application.geoportal.common.rest.UseCaseDescriptorsI;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.ucd.UCD;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ModelConversionTests {
|
||||
|
||||
@Test
|
||||
public void testGetUCD() throws Exception {
|
||||
TokenSetter.set("/gcube/devsec/devVRE");
|
||||
UseCaseDescriptorsI client = useCaseDescriptors().build();
|
||||
client.query(new QueryRequest()).forEachRemaining(u->{
|
||||
|
||||
System.out.println(u.getName());
|
||||
|
||||
UCD ucd = Serialization.convert(u, UCD.class);
|
||||
System.out.println(ucd.getName());
|
||||
|
||||
});
|
||||
// TokenSetter.set("/gcube/devsec/devVRE");
|
||||
// UseCaseDescriptorsI client = useCaseDescriptors().build();
|
||||
// client.query(new QueryRequest()).forEachRemaining(u->{
|
||||
//
|
||||
// System.out.println(u.getName());
|
||||
//
|
||||
// UCD ucd = Serialization.convert(u, UCD.class);
|
||||
// System.out.println(ucd.getName());
|
||||
//
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue