|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
|
|
|
|
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
|
|
|
@ -12,6 +13,8 @@ import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerCon
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEventHandler;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEventHandler;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
|
|
|
@ -29,7 +32,9 @@ 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.client.ui.GeonaDataViewMainPanel;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
|
|
|
|
|
|
|
|
|
import com.google.gwt.core.client.EntryPoint;
|
|
|
|
@ -89,11 +94,31 @@ public class GeoportalDataViewer implements EntryPoint {
|
|
|
|
|
private OLMapManager olMapMng = null;
|
|
|
|
|
|
|
|
|
|
int attempt = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private LoaderIcon loaderApp = new LoaderIcon("Loading application....");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private HTML attributionDiv = new HTML();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This is the entry point method.
|
|
|
|
|
*/
|
|
|
|
|
public void onModuleLoad() {
|
|
|
|
|
|
|
|
|
|
loaderApp.getElement().getStyle().setZIndex(100);
|
|
|
|
|
|
|
|
|
|
paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER);
|
|
|
|
|
paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE);
|
|
|
|
|
paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID);
|
|
|
|
|
paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE);
|
|
|
|
|
GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest);
|
|
|
|
|
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE + " = " + paramGeonaItemType);
|
|
|
|
|
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + paramGeonaItemID);
|
|
|
|
|
GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle);
|
|
|
|
|
|
|
|
|
|
RootPanel.get(APP_DIV).add(loaderApp);
|
|
|
|
|
|
|
|
|
|
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight());
|
|
|
|
|
RootPanel.get(APP_DIV).add(mainPanel);
|
|
|
|
|
|
|
|
|
@ -102,23 +127,38 @@ public class GeoportalDataViewer implements EntryPoint {
|
|
|
|
|
@Override
|
|
|
|
|
public void execute() {
|
|
|
|
|
|
|
|
|
|
olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),
|
|
|
|
|
layerManager.getLayerManagerBus());
|
|
|
|
|
layerManager.setOlMap(olMapMng.getOLOSMMap());
|
|
|
|
|
mainPanel.setMap(olMapMng.getOLOSMMap());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String attributionHTML = "<div class='map-credits'><div class='map-attribution-container'>"
|
|
|
|
|
+olMapMng.getOLOSMMap().getMapAttribution()+
|
|
|
|
|
"</div></div>";
|
|
|
|
|
|
|
|
|
|
//LOADING THE BASE MAP LAYERS
|
|
|
|
|
GeoportalDataViewerServiceAsync.Util.getInstance().getListBaseLayers(new AsyncCallback<List<BaseMapLayer>>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
RootPanel.get(APP_DIV).remove(loaderApp);
|
|
|
|
|
Window.alert("Error occurred on instancing the GeoPortale Viewer. Please, contact the support");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(List<BaseMapLayer> listBaseMapLayers) {
|
|
|
|
|
RootPanel.get(APP_DIV).remove(loaderApp);
|
|
|
|
|
loadGeonaDataViewerProfile();
|
|
|
|
|
mainPanel.setBaseLayers(listBaseMapLayers);
|
|
|
|
|
|
|
|
|
|
BaseMapLayer firstBaseLayer = listBaseMapLayers.get(0);
|
|
|
|
|
//Passing the first base map layer that will be applied as first base layer
|
|
|
|
|
olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),
|
|
|
|
|
layerManager.getLayerManagerBus(), firstBaseLayer);
|
|
|
|
|
layerManager.setOlMap(olMapMng.getOLOSMMap());
|
|
|
|
|
mainPanel.setMap(olMapMng.getOLOSMMap());
|
|
|
|
|
|
|
|
|
|
//mainPanel.setMapAttribution(olMapMng.getOLOSMMap().getMapAttribution());
|
|
|
|
|
updateSize();
|
|
|
|
|
ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
|
|
|
|
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RootPanel.get(APP_DIV).add(new HTML(attributionHTML));
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//mainPanel.setMapAttribution(olMapMng.getOLOSMMap().getMapAttribution());
|
|
|
|
|
updateSize();
|
|
|
|
|
ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
|
|
|
|
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -129,28 +169,15 @@ public class GeoportalDataViewer implements EntryPoint {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER);
|
|
|
|
|
paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE);
|
|
|
|
|
// paramUUID =
|
|
|
|
|
// Window.Location.getParameter(GeoportalDataViewerConstants.GET_UUID_PARAMETER);
|
|
|
|
|
paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID);
|
|
|
|
|
paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE);
|
|
|
|
|
GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest);
|
|
|
|
|
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE + " = " + paramGeonaItemType);
|
|
|
|
|
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + paramGeonaItemID);
|
|
|
|
|
// GWT.log(GeoportalDataViewerConstants.GET_UUID_PARAMETER + " = " + paramUUID);
|
|
|
|
|
GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle);
|
|
|
|
|
|
|
|
|
|
// VALIDATING THE LONG FORMAT FOR GID
|
|
|
|
|
// try {
|
|
|
|
|
// if (paramGeonaItemID != null)
|
|
|
|
|
// Long.parseLong(paramGeonaItemID);
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// Window.alert("Bad format for parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_ID
|
|
|
|
|
// + ". It must be a Long");
|
|
|
|
|
// paramGeonaItemID = null;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bindEvents();
|
|
|
|
|
|
|
|
|
|
RootPanel.get(APP_DIV).add(attributionDiv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void loadGeonaDataViewerProfile() {
|
|
|
|
|
|
|
|
|
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -206,8 +233,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
bindEvents();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -410,6 +436,30 @@ public class GeoportalDataViewer implements EntryPoint {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
applicationBus.addHandler(ChangeMapLayerEvent.TYPE, new ChangeMapLayerEventHandler() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onChangeBaseMapLayer(ChangeMapLayerEvent changeMapLayerEvent) {
|
|
|
|
|
|
|
|
|
|
BaseMapLayer baseLayer = changeMapLayerEvent.getBaseMapLayer();
|
|
|
|
|
|
|
|
|
|
if (baseLayer == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
String attributionHTML = "<div class='map-credits'><div class='map-credits-container'>"
|
|
|
|
|
+ baseLayer.getAttribution() + "</div></div>";
|
|
|
|
|
olMapMng.getOLOSMMap().changeBaseMap(baseLayer);
|
|
|
|
|
|
|
|
|
|
//THE OSM Contributors are automatically added by gwt-ol, other ones not.
|
|
|
|
|
if(!baseLayer.getType().equals(BaseMapLayer.OL_BASE_MAP.OSM)) {
|
|
|
|
|
attributionDiv.setHTML(attributionHTML);
|
|
|
|
|
}else
|
|
|
|
|
attributionDiv.setHTML("");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|