Synchronized the Timeline selected project with the showing popoup on
centroid
This commit is contained in:
parent
2e2ecfa41d
commit
c4ebdcf003
|
@ -229,7 +229,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
GWT.log("Loading collections, count " + result.getAvailableCollections().size());
|
||||
|
||||
mainPanel.setAvailableCollections(result.getAvailableCollections().values(), paramGeonaItemType);
|
||||
mainPanel.setAvailableCollections(result.getAvailableCollections().values(),
|
||||
paramGeonaItemType);
|
||||
|
||||
if (paramGeonaItemID != null) {
|
||||
if (paramGeonaItemType == null) {
|
||||
|
@ -357,7 +358,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
if (addLayerToMapEvent.getTheProjectDV() != null) {
|
||||
layerManager.addLayerToMapForProject(addLayerToMapEvent.getTheProjectDV().getProfileID(),
|
||||
addLayerToMapEvent.getTheProjectDV().getId(), addLayerToMapEvent.getTheProjectDV(), addLayerToMapEvent.isNotifyClashing());
|
||||
addLayerToMapEvent.getTheProjectDV().getId(), addLayerToMapEvent.getTheProjectDV(),
|
||||
addLayerToMapEvent.isNotifyClashing());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -612,9 +614,14 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
@Override
|
||||
public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) {
|
||||
|
||||
if (showPopupOnCentroiEvent.getDocument() != null)
|
||||
performWFSQueryOnCentroid(showPopupOnCentroiEvent.getDocument().getProjectID(),
|
||||
showPopupOnCentroiEvent.getCentroidLong(), showPopupOnCentroiEvent.getCentroidLat());
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
|||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
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.view.ProjectView;
|
||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||
|
@ -169,4 +170,13 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
*/
|
||||
List<String> getRelationshipsForTimeline(String profileID, String projectID) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the spatial reference.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @return the spatial reference
|
||||
*/
|
||||
GeoJSON getSpatialReference(String profileID, String projectID);
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
|||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
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.view.ProjectView;
|
||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||
|
@ -72,4 +73,6 @@ public interface GeoportalDataViewerServiceAsync {
|
|||
|
||||
void getRelationshipsForTimeline(String profileID, String projectID, AsyncCallback<List<String>> callback);
|
||||
|
||||
void getSpatialReference(String profileID, String projectID, AsyncCallback<GeoJSON> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
@ -13,9 +13,9 @@ import com.google.gwt.event.shared.GwtEvent;
|
|||
*/
|
||||
public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHandler> {
|
||||
public static Type<ShowPopupOnCentroiEventHandler> TYPE = new Type<ShowPopupOnCentroiEventHandler>();
|
||||
private DocumentDV document;
|
||||
private Double centroidLong;
|
||||
private Double centroidLat;
|
||||
private String profileID;
|
||||
private String projectID;
|
||||
private GeoJSON spatialReference;
|
||||
|
||||
/**
|
||||
* Instantiates a new show details event.
|
||||
|
@ -25,10 +25,10 @@ public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHan
|
|||
* @param itemName the item name
|
||||
* @param featureRow the feature row
|
||||
*/
|
||||
public ShowPopupOnCentroiEvent(DocumentDV document, Double centroidLong, Double centroidLat) {
|
||||
this.document = document;
|
||||
this.centroidLong = centroidLong;
|
||||
this.centroidLat = centroidLat;
|
||||
public ShowPopupOnCentroiEvent(String profileID, String projectID, GeoJSON spatialReference) {
|
||||
this.profileID = profileID;
|
||||
this.projectID = projectID;
|
||||
this.spatialReference = spatialReference;
|
||||
|
||||
}
|
||||
|
||||
|
@ -53,16 +53,29 @@ public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHan
|
|||
|
||||
}
|
||||
|
||||
public DocumentDV getDocument() {
|
||||
return document;
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
||||
public Double getCentroidLat() {
|
||||
return centroidLat;
|
||||
public String getProjectID() {
|
||||
return projectID;
|
||||
}
|
||||
|
||||
public Double getCentroidLong() {
|
||||
return centroidLong;
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
|
@ -3,9 +3,11 @@ 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.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;
|
||||
|
@ -48,7 +50,7 @@ public class TimelineRelationPanel extends Composite {
|
|||
|
||||
private TimelineRelationPanel instance = this;
|
||||
|
||||
private String selectedProjectID;
|
||||
private String selectedTimelineProjectID;
|
||||
|
||||
private ProjectDV theProjectDV;
|
||||
|
||||
|
@ -76,7 +78,6 @@ public class TimelineRelationPanel extends Composite {
|
|||
|
||||
timelineContainer.add(loaderData);
|
||||
|
||||
|
||||
timelinePopupCloser.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -129,25 +130,47 @@ public class TimelineRelationPanel extends Composite {
|
|||
timelineContainer.setVisible(bool);
|
||||
}
|
||||
|
||||
private void setSelectedProject(String projectID) {
|
||||
this.selectedProjectID = projectID;
|
||||
GWT.log("selectedProjectID: " + selectedProjectID);
|
||||
private void setSelectedProject(String theComposedProjectID) {
|
||||
this.selectedTimelineProjectID = theComposedProjectID;
|
||||
//selectedTimelineProjectID is the couple ProfileID,ProjectID
|
||||
GWT.log("selectedTimelineProjectID: " + selectedTimelineProjectID);
|
||||
|
||||
if(selectedProjectID == null || selectedProjectID.isEmpty())
|
||||
if (selectedTimelineProjectID == null || selectedTimelineProjectID.isEmpty())
|
||||
return;
|
||||
|
||||
String[] references = this.selectedProjectID.split(",");
|
||||
String[] references = this.selectedTimelineProjectID.split(",");
|
||||
|
||||
GeoportalItemReferences gir = new GeoportalItemReferences(references[1], references[0]);
|
||||
final String thePofileID = references[0];
|
||||
final String theProjectID = references[1];
|
||||
GeoportalItemReferences gir = new GeoportalItemReferences(theProjectID, thePofileID);
|
||||
ShowDetailsEvent showDetailsEvent = new ShowDetailsEvent(gir, null, false);
|
||||
GWT.log("fireEvetn: " + 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() {
|
||||
return selectedProjectID;
|
||||
return selectedTimelineProjectID;
|
||||
}
|
||||
|
||||
public static native String instanceTimeline(String idDivContainer, JSONArray jsonItems,
|
||||
|
|
|
@ -15,12 +15,10 @@ import org.gcube.application.geoportalcommon.shared.WhereClause;
|
|||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||
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.ShowDetailsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
||||
|
||||
|
@ -52,8 +50,6 @@ import com.google.gwt.user.client.ui.HTMLPanel;
|
|||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
import ol.Coordinate;
|
||||
|
||||
/**
|
||||
* The Class SearchFacilityUI.
|
||||
*
|
||||
|
@ -332,21 +328,8 @@ public class SearchFacilityUI extends Composite {
|
|||
GeoportalItemReferences gir = new GeoportalItemReferences(resultDoc.getProjectID(),
|
||||
profileID);
|
||||
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, true));
|
||||
|
||||
GeoJSON spatialReference = resultDoc.getSpatialReference();
|
||||
Coordinate transfCoord = MapUtils.geoJSONTToBBoxCenter(spatialReference, null,
|
||||
null);
|
||||
|
||||
Double centerLong = null;
|
||||
Double centerLat = null;
|
||||
|
||||
if (transfCoord != null) {
|
||||
centerLong = transfCoord.getX();
|
||||
centerLat = transfCoord.getY();
|
||||
}
|
||||
|
||||
appManagerBus
|
||||
.fireEvent(new ShowPopupOnCentroiEvent(resultDoc, centerLong, centerLat));
|
||||
.fireEvent(new ShowPopupOnCentroiEvent(profileID, resultDoc.getProjectID(), resultDoc.getSpatialReference()));
|
||||
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1035,7 +1035,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
}
|
||||
|
||||
if (layerObject.getProjectDV().getSpatialReference() == null) {
|
||||
GeoJSON geoJson = spatialReference(layerObject.getProfileID(), layerObject.getProjectID());
|
||||
GeoJSON geoJson = getSpatialReference(layerObject.getProfileID(),
|
||||
layerObject.getProjectID());
|
||||
layerObject.getProjectDV().setSpatialReference(geoJson);
|
||||
}
|
||||
|
||||
|
@ -1149,13 +1150,14 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
}
|
||||
|
||||
/**
|
||||
* Spatial reference.
|
||||
* Gets the spatial reference.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @return the geo JSON
|
||||
* @return the spatial reference
|
||||
*/
|
||||
private GeoJSON spatialReference(String profileID, String projectID) {
|
||||
@Override
|
||||
public GeoJSON getSpatialReference(String profileID, String projectID) {
|
||||
LOG.trace("spatialReference for profileID: " + profileID + ", projectID: " + projectID + "called");
|
||||
try {
|
||||
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||
|
|
Loading…
Reference in New Issue