Introduced collections, start event refactoring

This commit is contained in:
Fabio Sinibaldi 2022-08-05 18:06:09 +02:00
parent 052aa44675
commit f29a8c3ef0
32 changed files with 475 additions and 462 deletions

View File

@ -1,51 +1,29 @@
package org.gcube.portlets.user.geoportaldataviewer.client; package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile; import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.ItemField;
import org.gcube.application.geoportalcommon.shared.LayerItem;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV; import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.AddedLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.AddedLayerToMapEvent.LAYER_TYPE;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.AddedLayerToMapEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ChangeBaseMapLayerEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ClosedViewDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.DoActionOnDetailLayersEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.DoActionOnDetailLayersEvent.SwapLayer;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.MapExtentToEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.SearchPerformedEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ShowPopupOnCentroiEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ZoomOutOverMinimumEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
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.OpenLayerMap; import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel; 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.LoaderIcon;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil; import org.gcube.portlets.user.geoportaldataviewer.client.util.OGCUtils;
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer; 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; import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
@ -61,7 +39,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.RootPanel;
import ol.Coordinate;
import ol.layer.Image; import ol.layer.Image;
/** /**
@ -82,23 +59,13 @@ public class GeoportalDataViewer implements EntryPoint {
/** The main panel. */ /** The main panel. */
private GeonaDataViewMainPanel mainPanel; private GeonaDataViewMainPanel mainPanel;
/** The param wms request. */ private StartParameters startParameters = null;
private String paramWmsRequest;
/** The param UUID. */
// private String paramUUID;
private String paramGeonaItemType;
/** The param layer title. */
private String paramLayerTitle;
private HandlerManager applicationBus = new HandlerManager(""); private HandlerManager applicationBus = new HandlerManager("");
/** The layer manager. */ /** The layer manager. */
private LayerManager layerManager = new LayerManager(applicationBus); private LayerManager layerManager = new LayerManager(applicationBus);
private String paramGeonaItemID;
private GNADataViewerConfigProfile geonaDataViewerProfile; private GNADataViewerConfigProfile geonaDataViewerProfile;
@ -109,12 +76,13 @@ public class GeoportalDataViewer implements EntryPoint {
private LoaderIcon loaderApp = new LoaderIcon("Loading application... please wait"); private LoaderIcon loaderApp = new LoaderIcon("Loading application... please wait");
private HTML attributionDiv = new HTML(); private HTML attributionDiv = new HTML();
private static List<BaseMapLayer> listBaseMapLayers = null; private static List<BaseMapLayer> listBaseMapLayers = null;
private List<ItemField> displayFields = new ArrayList<ItemField>(); // Configuration by UCD
private List<ItemField> sortByFields = new ArrayList<ItemField>(); // Map : UCID -> Collection description
private List<ItemField> searchByFields = new ArrayList<ItemField>(); private Map<String, GCubeCollection> openedCollections=new HashMap<>();
/** /**
* This is the entry point method. * This is the entry point method.
@ -123,59 +91,16 @@ public class GeoportalDataViewer implements EntryPoint {
loaderApp.getElement().addClassName("loader-gna-app"); loaderApp.getElement().addClassName("loader-gna-app");
RootPanel.get(APP_DIV).add(loaderApp); RootPanel.get(APP_DIV).add(loaderApp);
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);
GeoportalDataViewerServiceAsync.Util.getInstance().listOfFieldsForSearching(new AsyncCallback<List<ItemField>>() {
@Override startParameters = new StartParameters(Window.Location.getParameterMap());
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
}
@Override // Fields configurations are read on open collection event
public void onSuccess(List<ItemField> result) {
GWT.log("Loaded item fields: "+result); mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(),null,null,null);
RootPanel.get(APP_DIV).add(mainPanel);
for (ItemField itemField : result) {
if(itemField.isDisplayAsResult()) { initApplication();
displayFields.add(itemField);
}
if(itemField.isSearchable()) {
searchByFields.add(itemField);
}
if(itemField.isSortable()) {
sortByFields.add(itemField);
}
}
GWT.log("List display fields: "+result);
SearchingFilter initialSortFilter = new SearchingFilter();
initialSortFilter.setOrder(ORDER.ASC);
initialSortFilter.setOrderByFields(Arrays.asList(new ItemField("Name", Arrays.asList("name"), true, true, true)));
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(),sortByFields,searchByFields,initialSortFilter);
RootPanel.get(APP_DIV).add(mainPanel);
initApplication();
}
});
} }
private void initApplication() { private void initApplication() {
@ -196,14 +121,16 @@ public class GeoportalDataViewer implements EntryPoint {
@Override @Override
public void onSuccess(List<BaseMapLayer> listBaseMapLayers) { public void onSuccess(List<BaseMapLayer> listBaseMapLayers) {
// ?? Maybe remove after load collection / project?
try { try {
RootPanel.get(APP_DIV).remove(loaderApp); RootPanel.get(APP_DIV).remove(loaderApp);
}catch (Exception e) { }catch (Exception e) {
loaderApp.setVisible(false); loaderApp.setVisible(false);
} }
GeoportalDataViewer.listBaseMapLayers = listBaseMapLayers;
//now the map is loaded and I'm sure that I can load the GeonaDataViewer Profile //now the map is loaded and I'm sure that I can load the GeonaDataViewer Profile
loadGeonaDataViewerProfile(); GeoportalDataViewer.listBaseMapLayers = listBaseMapLayers;
mainPanel.setBaseLayers(listBaseMapLayers); mainPanel.setBaseLayers(listBaseMapLayers);
BaseMapLayer firstBaseLayer = listBaseMapLayers.get(0); BaseMapLayer firstBaseLayer = listBaseMapLayers.get(0);
@ -217,7 +144,21 @@ public class GeoportalDataViewer implements EntryPoint {
updateSize(); updateSize();
ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js") ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
.setWindow(ScriptInjector.TOP_WINDOW).inject(); .setWindow(ScriptInjector.TOP_WINDOW).inject();
if(!startParameters.toOpenCollections().isEmpty()){
// Fire
}
if(!startParameters.toOpenProjects().isEmpty()){
// open projects by projectID list
}
if(!startParameters.toOpenLayers().isEmpty()){
}
} }
@ -243,65 +184,65 @@ public class GeoportalDataViewer implements EntryPoint {
return listBaseMapLayers; return listBaseMapLayers;
} }
private void loadGeonaDataViewerProfile() { // private void loadGeonaDataViewerProfile() {
//
Scheduler.get().scheduleDeferred(new ScheduledCommand() { // Scheduler.get().scheduleDeferred(new ScheduledCommand() {
//
@Override // @Override
public void execute() { // public void execute() {
GeoportalDataViewerServiceAsync.Util.getInstance() // GeoportalDataViewerServiceAsync.Util.getInstance()
.getGeoNaDataViewProfile(new AsyncCallback<GNADataViewerConfigProfile>() { // .getGeoNaDataViewProfile(new AsyncCallback<GNADataViewerConfigProfile>() {
//
@Override // @Override
public void onFailure(Throwable caught) { // public void onFailure(Throwable caught) {
Window.alert(caught.getMessage()); // Window.alert(caught.getMessage());
//
} // }
//
@Override // @Override
public void onSuccess(GNADataViewerConfigProfile profile) { // public void onSuccess(GNADataViewerConfigProfile profile) {
geonaDataViewerProfile = profile; // geonaDataViewerProfile = profile;
GWT.log("Profile: " + geonaDataViewerProfile); // GWT.log("Profile: " + geonaDataViewerProfile);
Iterator<String> it; // Iterator<String> it;
String theItemType = paramGeonaItemType; // String theItemType = paramGeonaItemType;
if (theItemType == null) { // if (theItemType == null) {
it = geonaDataViewerProfile.getMapLayers().keySet().iterator(); // it = geonaDataViewerProfile.getMapLayers().keySet().iterator();
it.hasNext(); // it.hasNext();
theItemType = it.next(); // theItemType = it.next();
} // }
//
LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(theItemType); // LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(theItemType);
//
if (layerItem == null) { // if (layerItem == null) {
Window.alert("Not detected any layer with type: " + theItemType); // Window.alert("Not detected any layer with type: " + theItemType);
return; // return;
} // }
//
GWT.log("ON module load The layerItem is: " + layerItem); // GWT.log("ON module load The layerItem is: " + layerItem);
String layerName = URLUtil.getValueOfParameter("layers", layerItem.getWmsLink()); // String layerName = URLUtil.getValueOfParameter("layers", layerItem.getWmsLink());
layerItem.setName(layerName); // layerItem.setName(layerName);
layerManager.setBaseLayerFromIsProfile(layerItem); // layerManager.setBaseLayerFromIsProfile(layerItem);
layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false, // layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false,
null, false, null, null, null); // null, false, null, null, null);
//
if (paramGeonaItemID != null) { // if (paramGeonaItemID != null) {
if (paramGeonaItemType == null) { // if (paramGeonaItemType == null) {
Window.alert( // Window.alert(
"Missing parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE // "Missing parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE
+ " (GeoNa Data Type) where to search the item id: " // + " (GeoNa Data Type) where to search the item id: "
+ paramGeonaItemID); // + paramGeonaItemID);
return; // return;
} // }
GeoNaItemRef gir = new GeoNaItemRef(paramGeonaItemID, paramGeonaItemType); // GeoNaItemRef gir = new GeoNaItemRef(paramGeonaItemID, paramGeonaItemType);
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null)); // applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null));
} // }
//
} // }
}); // });
} // }
}); // });
//
} // }
/** /**
* Update window size. * Update window size.
@ -322,302 +263,220 @@ public class GeoportalDataViewer implements EntryPoint {
return rootHeight; return rootHeight;
} }
//************************************************************************************************************************
/** /**
* Bind events. * Bind events.
*/ */
private void bindEvents() { private void bindEvents() {
applicationBus.addHandler(ShowDetailsEvent.TYPE, new ShowDetailsEventHandler() {
@Override //
public void onShowDetails(ShowDetailsEvent showDetailsEvent) { applicationBus.addHandler(ShowDetailsEvent.TYPE, showDetailsEvent -> {
GWT.log("Fired event: " + showDetailsEvent); GWT.log("Fired event: " + showDetailsEvent);
String geonaMongoId = showDetailsEvent.getGeonaMongoID(); String geonaMongoId = showDetailsEvent.getGeonaMongoID();
if (geonaMongoId == null) { if (geonaMongoId == null) {
Window.alert("Item Id not found"); Window.alert("Item Id not found");
return; return;
}
// TODO
boolean found = false;
GWT.log("Product with id: " + geonaMongoId + " found? " + found);
if (!found) {
if (showDetailsEvent.getGeonaItemType().equalsIgnoreCase("Concessione")) {
GeoportalDataViewerServiceAsync.Util.getInstance().getConcessioneForId(geonaMongoId,
new AsyncCallback<ConcessioneDV>() {
@Override
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
mainPanel.hidePanelDetails();
}
@Override
public void onSuccess(ConcessioneDV concessioneDV) {
GWT.log("Showing: " + concessioneDV);
mainPanel.showAsDetails(concessioneDV, showDetailsEvent.getGeonaItemRef());
}
});
}
}
} }
}); // TODO
boolean found = false;
GWT.log("Product with id: " + geonaMongoId + " found? " + found);
applicationBus.addHandler(AddedLayerToMapEvent.TYPE, new AddedLayerToMapEventHandler() { if (!found) {
@Override
public void onLayerRendered(AddedLayerToMapEvent addedLayerToMapEvent) {
GWT.log("Fired AddedLayerToMapEvent " + addedLayerToMapEvent.getLayerItem() + "layer type: "+addedLayerToMapEvent.getLayerType());
try {
attempt = 0;
if (paramGeonaItemID != null) {
// waiting for record retrieved by service before calling the WFS
final int MAX_RETRY = 15;
Timer timer = new com.google.gwt.user.client.Timer() {
@Override
public void run() {
attempt++;
GWT.log("waiting get record: " + attempt);
RecordDV record = mainPanel.getDisplayedRecord();
if (record != null) {
this.cancel();
GWT.log("cancelled timer");
performWFSQueryOnCentroid(record);
}
if (attempt > MAX_RETRY) {
GWT.log("MAX_RETRY reached, cancelled timer");
this.cancel();
}
}
};
timer.scheduleRepeating(1000);
}
} catch (Exception e) {
// TODO: handle exception
}
LAYER_TYPE layerType = addedLayerToMapEvent.getLayerType();
if (layerType != null) {
switch (layerType) {
case BASE:
break;
case OVERLAY:
mainPanel.showOverlayLayers(layerManager.getOverlayLayerManager().getPanel());
break;
default:
break;
}
}
// if (showDetailsEvent.getGeonaItemType().equalsIgnoreCase("Concessione")) {
//
// GeoportalDataViewerServiceAsync.Util.getInstance().getConcessioneForId(geonaMongoId,
// new AsyncCallback<ConcessioneDV>() {
//
// @Override
// public void onFailure(Throwable caught) {
// Window.alert(caught.getMessage());
// mainPanel.hidePanelDetails();
//
// }
//
// @Override
// public void onSuccess(ConcessioneDV concessioneDV) {
// GWT.log("Showing: " + concessioneDV);
// mainPanel.showAsDetails(concessioneDV, showDetailsEvent.getGeonaItemRef());
// }
// });
// }
} }
}); });
applicationBus.addHandler(ZoomOutOverMinimumEvent.TYPE, new ZoomOutOverMinimumEventHandler() { applicationBus.addHandler(AddedLayerToMapEvent.TYPE, addedLayerToMapEvent -> {
GWT.log("Fired AddedLayerToMapEvent " + addedLayerToMapEvent.getLayerItem() + "layer type: "+addedLayerToMapEvent.getLayerType());
@Override try {
public void onZoomOut(ZoomOutOverMinimumEvent zoomOutEvent) {
if (mainPanel.getDisplayedRecord() == null && !olMapMng.isQueryPointActive()) { attempt = 0;
olMapMng.hidePopInfo();
layerManager.removeAllDetailLayers();
}
mainPanel.hideOverlayLayers();
// layerManager.getOverlayLayerManager().hide();
// hidePopupLayers();
// if (paramGeonaItemID != null) {
// // waiting for record retrieved by service before calling the WFS
// final int MAX_RETRY = 15;
// Timer timer = new com.google.gwt.user.client.Timer() {
// @Override
// public void run() {
// attempt++;
// GWT.log("waiting get record: " + attempt);
// RecordDV record = mainPanel.getDisplayedRecord();
// if (record != null) {
// this.cancel();
// GWT.log("cancelled timer");
// OGCUtils.performWFSQueryOnCentroid(record);
// }
//
// if (attempt > MAX_RETRY) {
// GWT.log("MAX_RETRY reached, cancelled timer");
// this.cancel();
// }
//
// }
// };
// timer.scheduleRepeating(1000);
//
// }
} catch (Exception e) {
// TODO: handle exception
} }
});
applicationBus.addHandler(ClosedViewDetailsEvent.TYPE, new ClosedViewDetailsEventHandler() { LAYER_TYPE layerType = addedLayerToMapEvent.getLayerType();
@Override if (layerType != null) {
public void onClosed(ClosedViewDetailsEvent closedViewDetailsEvent) {
olMapMng.hidePopInfo();
}
});
applicationBus.addHandler(MapExtentToEvent.TYPE, new MapExtentToEventHandler() { switch (layerType) {
case BASE:
@Override
public void onExtentEvent(MapExtentToEvent mapExtentToEvent) {
// TODO Auto-generated method stub
}
});
applicationBus.addHandler(DoActionOnDetailLayersEvent.TYPE, new DoActionOnDetailLayersEventHandler() {
@Override
public void onDoActionOnDetailLayers(DoActionOnDetailLayersEvent doLayerActionEvent) {
DO_LAYER_ACTION doAction = doLayerActionEvent.getDoAction();
GWT.log("event: "+doAction);
GWT.log("layer source: "+doLayerActionEvent.getLayerItem().getName());
OpenLayerMap olMap = olMapMng.getOLMap();
switch (doAction) {
case OPACITY:
GWT.log("opacity: "+doLayerActionEvent.getOpacity());
olMap.setWMSDetailLayerOpacity(doLayerActionEvent.getLayerItem(),
doLayerActionEvent.getOpacity());
break; break;
case OVERLAY:
case SWAP: mainPanel.showOverlayLayers(layerManager.getOverlayLayerManager().getPanel());
SwapLayer swLS = doLayerActionEvent.getSourceLayerSwap();
SwapLayer swLT = doLayerActionEvent.getTargetLayerSwap();
GWT.log("SWAPPING source "+swLS.getLayerItem().getName() +", target: "+swLT.getLayerItem().getName());
olMap.swapDetailsLayers(swLS, swLT);
break;
case VISIBILITY:
GWT.log("visibility: "+doLayerActionEvent.getVisibility());
olMap.setWMSDetailLayerVisible(doLayerActionEvent.getLayerItem(),
doLayerActionEvent.getVisibility());
break; break;
default: default:
break; break;
} }
}
});
applicationBus.addHandler(ZoomOutOverMinimumEvent.TYPE, zoomOutEvent -> {
if (mainPanel.getDisplayedRecord() == null && !olMapMng.isQueryPointActive()) {
olMapMng.hidePopInfo();
layerManager.removeAllDetailLayers();
} }
mainPanel.hideOverlayLayers();
// layerManager.getOverlayLayerManager().hide();
// hidePopupLayers();
});
applicationBus.addHandler(ClosedViewDetailsEvent.TYPE, closedViewDetailsEvent -> olMapMng.hidePopInfo());
applicationBus.addHandler(MapExtentToEvent.TYPE, mapExtentToEvent -> {// TODO Auto-generated method stub
});
applicationBus.addHandler(DoActionOnDetailLayersEvent.TYPE, doLayerActionEvent -> {
DO_LAYER_ACTION doAction = doLayerActionEvent.getDoAction();
GWT.log("event: "+doAction);
GWT.log("layer source: "+doLayerActionEvent.getLayerItem().getName());
OpenLayerMap olMap = olMapMng.getOLMap();
switch (doAction) {
case OPACITY:
GWT.log("opacity: "+doLayerActionEvent.getOpacity());
olMap.setWMSDetailLayerOpacity(doLayerActionEvent.getLayerItem(),
doLayerActionEvent.getOpacity());
break;
case SWAP:
SwapLayer swLS = doLayerActionEvent.getSourceLayerSwap();
SwapLayer swLT = doLayerActionEvent.getTargetLayerSwap();
GWT.log("SWAPPING source "+swLS.getLayerItem().getName() +", target: "+swLT.getLayerItem().getName());
olMap.swapDetailsLayers(swLS, swLT);
break;
case VISIBILITY:
GWT.log("visibility: "+doLayerActionEvent.getVisibility());
olMap.setWMSDetailLayerVisible(doLayerActionEvent.getLayerItem(),
doLayerActionEvent.getVisibility());
break;
default:
break;
}
}); });
applicationBus.addHandler(ChangeMapLayerEvent.TYPE, new ChangeMapLayerEventHandler() { applicationBus.addHandler(ChangeBaseMapLayerEvent.TYPE, changeMapLayerEvent -> {
@Override BaseMapLayer baseLayer = changeMapLayerEvent.getBaseMapLayer();
public void onChangeBaseMapLayer(ChangeMapLayerEvent changeMapLayerEvent) {
BaseMapLayer baseLayer = changeMapLayerEvent.getBaseMapLayer(); if (baseLayer == null)
return;
if (baseLayer == null) String attributionHTML = "<div class='map-credits'><div class='map-credits-container'>"
return; + baseLayer.getAttribution() + "</div></div>";
olMapMng.getOLMap().changeBaseMap(baseLayer);
String attributionHTML = "<div class='map-credits'><div class='map-credits-container'>" // THE OSM Contributors are automatically added by gwt-ol, others ones not.
+ baseLayer.getAttribution() + "</div></div>"; if (!baseLayer.getType().equals(BaseMapLayer.OL_BASE_MAP.OSM)) {
olMapMng.getOLMap().changeBaseMap(baseLayer); attributionDiv.setHTML(attributionHTML);
} else
attributionDiv.setHTML("");
// THE OSM Contributors are automatically added by gwt-ol, others ones not.
if (!baseLayer.getType().equals(BaseMapLayer.OL_BASE_MAP.OSM)) {
attributionDiv.setHTML(attributionHTML);
} else
attributionDiv.setHTML("");
}
}); });
applicationBus.addHandler(ShowPopupOnCentroiEvent.TYPE, new ShowPopupOnCentroiEventHandler() { applicationBus.addHandler(ShowPopupOnCentroiEvent.TYPE, showPopupOnCentroiEvent -> {
@Override if(showPopupOnCentroiEvent.getRecord()!=null)
public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) { OGCUtils.performWFSQueryOnCentroid(showPopupOnCentroiEvent.getRecord());
if(showPopupOnCentroiEvent.getRecord()!=null)
performWFSQueryOnCentroid(showPopupOnCentroiEvent.getRecord());
}
}); });
applicationBus.addHandler(SearchPerformedEvent.TYPE, new SearchPerformedEventHandler() { applicationBus.addHandler(SearchPerformedEvent.TYPE, searchPerformedEvent -> {
@Override if(searchPerformedEvent!=null) {
public void onSearchDone(SearchPerformedEvent searchPerformedEvent) {
LinkedHashMap<String, Image> wmsMap = olMapMng.getOLMap().getWmsLayerMap();
if(searchPerformedEvent!=null) { String firstWMSKey = wmsMap.keySet().iterator().next();
List<ConcessioneDV> result = searchPerformedEvent.getData();
if(result!=null && result.size()>0) {
LinkedHashMap<String, Image> wmsMap = olMapMng.getOLMap().getWmsLayerMap(); String cqlFilter = "product_id IN(";
String firstWMSKey = wmsMap.keySet().iterator().next(); for (ConcessioneDV concessioneDV : result) {
List<ConcessioneDV> result = searchPerformedEvent.getData(); cqlFilter+="'"+concessioneDV.getItemId()+"',";
if(result!=null && result.size()>0) {
String cqlFilter = "product_id IN(";
for (ConcessioneDV concessioneDV : result) {
cqlFilter+="'"+concessioneDV.getItemId()+"',";
}
cqlFilter = cqlFilter.substring(0,cqlFilter.length()-1)+")";
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, cqlFilter);
}else {
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
}
if(searchPerformedEvent.isSearchReset()) {
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
} }
cqlFilter = cqlFilter.substring(0,cqlFilter.length()-1)+")";
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, cqlFilter);
}else {
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
} }
if(searchPerformedEvent.isSearchReset()) {
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
}
} }
}); });
} }
// /**
// * Handler popu closer.
// *
// * @param divId the div id
// * @param overlayId the overlay id
// */
// public static native void handlerPopuCloser(String divId, String overlayId) /*-{
// var closer = $doc.getElementById(divId);
// var overlay = $doc.getElementById(overlayId);
// closer.onclick = function() {
// overlay.setPosition(undefined);
// closer.blur();
// return false;
// };
//
// }-*/;
private void performWFSQueryOnCentroid(RecordDV record) {
if (record != null) {
GWT.log("record instanceof ConcessioneDV: " + (record instanceof ConcessioneDV) + " with mongo item id: "
+ record.getItemId());
// GeoportalDataViewerConstants.print("record instanceof ConcessioneDV: "
// +(record instanceof ConcessioneDV));
if (record instanceof ConcessioneDV) {
ConcessioneDV concessioneDV = (ConcessioneDV) record;
Double x = concessioneDV.getCentroidLong();
Double y = concessioneDV.getCentroidLat();
GWT.log("X: " + x + ", Y:" + y);
if (x != null && y != null) {
Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y),
MAP_PROJECTION.EPSG_4326.getName(), MAP_PROJECTION.EPSG_3857.getName());
GeoQuery select = olMapMng.toDataPointQuery(transfCoord, false);
GWT.log("GeoQuery: " + select);
// GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
ExtentWrapped toExt = new ExtentWrapped(transfCoord.getX(), transfCoord.getY(), transfCoord.getX(),
transfCoord.getY());
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, toExt, record.getItemId(),
true, MapEventType.ADDED_CENTROID_LAYER_TO_MAP));
} else {
GeoportalDataViewerConstants.printJs(
"I cannot select the point one or both coordiantes are null. X: " + x + ", Y:" + y);
}
}
}
}
} }

View File

@ -17,13 +17,13 @@ import org.gcube.application.geoportalcommon.shared.products.model.UploadedImage
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.AddedLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.AddedLayerToMapEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ZoomOutOverMinimumEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ZoomOutOverMinimumEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped; 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.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap; import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;

View File

@ -3,7 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent; 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.events.application.ZoomOutOverMinimumEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped; 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.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap; import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;

View File

@ -0,0 +1,69 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import lombok.Getter;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Getter
class StartParameters {
public StartParameters(Map<String, List<String>> parameters) {
if (parameters == null || parameters.isEmpty())
GWT.log("!!!! NB : NO QUERY PARAMETERS");
else {
paramWmsRequest = getFirst(parameters, GeoportalDataViewerConstants.GET_WMS_PARAMETER);
paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE);
paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE);
paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID);
}
}
// retro usage?
/** WMS Link -> Layer Name [optional]*/
public Map<String,String> toOpenLayers() {
return Collections.emptyMap();
}
public Set<String> toOpenCollections(){
return Collections.emptySet();
}
public Set<String> toOpenProjects(){
return Collections.emptySet();
}
private String getFirst(Map<String, List<String>> parameters, String key) {
List<String> values = parameters.get(key);
if (values != null && !values.isEmpty()) {
GWT.log("Param " + key + "Getting First value of : " + values);
return values.get(0);
} else return null;
}
/**
* The param wms request.
*/
private String paramWmsRequest;
/**
* The param UUID.
*/
// private String paramUUID;
private String paramGeonaItemType;
/**
* The param layer title.
*/
private String paramLayerTitle;
private String paramGeonaItemID;
}

View File

@ -0,0 +1,18 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.GwtEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.MapExtentToEventHandler;
public class OpenCollectionsEvent extends GwtEvent<OpenCollectionsEventHandler> {
public static Type<MapExtentToEventHandler> TYPE = new Type<MapExtentToEventHandler>();
@Override
public Type<OpenCollectionsEventHandler> getAssociatedType() {
return null;
}
@Override
protected void dispatch(OpenCollectionsEventHandler h) {
h.
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
public interface OpenCollectionsEventHandler extends EventHandler {
}

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;

View File

@ -1,18 +1,18 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.GwtEvent;
/** /**
* The Class ChangeMapLayerEvent. * The Class ChangeBaseMapLayerEvent.
* *
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* *
* Nov 12, 2021 * Nov 12, 2021
*/ */
public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> { public class ChangeBaseMapLayerEvent extends GwtEvent<ChangeBaseMapLayerEventHandler> {
public static Type<ChangeMapLayerEventHandler> TYPE = new Type<ChangeMapLayerEventHandler>(); public static Type<ChangeBaseMapLayerEventHandler> TYPE = new Type<ChangeBaseMapLayerEventHandler>();
private BaseMapLayer baseMapLayer; private BaseMapLayer baseMapLayer;
/** /**
@ -20,7 +20,7 @@ public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
* *
* @param baseMapLayer the base map layer * @param baseMapLayer the base map layer
*/ */
public ChangeMapLayerEvent(BaseMapLayer baseMapLayer) { public ChangeBaseMapLayerEvent(BaseMapLayer baseMapLayer) {
this.baseMapLayer = baseMapLayer; this.baseMapLayer = baseMapLayer;
} }
@ -31,7 +31,7 @@ public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
* @return the associated type * @return the associated type
*/ */
@Override @Override
public Type<ChangeMapLayerEventHandler> getAssociatedType() { public Type<ChangeBaseMapLayerEventHandler> getAssociatedType() {
return TYPE; return TYPE;
} }
@ -41,7 +41,7 @@ public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
* @param handler the handler * @param handler the handler
*/ */
@Override @Override
protected void dispatch(ChangeMapLayerEventHandler handler) { protected void dispatch(ChangeBaseMapLayerEventHandler handler) {
handler.onChangeBaseMapLayer(this); handler.onChangeBaseMapLayer(this);
} }

View File

@ -1,20 +1,20 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;
/** /**
* The Interface ChangeMapLayerEventHandler. * The Interface ChangeBaseMapLayerEventHandler.
* *
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* *
* Nov 12, 2021 * Nov 12, 2021
*/ */
public interface ChangeMapLayerEventHandler extends EventHandler { public interface ChangeBaseMapLayerEventHandler extends EventHandler {
/** /**
* On change base map layer. * On change base map layer.
* *
* @param changeMapLayerEvent the change map layer event * @param changeMapLayerEvent the change map layer event
*/ */
void onChangeBaseMapLayer(ChangeMapLayerEvent changeMapLayerEvent); void onChangeBaseMapLayer(ChangeBaseMapLayerEvent changeMapLayerEvent);
} }

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.GwtEvent;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location; import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef; import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;
@ -18,4 +18,5 @@ public interface ShowDetailsEventHandler extends EventHandler {
* @param showDetailsEvent the show details event * @param showDetailsEvent the show details event
*/ */
void onShowDetails(ShowDetailsEvent showDetailsEvent); void onShowDetails(ShowDetailsEvent showDetailsEvent);
} }

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV; import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.GwtEvent;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;

View File

@ -5,9 +5,9 @@ import java.util.LinkedHashMap;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.AddedLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.AddedLayerToMapEvent.LAYER_TYPE;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.DoActionOnDetailLayersEvent.SwapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;

View File

@ -3,7 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef; import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV; import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ClosedViewDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni.ConcessioneView; import org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni.ConcessioneView;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;

View File

@ -8,8 +8,8 @@ import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV; import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ChangeBaseMapLayerEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.MapExtentToEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap; import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons; import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages; import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
@ -413,7 +413,7 @@ public class GeonaDataViewMainPanel extends Composite {
@Override @Override
public void onValueChange(ValueChangeEvent<Boolean> event) { public void onValueChange(ValueChangeEvent<Boolean> event) {
applicationBus.fireEvent(new ChangeMapLayerEvent(baseMapLayer)); applicationBus.fireEvent(new ChangeBaseMapLayerEvent(baseMapLayer));
} }
}); });

View File

@ -16,9 +16,9 @@ import org.gcube.application.geoportalcommon.shared.WhereClause;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.SearchPerformedEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ShowPopupOnCentroiEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon; import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil; import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;

View File

@ -1,9 +1,9 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd; package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.DoActionOnDetailLayersEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.DoActionOnDetailLayersEvent.SwapLayer;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages; import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil; import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;

View File

@ -1,7 +1,7 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd; package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.DoActionOnDetailLayersEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION; import org.gcube.portlets.user.geoportaldataviewer.client.events.application.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;

View File

@ -0,0 +1,46 @@
package org.gcube.portlets.user.geoportaldataviewer.client.util;
import com.google.gwt.core.client.GWT;
import ol.Coordinate;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
public class OGCUtils {
public static void performWFSQueryOnCentroid(RecordDV record) {
GWT.log("WFS Query for : "+record);
if (record != null) {
// GWT.log("record instanceof ConcessioneDV: " + (record instanceof ConcessioneDV) + " with mongo item id: "
// + record.getItemId());
// GeoportalDataViewerConstants.print("record instanceof ConcessioneDV: "
// +(record instanceof ConcessioneDV));
// if (record instanceof ConcessioneDV) {
// ConcessioneDV concessioneDV = (ConcessioneDV) record;
// Double x = concessioneDV.getCentroidLong();
// Double y = concessioneDV.getCentroidLat();
// GWT.log("X: " + x + ", Y:" + y);
// if (x != null && y != null) {
// Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y),
// GeoportalDataViewerConstants.MAP_PROJECTION.EPSG_4326.getName(), GeoportalDataViewerConstants.MAP_PROJECTION.EPSG_3857.getName());
// GeoQuery select = olMapMng.toDataPointQuery(transfCoord, false);
// GWT.log("GeoQuery: " + select);
// // GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
// ExtentWrapped toExt = new ExtentWrapped(transfCoord.getX(), transfCoord.getY(), transfCoord.getX(),
// transfCoord.getY());
// layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, toExt, record.getItemId(),
// true, GeoportalDataViewerConstants.MapEventType.ADDED_CENTROID_LAYER_TO_MAP));
// } else {
// GeoportalDataViewerConstants.printJs(
// "I cannot select the point one or both coordiantes are null. X: " + x + ", Y:" + y);
// }
// }
}
}
}

View File

@ -0,0 +1,12 @@
package org.gcube.portlets.user.geoportaldataviewer.shared;
import lombok.Data;
import java.io.Serializable;
//@Data
public class GCubeCollection implements Serializable {
// private Document ucd;
// private List<IndexLayer> indexes;
}