#24404, done
This commit is contained in:
parent
047db1e848
commit
268a5eb614
|
@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
#### Enhancement
|
||||
- [#24300] Improved the GUI of the search functionality when multiple collections are available
|
||||
- [#24404] Improved the handlers of events: Search, Locate
|
||||
- Improved the user experience providing an animated map and zoom to layers facility
|
||||
|
||||
#### Fixes
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.Set;
|
|||
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||
|
@ -33,8 +32,8 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformed
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent.EVENT_SOURCE;
|
||||
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.ShowPopupOnCentroidEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroidEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent.EVENT_TYPE;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEventHandler;
|
||||
|
@ -247,7 +246,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
}
|
||||
GeoportalItemReferences gir = new GeoportalItemReferences(paramGeonaItemID,
|
||||
paramGeonaItemType);
|
||||
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, true, true, EVENT_SOURCE.LOCATE_ON_INIT));
|
||||
applicationBus.fireEvent(
|
||||
new ShowDetailsEvent(gir, null, true, true, EVENT_SOURCE.LOCATE_ON_INIT));
|
||||
}
|
||||
|
||||
mainPanel.openCollectionMenu();
|
||||
|
@ -390,12 +390,12 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
GWT.log("Product with id: " + projectID + " found? " + found);
|
||||
|
||||
final EVENT_SOURCE sourceEvent = showDetailsEvent.getSourceEvent();
|
||||
|
||||
if(!sourceEvent.equals(EVENT_SOURCE.LOCATE_FROM_TIMELINE)) {
|
||||
|
||||
if (!sourceEvent.equals(EVENT_SOURCE.LOCATE_FROM_TIMELINE)) {
|
||||
timelineMS.hideTimelineProjectRelations();
|
||||
}
|
||||
|
||||
if(sourceEvent.equals(EVENT_SOURCE.LOCATE_SEARCHED)) {
|
||||
|
||||
if (sourceEvent.equals(EVENT_SOURCE.LOCATE_SEARCHED)) {
|
||||
layerManager.removeAllDetailLayers();
|
||||
}
|
||||
|
||||
|
@ -421,8 +421,23 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
timelineMS.showTimelineProjectRelations(result.getTheProjectDV(), false);
|
||||
}
|
||||
|
||||
if(sourceEvent.equals(EVENT_SOURCE.LOCATE_ON_INIT)) {
|
||||
layerManager.fireGoToLayers();
|
||||
if (sourceEvent != null) {
|
||||
|
||||
switch (sourceEvent) {
|
||||
case LOCATE_FROM_TIMELINE:
|
||||
case LOCATE_SEARCHED: {
|
||||
applicationBus.fireEvent(new ShowPopupOnCentroidEvent(result));
|
||||
break;
|
||||
}
|
||||
case LOCATE_ON_INIT: {
|
||||
applicationBus.fireEvent(new ShowPopupOnCentroidEvent(result));
|
||||
layerManager.fireGoToLayers();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -438,63 +453,6 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
GWT.log("Fired AddedLayerToMapEvent " + addedLayerToMapEvent.getLayerItem() + "layer type: "
|
||||
+ addedLayerToMapEvent.getLayerType());
|
||||
|
||||
try {
|
||||
|
||||
attempt = 0;
|
||||
|
||||
if (paramGeonaItemID != null && initApplication) { // waiting for record retrieved by service before
|
||||
// calling the WFS
|
||||
|
||||
// forcing once at init time
|
||||
initApplication = false;
|
||||
|
||||
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);
|
||||
|
||||
ProjectView record = mainPanel.getDisplayedProject();
|
||||
if (record != null) {
|
||||
this.cancel();
|
||||
GWT.log("cancelled timer");
|
||||
GeoJSON spatialReference = record.getTheProjectDV().getSpatialReference();
|
||||
if (spatialReference == null) {
|
||||
GWT.log("No spatial reference found, cancelling timer");
|
||||
this.cancel();
|
||||
|
||||
}
|
||||
try {
|
||||
ExtentWrapped ew = new ExtentWrapped(spatialReference.getBbox().getMinX(),
|
||||
spatialReference.getBbox().getMinY(),
|
||||
spatialReference.getBbox().getMaxX(),
|
||||
spatialReference.getBbox().getMaxY());
|
||||
|
||||
Coordinate centerCoordinate = ew.getCenter();
|
||||
performWFSQueryOnCentroid(record.getTheProjectDV().getId(),
|
||||
centerCoordinate.getX(), centerCoordinate.getY());
|
||||
} catch (Exception e) {
|
||||
GWT.log("Error on calculating center of the extent " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -629,18 +587,23 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
}
|
||||
});
|
||||
|
||||
applicationBus.addHandler(ShowPopupOnCentroiEvent.TYPE, new ShowPopupOnCentroiEventHandler() {
|
||||
applicationBus.addHandler(ShowPopupOnCentroidEvent.TYPE, new ShowPopupOnCentroidEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) {
|
||||
|
||||
public void onShowPopup(ShowPopupOnCentroidEvent showPopupOnCentroiEvent) {
|
||||
GWT.log("ShowPopupOnCentroidEvent: " + showPopupOnCentroiEvent);
|
||||
|
||||
//Showing popup after clicking on map
|
||||
if (showPopupOnCentroiEvent.getProfileID() != null && showPopupOnCentroiEvent.getProjectID() != null) {
|
||||
GWT.log("ShowPopupOnCentroiEvent: " + showPopupOnCentroiEvent);
|
||||
Coordinate transfCoord = MapUtils
|
||||
.geoJSONTToBBoxCenter(showPopupOnCentroiEvent.getSpatialReference(), null, null);
|
||||
|
||||
performWFSQueryOnCentroid(showPopupOnCentroiEvent.getProjectID(), transfCoord.getX(),
|
||||
transfCoord.getY());
|
||||
|
||||
//Showing popup after locate on Map
|
||||
}else if(showPopupOnCentroiEvent.getProjectView()!=null) {
|
||||
layerManager.showPopupInfoForCentroidLayer(showPopupOnCentroiEvent.getProjectView());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,11 +11,16 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView;
|
||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||
|
@ -462,19 +467,20 @@ public class LayerManager {
|
|||
/**
|
||||
* Adds the layer.
|
||||
*
|
||||
* @param lot the lot
|
||||
* @param layerTitle the layer title
|
||||
* @param layerName the layer name
|
||||
* @param wmsLink the wms link
|
||||
* @param isBase the is base
|
||||
* @param displayInLayerSwitcher the display in layer switcher
|
||||
* @param UUID the uuid
|
||||
* @param asDetailLayer the as detail layer
|
||||
* @param minResolution the min resolution
|
||||
* @param maxResolution the max resolution
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @param projectDV the project DV
|
||||
* @param lot the lot
|
||||
* @param layerTitle the layer title
|
||||
* @param layerName the layer name
|
||||
* @param wmsLink the wms link
|
||||
* @param isBase the is base
|
||||
* @param displayInLayerSwitcher the display in layer switcher
|
||||
* @param UUID the uuid
|
||||
* @param asDetailLayer the as detail layer
|
||||
* @param minResolution the min resolution
|
||||
* @param maxResolution the max resolution
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @param projectDV the project DV
|
||||
* @param notifyLayerAlreadyAdded the notify layer already added
|
||||
*/
|
||||
private void addLayer(final LayerObjectType lot, final String layerTitle, final String layerName,
|
||||
final String wmsLink, final boolean isBase, final boolean displayInLayerSwitcher, final String UUID,
|
||||
|
@ -563,6 +569,12 @@ public class LayerManager {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CQL for layer to index layer.
|
||||
*
|
||||
* @param layerName the layer name
|
||||
* @param cqlFilter the cql filter
|
||||
*/
|
||||
public void setCQLForLayerToIndexLayer(String layerName, String cqlFilter) {
|
||||
LayerObject theLo = mapIndexLayerObjects.get(layerName);
|
||||
if (theLo != null) {
|
||||
|
@ -578,7 +590,6 @@ public class LayerManager {
|
|||
*
|
||||
* @param layer the layer
|
||||
* @param profileID the profile ID
|
||||
* @param projectDV the project DV
|
||||
*/
|
||||
public void addIndexLayer(IndexLayerDV layer, String profileID) {
|
||||
GWT.log("Adding index layer: " + layer);
|
||||
|
@ -589,6 +600,11 @@ public class LayerManager {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the index layer.
|
||||
*
|
||||
* @param layer the layer
|
||||
*/
|
||||
public void removeIndexLayer(IndexLayerDV layer) {
|
||||
|
||||
String wmsLink = layer.getLayer().getOgcLinks().get("wms");
|
||||
|
@ -895,13 +911,215 @@ public class LayerManager {
|
|||
/**
|
||||
* Show popup info for centroid layer.
|
||||
*
|
||||
* @param projectView the project view
|
||||
*/
|
||||
public void showPopupInfoForCentroidLayer(ProjectView projectView) {
|
||||
GWT.log("showPopupInfoForCentroidLayer for projectView: " + projectView);
|
||||
|
||||
FlexTable flex = new FlexTable();
|
||||
flex.setCellPadding(1);
|
||||
flex.setCellSpacing(1);
|
||||
flex.getElement().addClassName("popup-table");
|
||||
VerticalPanel vpPanel = new VerticalPanel();
|
||||
vpPanel.add(flex);
|
||||
|
||||
final ProjectDV projectDV = projectView.getTheProjectDV();
|
||||
|
||||
FlexTable intFlex = new FlexTable();
|
||||
intFlex.setCellPadding(1);
|
||||
intFlex.setCellSpacing(1);
|
||||
if (projectDV.getTheDocument() != null) {
|
||||
LinkedHashMap<String, Object> map = projectDV.getTheDocument().getDocumentAsMap();
|
||||
// my-html-table
|
||||
// intFlex.getElement().addClassName("my-html-table");
|
||||
int i = 0;
|
||||
for (String key : map.keySet()) {
|
||||
try {
|
||||
Object theValue = map.get(key);
|
||||
String toStringValue = theValue + "";
|
||||
// intFlex.setHTML(i, 0, key);
|
||||
intFlex.setHTML(intFlex.getRowCount() + 1, 0, "<span title='" + toStringValue + "'>"
|
||||
+ StringUtil.ellipsize(toStringValue, 100) + "</span>");
|
||||
i++;
|
||||
// showing the first two fields returned into document
|
||||
if (i == 2)
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
flex.setHTML(flex.getRowCount() + 1, 0, intFlex.getElement().getString());
|
||||
}
|
||||
|
||||
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
|
||||
if (tempRef != null) {
|
||||
|
||||
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
|
||||
}
|
||||
|
||||
List<SectionView> selections = projectView.getListSections();
|
||||
|
||||
boolean firstImageFound = false;
|
||||
for (SectionView sectionView : selections) {
|
||||
List<SubDocumentView> subDocuments = sectionView.getListSubDocuments();
|
||||
for (SubDocumentView subDoc : subDocuments) {
|
||||
List<FilesetDV> images = subDoc.getListImages();
|
||||
if (images != null && images.size() > 0) {
|
||||
for (FilesetDV fileset : images) {
|
||||
List<PayloadDV> payloads = fileset.getListPayload();
|
||||
if (payloads != null && payloads.size() > 0) {
|
||||
PayloadDV img = payloads.get(0);
|
||||
if (img != null && img.getLink() != null) {
|
||||
String theImgHTML = "<img src=\"" + img.getLink() + "\"></img>";
|
||||
GWT.log("theImgHTML: " + theImgHTML);
|
||||
flex.setHTML(flex.getRowCount() + 1, 0, theImgHTML);
|
||||
firstImageFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (firstImageFound)
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (firstImageFound)
|
||||
break;
|
||||
}
|
||||
|
||||
Button buttonOpenDtl = new Button("Open Details");
|
||||
buttonOpenDtl.getElement().setId("open-details");
|
||||
buttonOpenDtl.setType(ButtonType.LINK);
|
||||
|
||||
buttonOpenDtl.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
GWT.log("Open Details clicked");
|
||||
ShowDetailsEvent toEvent = new ShowDetailsEvent(LayerObjectType.INDEX_LAYER.name(),
|
||||
projectDV.getProfileID(), projectDV.getId(), null, true, EVENT_SOURCE.OPEN_DETAILS);
|
||||
applicationBus.fireEvent(toEvent);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
final Button buttonViewLayers = new Button("Zoom to Layers");
|
||||
buttonViewLayers.getElement().setId("go-to-layers");
|
||||
buttonViewLayers.getElement().setTitle("Zoom to Layers");
|
||||
buttonViewLayers.setType(ButtonType.LINK);
|
||||
|
||||
if (olMap.getCurrentZoomLevel() >= OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
|
||||
buttonViewLayers.setVisible(false);
|
||||
}
|
||||
|
||||
buttonViewLayers.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
GWT.log("View Layers clicked");
|
||||
fireGoToLayers();
|
||||
buttonViewLayers.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
FlowPanel flow = new FlowPanel();
|
||||
flow.add(buttonOpenDtl);
|
||||
flow.add(buttonViewLayers);
|
||||
vpPanel.add(flow);
|
||||
|
||||
Coordinate positionTo = null;
|
||||
|
||||
GeoJSON spatialReference = projectDV.getSpatialReference();
|
||||
if (spatialReference == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
ExtentWrapped ew = new ExtentWrapped(spatialReference.getBbox().getMinX(),
|
||||
spatialReference.getBbox().getMinY(), spatialReference.getBbox().getMaxX(),
|
||||
spatialReference.getBbox().getMaxY());
|
||||
|
||||
positionTo = MapUtils.transformCoordiante(ew.getCenter(), MAP_PROJECTION.EPSG_4326.getName(),
|
||||
MAP_PROJECTION.EPSG_3857.getName());
|
||||
} catch (Exception e) {
|
||||
GWT.log("Error on calculating center of the extent " + e.getMessage());
|
||||
}
|
||||
|
||||
// fallback
|
||||
if (positionTo == null)
|
||||
return;
|
||||
|
||||
final Coordinate centerTo = positionTo;
|
||||
new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
olMap.showPopup(vpPanel.toString(), centerTo);
|
||||
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
Element buttonElement = DOM.getElementById("open-details");
|
||||
Event.sinkEvents(buttonElement, Event.ONCLICK);
|
||||
Event.setEventListener(buttonElement, new EventListener() {
|
||||
|
||||
@Override
|
||||
public void onBrowserEvent(Event event) {
|
||||
if (Event.ONCLICK == event.getTypeInt()) {
|
||||
|
||||
ShowDetailsEvent toEvent = new ShowDetailsEvent(LayerObjectType.INDEX_LAYER.name(),
|
||||
projectDV.getProfileID(), projectDV.getId(), null, true,
|
||||
EVENT_SOURCE.OPEN_DETAILS);
|
||||
applicationBus.fireEvent(toEvent);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
Element buttonElement = DOM.getElementById("go-to-layers");
|
||||
Event.sinkEvents(buttonElement, Event.ONCLICK);
|
||||
Event.setEventListener(buttonElement, new EventListener() {
|
||||
|
||||
@Override
|
||||
public void onBrowserEvent(Event event) {
|
||||
if (Event.ONCLICK == event.getTypeInt()) {
|
||||
// buttonElement.setAttribute("visible", "none");
|
||||
// buttonElement.getStyle().setVisibility(Visibility.HIDDEN);
|
||||
fireGoToLayers();
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}.schedule(OpenLayerMap.SET_CENTER_ANIMATED_DURATION + 100);
|
||||
|
||||
olMap.setCenter(centerTo);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show popup info for centroid layer after clicking on map
|
||||
*
|
||||
* @param geoNaDataObject the geo na data object
|
||||
* @param feature the feature
|
||||
* @param onFailureCenterTo the on failure center to
|
||||
*/
|
||||
public void showPopupInfoForCentroidLayer(GeoNaSpatialQueryResult geoNaDataObject, FeatureRow feature,
|
||||
Coordinate onFailureCenterTo) {
|
||||
|
||||
GWT.log("showPopupInfoForCentroidLayer showing feature: " + feature);
|
||||
GWT.log("showPopupInfoForCentroidLayer showing layerObject: " + geoNaDataObject.getSourceLayerObject());
|
||||
|
||||
|
@ -912,12 +1130,6 @@ public class LayerManager {
|
|||
VerticalPanel vpPanel = new VerticalPanel();
|
||||
vpPanel.add(flex);
|
||||
|
||||
if (feature == null) {
|
||||
flex.setHTML(0, 0, new HTML("No data available").toString());
|
||||
olMap.showPopup(vpPanel.toString(), onFailureCenterTo);
|
||||
return;
|
||||
}
|
||||
|
||||
ProjectDV projectDV = geoNaDataObject.getSourceLayerObject().getProjectDV();
|
||||
|
||||
if (projectDV != null) {
|
||||
|
@ -953,9 +1165,6 @@ public class LayerManager {
|
|||
}
|
||||
}
|
||||
|
||||
// Showing properties belonging to centroid layer, ignoring this
|
||||
// Map<String, List<String>> entries = feature.getMapProperties();
|
||||
|
||||
if (geoNaDataObject.getMapImages() != null) {
|
||||
for (String key : geoNaDataObject.getMapImages().keySet()) {
|
||||
List<PayloadDV> listUI = geoNaDataObject.getMapImages().get(key);
|
||||
|
@ -974,7 +1183,6 @@ public class LayerManager {
|
|||
}
|
||||
|
||||
GWT.log("The selected Feature is: " + feature);
|
||||
// GeoportalDataViewerConstants.print("The selected Feature is: "+feature);
|
||||
FeatureRow theFeature = feature;
|
||||
Button buttonOpenDtl = new Button("Open Details");
|
||||
buttonOpenDtl.getElement().setId("open-details");
|
||||
|
@ -985,8 +1193,6 @@ public class LayerManager {
|
|||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
GWT.log("Open Details clicked");
|
||||
// ShowDetailsEvent toEvent = parseGeonaReferences(geoNaDataObject.getSourceLayerObject(), theFeature);
|
||||
// applicationBus.fireEvent(toEvent);
|
||||
fireOpenDetails(geoNaDataObject.getSourceLayerObject(), theFeature);
|
||||
|
||||
}
|
||||
|
@ -1017,53 +1223,60 @@ public class LayerManager {
|
|||
vpPanel.add(flow);
|
||||
|
||||
Coordinate positionTo = null;
|
||||
GWT.log("geometry is: " + feature.getGeometry());
|
||||
if (feature.getGeometry() != null) {
|
||||
GWT.log("trasforming geometry: " + feature.getGeometry().getToJSONObject());
|
||||
|
||||
Geometry geom = new GeoJson().readGeometry(feature.getGeometry().getToJSONObject(), null);
|
||||
if (feature == null) {
|
||||
positionTo = onFailureCenterTo;
|
||||
} else {
|
||||
|
||||
// POINT
|
||||
if (geom.getType().equalsIgnoreCase("Point")) {
|
||||
GWT.log("geometry: is a point");
|
||||
String coordinateJSON = feature.getGeometry().getCoordinatesJSON();
|
||||
JSONArray centerJSON = (JSONArray) JSONParser.parseStrict(coordinateJSON);
|
||||
// Coordinate center = OLFactory.createCoordinate(
|
||||
// new Double(centerJSON.get(0).toString()),
|
||||
// new Double(centerJSON.get(1).toString()));
|
||||
GWT.log("geometry is: " + feature.getGeometry());
|
||||
if (feature.getGeometry() != null) {
|
||||
GWT.log("trasforming geometry: " + feature.getGeometry().getToJSONObject());
|
||||
|
||||
Coordinate center = new Coordinate(new Double(centerJSON.get(0).toString()),
|
||||
new Double(centerJSON.get(1).toString()));
|
||||
Geometry geom = new GeoJson().readGeometry(feature.getGeometry().getToJSONObject(), null);
|
||||
|
||||
if (feature.getCrsName() != null && feature.getCrsName().endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
|
||||
// POINT
|
||||
if (geom.getType().equalsIgnoreCase("Point")) {
|
||||
GWT.log("geometry: is a point");
|
||||
String coordinateJSON = feature.getGeometry().getCoordinatesJSON();
|
||||
JSONArray centerJSON = (JSONArray) JSONParser.parseStrict(coordinateJSON);
|
||||
|
||||
Coordinate center = new Coordinate(new Double(centerJSON.get(0).toString()),
|
||||
new Double(centerJSON.get(1).toString()));
|
||||
|
||||
if (feature.getCrsName() != null
|
||||
&& feature.getCrsName().endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
|
||||
|
||||
center = MapUtils.transformCoordiante(center, MAP_PROJECTION.EPSG_4326.getName(),
|
||||
MAP_PROJECTION.EPSG_3857.getName());
|
||||
}
|
||||
positionTo = center;
|
||||
} else {
|
||||
|
||||
Extent geomExtent = geom.getExtent();
|
||||
|
||||
Coordinate lower = OLFactory.createCoordinate(geomExtent.getLowerLeftX(),
|
||||
geomExtent.getLowerLeftY());
|
||||
Coordinate upper = OLFactory.createCoordinate(geomExtent.getUpperRightX(),
|
||||
geomExtent.getUpperRightY());
|
||||
Coordinate lowerCoord = lower;
|
||||
Coordinate upperCoord = upper;
|
||||
if (feature.getCrsName() != null
|
||||
&& feature.getCrsName().endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
|
||||
|
||||
lowerCoord = MapUtils.transformCoordiante(lower, MAP_PROJECTION.EPSG_4326.getName(),
|
||||
MAP_PROJECTION.EPSG_3857.getName());
|
||||
upperCoord = MapUtils.transformCoordiante(upper, MAP_PROJECTION.EPSG_4326.getName(),
|
||||
MAP_PROJECTION.EPSG_3857.getName());
|
||||
}
|
||||
|
||||
ExtentWrapped ew = new ExtentWrapped(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(),
|
||||
upperCoord.getY());
|
||||
|
||||
positionTo = new Coordinate(ew.getCenter().getX(), ew.getCenter().getY());
|
||||
|
||||
center = MapUtils.transformCoordiante(center, MAP_PROJECTION.EPSG_4326.getName(),
|
||||
MAP_PROJECTION.EPSG_3857.getName());
|
||||
}
|
||||
positionTo = center;
|
||||
} else {
|
||||
|
||||
Extent geomExtent = geom.getExtent();
|
||||
|
||||
Coordinate lower = OLFactory.createCoordinate(geomExtent.getLowerLeftX(), geomExtent.getLowerLeftY());
|
||||
Coordinate upper = OLFactory.createCoordinate(geomExtent.getUpperRightX(), geomExtent.getUpperRightY());
|
||||
Coordinate lowerCoord = lower;
|
||||
Coordinate upperCoord = upper;
|
||||
if (feature.getCrsName() != null && feature.getCrsName().endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
|
||||
|
||||
lowerCoord = MapUtils.transformCoordiante(lower, MAP_PROJECTION.EPSG_4326.getName(),
|
||||
MAP_PROJECTION.EPSG_3857.getName());
|
||||
upperCoord = MapUtils.transformCoordiante(upper, MAP_PROJECTION.EPSG_4326.getName(),
|
||||
MAP_PROJECTION.EPSG_3857.getName());
|
||||
}
|
||||
|
||||
ExtentWrapped ew = new ExtentWrapped(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(),
|
||||
upperCoord.getY());
|
||||
|
||||
positionTo = new Coordinate(ew.getCenter().getX(), ew.getCenter().getY());
|
||||
|
||||
GWT.log("positionTo is: " + positionTo);
|
||||
}
|
||||
GWT.log("positionTo is: " + positionTo);
|
||||
}
|
||||
|
||||
// fallback
|
||||
|
@ -1088,10 +1301,6 @@ public class LayerManager {
|
|||
@Override
|
||||
public void onBrowserEvent(Event event) {
|
||||
if (Event.ONCLICK == event.getTypeInt()) {
|
||||
// ShowDetailsEvent toEvent = parseGeonaReferences(
|
||||
// geoNaDataObject.getSourceLayerObject(), theFeature);
|
||||
// applicationBus.fireEvent(toEvent);
|
||||
|
||||
fireOpenDetails(geoNaDataObject.getSourceLayerObject(), theFeature);
|
||||
}
|
||||
}
|
||||
|
@ -1130,6 +1339,9 @@ public class LayerManager {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire go to layers.
|
||||
*/
|
||||
protected void fireGoToLayers() {
|
||||
int zoomValue = (int) (OLMapManager.LAYER_DETAIL_MAX_RESOLUTION + 1);
|
||||
olMap.setZoom(zoomValue);
|
||||
|
@ -1141,6 +1353,12 @@ public class LayerManager {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire open details.
|
||||
*
|
||||
* @param layerObject the layer object
|
||||
* @param theFeature the the feature
|
||||
*/
|
||||
protected void fireOpenDetails(LayerObject layerObject, FeatureRow theFeature) {
|
||||
ShowDetailsEvent toEvent = parseGeonaReferences(layerObject, theFeature);
|
||||
applicationBus.fireEvent(toEvent);
|
||||
|
|
|
@ -183,11 +183,6 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
|
|||
return new GeoportalItemReferences(projectID, profileID, layerObjectType);
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
@ -203,6 +198,10 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
|
|||
builder.append(projectID);
|
||||
builder.append(", loadTimelineRelationships=");
|
||||
builder.append(loadTimelineRelationships);
|
||||
builder.append(", isEventFromTimeline=");
|
||||
builder.append(isEventFromTimeline);
|
||||
builder.append(", sourceEvent=");
|
||||
builder.append(sourceEvent);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
/**
|
||||
* The Class ShowDetailsEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jul 30, 2021
|
||||
*/
|
||||
public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHandler> {
|
||||
public static Type<ShowPopupOnCentroiEventHandler> TYPE = new Type<ShowPopupOnCentroiEventHandler>();
|
||||
private String profileID;
|
||||
private String projectID;
|
||||
private GeoJSON spatialReference;
|
||||
|
||||
/**
|
||||
* Instantiates a new show details event.
|
||||
*
|
||||
* @param geonaItemType the geona item type
|
||||
* @param geonaMongoID the geona mongo ID
|
||||
* @param itemName the item name
|
||||
* @param featureRow the feature row
|
||||
*/
|
||||
public ShowPopupOnCentroiEvent(String profileID, String projectID, GeoJSON spatialReference) {
|
||||
this.profileID = profileID;
|
||||
this.projectID = projectID;
|
||||
this.spatialReference = spatialReference;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
@Override
|
||||
public Type<ShowPopupOnCentroiEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(ShowPopupOnCentroiEventHandler handler) {
|
||||
handler.onShowPopup(this);
|
||||
|
||||
}
|
||||
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
||||
public String getProjectID() {
|
||||
return projectID;
|
||||
}
|
||||
|
||||
public GeoJSON getSpatialReference() {
|
||||
return spatialReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("ShowPopupOnCentroiEvent [profileID=");
|
||||
builder.append(profileID);
|
||||
builder.append(", projectID=");
|
||||
builder.append(projectID);
|
||||
builder.append(", spatialReference=");
|
||||
builder.append(spatialReference);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
/**
|
||||
* The Class ShowPopupOnCentroidEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jan 12, 2023
|
||||
*/
|
||||
public class ShowPopupOnCentroidEvent extends GwtEvent<ShowPopupOnCentroidEventHandler> {
|
||||
public static Type<ShowPopupOnCentroidEventHandler> TYPE = new Type<ShowPopupOnCentroidEventHandler>();
|
||||
private String profileID;
|
||||
private String projectID;
|
||||
private GeoJSON spatialReference;
|
||||
private ProjectView projectView;
|
||||
|
||||
/**
|
||||
* Instantiates a new show popup on centroid event.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @param spatialReference the spatial reference
|
||||
*/
|
||||
public ShowPopupOnCentroidEvent(String profileID, String projectID, GeoJSON spatialReference) {
|
||||
this.profileID = profileID;
|
||||
this.projectID = projectID;
|
||||
this.spatialReference = spatialReference;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new show popup on centroid event.
|
||||
*
|
||||
* @param projectView the project view
|
||||
*/
|
||||
public ShowPopupOnCentroidEvent(ProjectView projectView) {
|
||||
this.projectView = projectView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
@Override
|
||||
public Type<ShowPopupOnCentroidEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(ShowPopupOnCentroidEventHandler handler) {
|
||||
handler.onShowPopup(this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the profile ID.
|
||||
*
|
||||
* @return the profile ID
|
||||
*/
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the project ID.
|
||||
*
|
||||
* @return the project ID
|
||||
*/
|
||||
public String getProjectID() {
|
||||
return projectID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the spatial reference.
|
||||
*
|
||||
* @return the spatial reference
|
||||
*/
|
||||
public GeoJSON getSpatialReference() {
|
||||
return spatialReference;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the project view.
|
||||
*
|
||||
* @return the project view
|
||||
*/
|
||||
public ProjectView getProjectView() {
|
||||
return projectView;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("ShowPopupOnCentroidEvent [profileID=");
|
||||
builder.append(profileID);
|
||||
builder.append(", projectID=");
|
||||
builder.append(projectID);
|
||||
builder.append(", spatialReference=");
|
||||
builder.append(spatialReference);
|
||||
builder.append(", projectView=");
|
||||
builder.append(projectView);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -2,20 +2,19 @@ package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
|||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
/**
|
||||
* The Interface ShowPopupOnCentroiEventHandler.
|
||||
* The Interface ShowPopupOnCentroidEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Dec 10, 2021
|
||||
* Jan 12, 2023
|
||||
*/
|
||||
public interface ShowPopupOnCentroiEventHandler extends EventHandler {
|
||||
public interface ShowPopupOnCentroidEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On show popup.
|
||||
*
|
||||
* @param showPopupOnCentroiEvent the show popup on centroi event
|
||||
*/
|
||||
void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent);
|
||||
void onShowPopup(ShowPopupOnCentroidEvent showPopupOnCentroiEvent);
|
||||
}
|
|
@ -3,12 +3,10 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relati
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent.EVENT_SOURCE;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||
|
@ -130,7 +128,9 @@ public class TimelineRelationPanel extends Composite {
|
|||
public void setTimelineContainerVisible(boolean bool) {
|
||||
timelineContainer.setVisible(bool);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called when a project (box) is clicked into Timeline
|
||||
*/
|
||||
private void setSelectedProject(String theComposedProjectID) {
|
||||
this.selectedTimelineProjectID = theComposedProjectID;
|
||||
//selectedTimelineProjectID is the couple ProfileID,ProjectID
|
||||
|
@ -149,26 +149,6 @@ public class TimelineRelationPanel extends Composite {
|
|||
GWT.log("fireEvent: " + showDetailsEvent);
|
||||
|
||||
applicationBus.fireEvent(showDetailsEvent);
|
||||
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getSpatialReference(thePofileID, theProjectID,
|
||||
new AsyncCallback<GeoJSON>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(GeoJSON spatialReference) {
|
||||
if (spatialReference != null) {
|
||||
applicationBus.fireEvent(
|
||||
new ShowPopupOnCentroiEvent(thePofileID, theProjectID, spatialReference));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public String getSelectedProjectID() {
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetai
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent.EVENT_SOURCE;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
|
||||
|
@ -358,8 +357,8 @@ public class SearchFacilityUI extends Composite {
|
|||
// here
|
||||
appManagerBus.fireEvent(new ClosedViewDetailsEvent());
|
||||
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, true, true, EVENT_SOURCE.LOCATE_SEARCHED));
|
||||
appManagerBus.fireEvent(new ShowPopupOnCentroiEvent(profileID,
|
||||
resultDoc.getProjectID(), resultDoc.getSpatialReference()));
|
||||
// appManagerBus.fireEvent(new ShowPopupOnCentroidEvent(profileID,
|
||||
// resultDoc.getProjectID(), resultDoc.getSpatialReference()));
|
||||
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue