Improved layers already displayed
This commit is contained in:
parent
0216e43423
commit
f63960aaf6
|
@ -58,6 +58,8 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Popover;
|
||||
import com.github.gwtbootstrap.client.ui.constants.Placement;
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
|
@ -71,6 +73,7 @@ import com.google.gwt.user.client.Window;
|
|||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
import ol.Coordinate;
|
||||
import ol.layer.Image;
|
||||
|
@ -354,7 +357,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
if (addLayerToMapEvent.getTheProjectDV() != null) {
|
||||
layerManager.addLayerToMapForProject(addLayerToMapEvent.getTheProjectDV().getProfileID(),
|
||||
addLayerToMapEvent.getTheProjectDV().getId(), addLayerToMapEvent.getTheProjectDV());
|
||||
addLayerToMapEvent.getTheProjectDV().getId(), addLayerToMapEvent.getTheProjectDV(), addLayerToMapEvent.isNotifyClashing());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -693,5 +696,26 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
public static void showPopover(final Widget w, String message, String heading) {
|
||||
|
||||
final Popover popover = new Popover();
|
||||
popover.setWidget(w);
|
||||
popover.setText(message);
|
||||
if (heading != null)
|
||||
popover.setHeading(heading);
|
||||
popover.setPlacement(Placement.BOTTOM);
|
||||
popover.reconfigure();
|
||||
popover.show();
|
||||
Timer timer = new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
popover.hide();
|
||||
}
|
||||
};
|
||||
|
||||
timer.schedule(3000);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
|||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
|
||||
|
@ -313,7 +314,7 @@ public class LayerManager {
|
|||
// QUERY_MIN_ZOOM_LEVEL
|
||||
final String theProfileID = geoNaDataObject.getSourceLayerObject().getProfileID();
|
||||
addLayerToMapForProject(theProfileID, theProductID, geoNaDataObject.getSourceLayerObject()
|
||||
.getProjectDV());
|
||||
.getProjectDV(), false);
|
||||
}
|
||||
} else {
|
||||
// removing all WMS detail layers if the ZOOM level is <
|
||||
|
@ -349,7 +350,16 @@ public class LayerManager {
|
|||
});
|
||||
}
|
||||
|
||||
public void addLayerToMapForProject(String theProfileID, String theProductID, ProjectDV theProjectDV) {
|
||||
|
||||
/**
|
||||
* Adds the layer to map for project.
|
||||
*
|
||||
* @param theProfileID the the profile ID
|
||||
* @param theProductID the the product ID
|
||||
* @param theProjectDV the the project DV
|
||||
* @param notifyLayerAlreadyAdded the notify layer already added
|
||||
*/
|
||||
public void addLayerToMapForProject(String theProfileID, String theProductID, ProjectDV theProjectDV, final boolean notifyLayerAlreadyAdded) {
|
||||
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getLayersForId(
|
||||
theProfileID, theProductID,
|
||||
|
@ -376,7 +386,7 @@ public class LayerManager {
|
|||
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
|
||||
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,
|
||||
theProfileID, theProductID,
|
||||
theProjectDV);
|
||||
theProjectDV, notifyLayerAlreadyAdded);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -462,7 +472,7 @@ public class LayerManager {
|
|||
private void addLayer(final LayerObjectType lot, final String layerTitle, final String layerName,
|
||||
final String wmsLink, final boolean isBase, final boolean displayInLayerSwitcher, final String UUID,
|
||||
final boolean asDetailLayer, Double minResolution, Double maxResolution, final String profileID,
|
||||
final String projectID, final ProjectDV projectDV) {
|
||||
final String projectID, final ProjectDV projectDV, final boolean notifyLayerAlreadyAdded) {
|
||||
GWT.log("addLayer called for profileID: " + profileID + ", projectID: " + projectID + ", projectDV: "
|
||||
+ projectDV);
|
||||
|
||||
|
@ -486,12 +496,7 @@ public class LayerManager {
|
|||
public void onSuccess(GeoInformationForWMSRequest geoInfoWMS) {
|
||||
|
||||
GWT.log("Parsed WMS Request returned: " + geoInfoWMS);
|
||||
// ddLayerByWms(featureType, layerTitle, result.getLayerName(),
|
||||
// result.getWmsRequest(), result.getBaseWmsServiceHost(), true, isBase,
|
||||
// displayInLayerSwitcher, (ArrayList<String>)
|
||||
// result.getStyles().getGeoStyles(), result.getWmsRequest(), false,
|
||||
// result.getMapWMSNoStandard(), result.isNcWMS(), UUID, result.getZAxis());
|
||||
|
||||
|
||||
LayerItem layerItem = toLayerItem(featureType, layerTitle, geoInfoWMS.getLayerName(),
|
||||
geoInfoWMS.getWmsRequest(), geoInfoWMS.getBaseWmsServiceHost(), true, isBase,
|
||||
displayInLayerSwitcher, (ArrayList<String>) geoInfoWMS.getStyles().getGeoStyles(),
|
||||
|
@ -532,33 +537,16 @@ public class LayerManager {
|
|||
} else {
|
||||
GWT.log("Skipping " + lo.getType() + " layer " + theLo.getLayerItem().getName()
|
||||
+ " already added to Map");
|
||||
if(notifyLayerAlreadyAdded) {
|
||||
GeoportalDataViewer.showPopover(RootPanel.get(GeoportalDataViewer.APP_NOTIFIER),
|
||||
"Layers from the selected project are already displayed", "Layers displayed");
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// String key = layerItem.getName(); // should be unique //
|
||||
// // layerObjects.put(key, lo);
|
||||
//
|
||||
// if (!asDetailLayer) { // is a base layer LayerObject blo =
|
||||
// LayerObject blo = mapIndexLayerObjects.get(key);
|
||||
// if (blo == null) {
|
||||
// olMap.addWMSLayer(layerItem);
|
||||
// mapIndexLayerObjects.put(key, lo);
|
||||
// } else {
|
||||
// GWT.log("Skipping base layer " + key + " already added to Map");
|
||||
// }
|
||||
// } else {
|
||||
// LayerObject dlo = mapOtherLayerObjects.get(key);
|
||||
// if (dlo == null) {
|
||||
// mapOtherLayerObjects.put(key, lo);
|
||||
// olMap.addWMSDetailLayer(layerItem);
|
||||
// overlayLayerManager.addLayerItem(lo); // overlayLayerManager.show(); } else {
|
||||
// GWT.log("Skipping detail layer " + key + " already added to Map");
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -575,7 +563,7 @@ public class LayerManager {
|
|||
String wmsLink = layer.getLayer().getOgcLinks().get("wms");
|
||||
GWT.log("index layer wmsLink: " + wmsLink);
|
||||
addLayer(LayerObjectType.INDEX_LAYER, null, null, wmsLink, false, false, null, false, null, null, profileID,
|
||||
null, null);
|
||||
null, null, false);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -14,14 +14,17 @@ import com.google.gwt.event.shared.GwtEvent;
|
|||
public class AddLayerToMapEvent extends GwtEvent<AddLayerToMapEventHandler> {
|
||||
public static Type<AddLayerToMapEventHandler> TYPE = new Type<AddLayerToMapEventHandler>();
|
||||
private ProjectDV theProjectDV;
|
||||
private boolean notifyClashing;
|
||||
|
||||
/**
|
||||
* Instantiates a new adds the layer to map event.
|
||||
*
|
||||
* @param theProjectDV the the project DV
|
||||
* @param notifyClashing the notify clashing
|
||||
*/
|
||||
public AddLayerToMapEvent(ProjectDV theProjectDV) {
|
||||
public AddLayerToMapEvent(ProjectDV theProjectDV, boolean notifyClashing) {
|
||||
this.theProjectDV = theProjectDV;
|
||||
this.notifyClashing = notifyClashing;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,9 +47,23 @@ public class AddLayerToMapEvent extends GwtEvent<AddLayerToMapEventHandler> {
|
|||
handler.onAddingLayerForProject(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the the project DV.
|
||||
*
|
||||
* @return the the project DV
|
||||
*/
|
||||
public ProjectDV getTheProjectDV() {
|
||||
return theProjectDV;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is notify clashing.
|
||||
*
|
||||
* @return true, if is notify clashing
|
||||
*/
|
||||
public boolean isNotifyClashing() {
|
||||
return notifyClashing;
|
||||
}
|
||||
|
||||
}
|
|
@ -189,7 +189,7 @@ public class ProjectViewer extends Composite {
|
|||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
applicationBus.fireEvent(new AddLayerToMapEvent(theProjectView.getTheProjectDV()));
|
||||
applicationBus.fireEvent(new AddLayerToMapEvent(theProjectView.getTheProjectDV(), true));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -3,13 +3,9 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relati
|
|||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Popover;
|
||||
import com.github.gwtbootstrap.client.ui.constants.Placement;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class TimelineManagerStatus {
|
||||
|
||||
|
@ -56,7 +52,7 @@ public class TimelineManagerStatus {
|
|||
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).add(timelineStatus.getTimelineRP());
|
||||
|
||||
} else if (showNotify) {
|
||||
setupPopover(RootPanel.get(GeoportalDataViewer.APP_NOTIFIER),
|
||||
GeoportalDataViewer.showPopover(RootPanel.get(GeoportalDataViewer.APP_NOTIFIER),
|
||||
"Timeline from the selected project is already displayed", "Timeline displayed");
|
||||
}
|
||||
|
||||
|
@ -64,26 +60,7 @@ public class TimelineManagerStatus {
|
|||
timelineStatus.getTimelineRP().setTimelineContainerVisible(true);
|
||||
}
|
||||
|
||||
protected void setupPopover(final Widget w, String message, String heading) {
|
||||
|
||||
final Popover popover = new Popover();
|
||||
popover.setWidget(w);
|
||||
popover.setText(message);
|
||||
if (heading != null)
|
||||
popover.setHeading(heading);
|
||||
popover.setPlacement(Placement.BOTTOM);
|
||||
popover.reconfigure();
|
||||
popover.show();
|
||||
Timer timer = new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
popover.hide();
|
||||
}
|
||||
};
|
||||
|
||||
timer.schedule(3000);
|
||||
}
|
||||
|
||||
public void hideTimelineProjectRelations() {
|
||||
GWT.log("hideTimelineProjectRelations");
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller;
|
|||
import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller;
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||
|
|
Loading…
Reference in New Issue