bug fixing on showing details
This commit is contained in:
parent
0c5085ca62
commit
66d3bd0c0b
|
@ -20,6 +20,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEven
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEventHandler;
|
||||
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.ui.GeonaDataViewMainPanel;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||
|
@ -315,7 +316,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
if (mainPanel.getDisplyedRecord() == null && !olMapMng.isQueryPointActive()) {
|
||||
olMapMng.hidePopInfo();
|
||||
olMapMng.removeDetailLayers();
|
||||
layerManager.removeAllDetailLayers();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -357,7 +358,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
GeoQuery select = olMapMng.toDataPointQuery(transfCoord, false);
|
||||
GWT.log("GeoQuery: " + select);
|
||||
// GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
|
||||
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, transfCoord,
|
||||
ExtentWrapped toExt = new ExtentWrapped(transfCoord.getX(), transfCoord.getY(), transfCoord.getX(), transfCoord.getY());
|
||||
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, toExt,
|
||||
record.getItemId(), true, MapEventType.ADDED_LAYER_TO_MAP));
|
||||
} else {
|
||||
GeoportalDataViewerConstants.printJs(
|
||||
|
|
|
@ -77,7 +77,8 @@ public class LayerManager {
|
|||
/** The ol map. */
|
||||
private OpenLayerOSM olMap;
|
||||
|
||||
private Map<String, LayerObject> layerObjects = new HashMap<String, LayerObject>();
|
||||
private Map<String, LayerObject> mapDetailLayerObjects = new HashMap<String, LayerObject>();
|
||||
private Map<String, LayerObject> mapBaseLayerObjects = new HashMap<String, LayerObject>();
|
||||
|
||||
private HandlerManager layerManagerBus = new HandlerManager("");
|
||||
|
||||
|
@ -153,7 +154,15 @@ public class LayerManager {
|
|||
// GWT.log("Layer found: "+layerName);
|
||||
// }
|
||||
|
||||
List<LayerObject> listLO = new ArrayList<LayerObject>(layerObjects.values());
|
||||
List<LayerObject> listLO = new ArrayList<LayerObject>();
|
||||
//for querying base layers
|
||||
listLO.addAll(mapBaseLayerObjects.values());
|
||||
|
||||
//for querying detail layers only in this case
|
||||
if(olMap.getCurrentResolution()<OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
|
||||
listLO.addAll(mapDetailLayerObjects.values());
|
||||
}
|
||||
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getDataResult(listLO, olMap.getProjectionCode(),
|
||||
mapBBOX, GeoportalDataViewerConstants.MAX_WFS_FEATURES, olMap.getCurrentZoomLevel(),
|
||||
new AsyncCallback<List<GeoNaSpatialQueryResult>>() {
|
||||
|
@ -224,7 +233,7 @@ public class LayerManager {
|
|||
|
||||
//Here I need to pass only the visible layers
|
||||
showPopupInfoForLayer(listGeonaDataObjects,
|
||||
queryEvent.getOnFailureCenterTo());
|
||||
queryEvent.getQueryClickExtent());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -239,8 +248,11 @@ public class LayerManager {
|
|||
|
||||
GWT.log("the product id is: " + theProductId);
|
||||
// Displaying popup info for centroid layer
|
||||
showPopupInfoForCentroidLayer(geoNaDataObject, feature,
|
||||
queryEvent.getOnFailureCenterTo());
|
||||
if (queryEvent.getSourceMapEventType()
|
||||
.equals(MapEventType.MOUSE_CLICK)){
|
||||
showPopupInfoForCentroidLayer(geoNaDataObject, feature,
|
||||
queryEvent.getQueryClickExtent().getCenter());
|
||||
}
|
||||
|
||||
// retrieving and showing WMS layers of a concessione if the ZOOM level is >
|
||||
// QUERY_MIN_ZOOM_LEVEL
|
||||
|
@ -271,7 +283,7 @@ public class LayerManager {
|
|||
} else {
|
||||
// removing all WMS detail layers if the ZOOM level is <
|
||||
// QUERY_MIN_ZOOM_LEVEL
|
||||
olMap.removeAllDetailLayers();
|
||||
removeAllDetailLayers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -295,11 +307,16 @@ public class LayerManager {
|
|||
@Override
|
||||
public void onZoomOut(ZoomOutOverMinimumEvent zoomOutEvent) {
|
||||
GWT.log("Fired into layerManagerBus " + zoomOutEvent);
|
||||
olMap.removeAllDetailLayers();
|
||||
removeAllDetailLayers();
|
||||
applicationBus.fireEvent(zoomOutEvent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void removeAllDetailLayers() {
|
||||
mapDetailLayerObjects.clear();
|
||||
olMap.removeAllDetailLayers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the geona references.
|
||||
|
@ -384,21 +401,31 @@ public class LayerManager {
|
|||
displayInLayerSwitcher, (ArrayList<String>) geoInfoWMS.getStyles().getGeoStyles(),
|
||||
geoInfoWMS.getWmsRequest(), false, geoInfoWMS.getMapWMSNoStandard(),
|
||||
geoInfoWMS.isNcWMS(), UUID, geoInfoWMS.getZAxis(), minResolution, maxResolution);
|
||||
|
||||
LayerObject lo = new LayerObject();
|
||||
lo.setLayerItem(layerItem);
|
||||
lo.setItemType(geonaItemType);
|
||||
|
||||
String key = layerItem.getMapServerHost() + "/layer/" + layerItem.getName();
|
||||
|
||||
// if a detail layer checking if it is already added to map
|
||||
if (asDetailLayer && layerObjects.containsKey(key)) {
|
||||
GWT.log("Skipping layer " + key + " already added to Map");
|
||||
} else {
|
||||
layerObjects.put(key, lo);
|
||||
if (!asDetailLayer)
|
||||
String key = layerItem.getName(); //should be unique
|
||||
//layerObjects.put(key, lo);
|
||||
|
||||
if(!asDetailLayer) {
|
||||
//is a base layer
|
||||
LayerObject blo = mapBaseLayerObjects.get(key);
|
||||
if(blo==null) {
|
||||
olMap.addWMSLayer(layerItem);
|
||||
else
|
||||
mapBaseLayerObjects.put(key, lo);
|
||||
}else {
|
||||
GWT.log("Skipping base layer " + key + " already added to Map");
|
||||
}
|
||||
}else {
|
||||
LayerObject dlo = mapDetailLayerObjects.get(key);
|
||||
if(dlo==null) {
|
||||
mapDetailLayerObjects.put(key, lo);
|
||||
olMap.addWMSDetailLayer(layerItem);
|
||||
}else {
|
||||
GWT.log("Skipping detail layer " + key + " already added to Map");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -496,7 +523,7 @@ public class LayerManager {
|
|||
* @param onFailureCenterTo the on failure center to
|
||||
*/
|
||||
public void showPopupInfoForLayer(List<GeoNaSpatialQueryResult> listGeoNaDataObject,
|
||||
Coordinate onFailureCenterTo) {
|
||||
ExtentWrapped queryClick) {
|
||||
|
||||
ScrollPanel scrollPanel = new ScrollPanel();
|
||||
VerticalPanel vpPanel = new VerticalPanel();
|
||||
|
@ -534,7 +561,7 @@ public class LayerManager {
|
|||
}
|
||||
|
||||
for (FeatureRow feature : features) {
|
||||
|
||||
|
||||
FlexTable intFlex = new FlexTable();
|
||||
intFlex.setCellPadding(1);
|
||||
intFlex.setCellSpacing(1);
|
||||
|
@ -569,7 +596,7 @@ public class LayerManager {
|
|||
|
||||
}
|
||||
|
||||
olMap.showPopup(scrollPanel.toString(), onFailureCenterTo);
|
||||
olMap.showPopup(scrollPanel.toString(), queryClick.getCenter());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -72,8 +72,9 @@ public class OLMapManager {
|
|||
//
|
||||
// }
|
||||
|
||||
ExtentWrapped toExt = new ExtentWrapped(coordinate.getX(), coordinate.getY(), coordinate.getX(), coordinate.getY());
|
||||
GeoQuery select = toDataPointQuery(coordinate, true);
|
||||
layerManagerBus.fireEvent(new QueryDataEvent(select, coordinate, null, true, MapEventType.MOUSE_CLICK));
|
||||
layerManagerBus.fireEvent(new QueryDataEvent(select, toExt, null, true, MapEventType.MOUSE_CLICK));
|
||||
|
||||
}
|
||||
|
||||
|
@ -203,7 +204,8 @@ public class OLMapManager {
|
|||
GWT.log("the distance is: " + dist);
|
||||
if (dist > 5000 || startExt.containsExtent(endExt)) {
|
||||
GeoQuery select = toDataBoxQuery(dragEndExtent);
|
||||
layerManagerBus.fireEvent(new QueryDataEvent(select, endExt.getCenter(), null, false, mapEventType));
|
||||
//TODO THE AUTOMATICALLY SHOWING POP-UP ACCORDING TO ZOOM IS BUGGY
|
||||
layerManagerBus.fireEvent(new QueryDataEvent(select, endExt, null, false, mapEventType));
|
||||
}
|
||||
} else if (zoomStart != null && zoomEnd != null) {
|
||||
|
||||
|
@ -252,11 +254,11 @@ public class OLMapManager {
|
|||
olMap.hidePopup();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the detail layers.
|
||||
*/
|
||||
public void removeDetailLayers() {
|
||||
olMap.removeAllDetailLayers();
|
||||
}
|
||||
// /**
|
||||
// * Removes the detail layers.
|
||||
// */
|
||||
// public void removeDetailLayers() {
|
||||
// olMap.removeAllDetailLayers();
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
import ol.Coordinate;
|
||||
|
||||
/**
|
||||
* The Class QueryDataEvent.
|
||||
*
|
||||
|
@ -17,7 +16,7 @@ import ol.Coordinate;
|
|||
public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
|
||||
public static Type<QueryDataEventHandler> TYPE = new Type<QueryDataEventHandler>();
|
||||
private GeoQuery select;
|
||||
private Coordinate onFailureCenterTo;
|
||||
private ExtentWrapped queryClickExtent;
|
||||
private String mongoItemId;
|
||||
private boolean onInit;
|
||||
private MapEventType sourceMapEventType;
|
||||
|
@ -31,10 +30,10 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
|
|||
* @param onInit the on init
|
||||
* @param mapEventType the map event type
|
||||
*/
|
||||
public QueryDataEvent(GeoQuery select, Coordinate onFailureCenterTo, String mongoItemId, boolean onInit,
|
||||
public QueryDataEvent(GeoQuery select, ExtentWrapped queryClickExtent, String mongoItemId, boolean onInit,
|
||||
MapEventType mapEventType) {
|
||||
this.select = select;
|
||||
this.onFailureCenterTo = onFailureCenterTo;
|
||||
this.queryClickExtent = queryClickExtent;
|
||||
this.mongoItemId = mongoItemId;
|
||||
this.onInit = onInit;
|
||||
this.sourceMapEventType = mapEventType;
|
||||
|
@ -88,13 +87,8 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
|
|||
return select;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the on failure center to.
|
||||
*
|
||||
* @return the on failure center to
|
||||
*/
|
||||
public Coordinate getOnFailureCenterTo() {
|
||||
return onFailureCenterTo;
|
||||
public ExtentWrapped getQueryClickExtent() {
|
||||
return queryClickExtent;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,18 +100,13 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
|
|||
return sourceMapEventType;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("QueryDataEvent [select=");
|
||||
builder.append(select);
|
||||
builder.append(", onFailureCenterTo=");
|
||||
builder.append(onFailureCenterTo);
|
||||
builder.append(", queryClickExtent=");
|
||||
builder.append(queryClickExtent);
|
||||
builder.append(", mongoItemId=");
|
||||
builder.append(mongoItemId);
|
||||
builder.append(", onInit=");
|
||||
|
|
|
@ -58,6 +58,7 @@ import ol.source.Source;
|
|||
import ol.source.Vector;
|
||||
import ol.source.XyzOptions;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class OpenLayerOSM.
|
||||
*
|
||||
|
@ -130,6 +131,8 @@ public abstract class OpenLayerOSM {
|
|||
|
||||
private java.util.Map<String, Image> wmsDetailsLayerMap;
|
||||
|
||||
private HashMap<String, Image> wmsLayerMap;
|
||||
|
||||
/**
|
||||
* Instantiates a new open layer OSM.
|
||||
*
|
||||
|
@ -329,34 +332,46 @@ public abstract class OpenLayerOSM {
|
|||
*/
|
||||
public void addWMSLayer(LayerItem layerItem) {
|
||||
|
||||
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||
imageWMSParams.setLayers(layerItem.getName());
|
||||
if (wmsLayerMap == null)
|
||||
wmsLayerMap = new HashMap<String, Image>();
|
||||
|
||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
||||
imageWMSOptions.setParams(imageWMSParams);
|
||||
// imageWMSOptions.setRatio(1.5f);
|
||||
String key = layerItem.getName();
|
||||
|
||||
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
|
||||
Image layer = wmsLayerMap.get(key);
|
||||
if (layer == null) {
|
||||
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||
imageWMSParams.setLayers(layerItem.getName());
|
||||
|
||||
LayerOptions layerOptions = OLFactory.createOptions();
|
||||
layerOptions.setSource(imageWMSSource);
|
||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
||||
imageWMSOptions.setParams(imageWMSParams);
|
||||
// imageWMSOptions.setRatio(1.5f);
|
||||
|
||||
// Settings MIN and MAX Resolution
|
||||
if (layerItem.getMinResolution() != null) {
|
||||
layerOptions.setMinResolution(layerItem.getMinResolution());
|
||||
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
|
||||
|
||||
LayerOptions layerOptions = OLFactory.createOptions();
|
||||
layerOptions.setSource(imageWMSSource);
|
||||
|
||||
// Settings MIN and MAX Resolution
|
||||
if (layerItem.getMinResolution() != null) {
|
||||
layerOptions.setMinResolution(layerItem.getMinResolution());
|
||||
}
|
||||
if (layerItem.getMaxResolution() != null) {
|
||||
layerOptions.setMaxResolution(layerItem.getMaxResolution());
|
||||
}
|
||||
|
||||
Image wmsLayer = new Image(layerOptions);
|
||||
|
||||
// visibleLayerItems
|
||||
|
||||
map.addLayer(wmsLayer);
|
||||
wmsLayerMap.put(key, wmsLayer);
|
||||
|
||||
GWT.log("Added WMSLayer for layer: " + layerItem.getName());
|
||||
eventBus.fireEvent(new AddedLayerToMapEvent(layerItem));
|
||||
} else {
|
||||
GWT.log("The WMS layer with key: " + key + " already exists, skipping");
|
||||
}
|
||||
if (layerItem.getMaxResolution() != null) {
|
||||
layerOptions.setMaxResolution(layerItem.getMaxResolution());
|
||||
}
|
||||
|
||||
Image wmsLayer = new Image(layerOptions);
|
||||
|
||||
// visibleLayerItems
|
||||
|
||||
map.addLayer(wmsLayer);
|
||||
GWT.log("Added WMSLayer for layer: " + layerItem.getName());
|
||||
eventBus.fireEvent(new AddedLayerToMapEvent(layerItem));
|
||||
|
||||
}
|
||||
|
||||
|
@ -370,7 +385,7 @@ public abstract class OpenLayerOSM {
|
|||
if (wmsDetailsLayerMap == null)
|
||||
wmsDetailsLayerMap = new HashMap<String, Image>();
|
||||
|
||||
String key = layerItem.getMapServerHost() + "/layer/" + layerItem.getName();
|
||||
String key = layerItem.getName();
|
||||
|
||||
Image layer = wmsDetailsLayerMap.get(key);
|
||||
|
||||
|
@ -406,7 +421,7 @@ public abstract class OpenLayerOSM {
|
|||
GWT.log("Added WMSDetailLayer for layer name: " + layerItem.getName());
|
||||
eventBus.fireEvent(new AddedLayerToMapEvent(layerItem));
|
||||
} else {
|
||||
GWT.log("The detail layer with key: " + key + " already exists, skipping");
|
||||
GWT.log("The WMS detail layer with key: " + key + " already exists, skipping");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -418,16 +433,17 @@ public abstract class OpenLayerOSM {
|
|||
|
||||
// NOT NEEDED ANYMORE.. I'M USING MIN/MAX LAYER RESOLUTION
|
||||
|
||||
/*
|
||||
* if (wmsDetailsLayerMap == null) return;
|
||||
*
|
||||
* GWT.log("Removing layers: " + wmsDetailsLayerMap.keySet() + " from map");
|
||||
*
|
||||
* for (String key : wmsDetailsLayerMap.keySet()) { Image layer =
|
||||
* wmsDetailsLayerMap.get(key); map.removeLayer(layer); }
|
||||
*
|
||||
* wmsDetailsLayerMap.clear();
|
||||
*/
|
||||
if (wmsDetailsLayerMap == null)
|
||||
return;
|
||||
|
||||
GWT.log("Removing layers: " + wmsDetailsLayerMap.keySet() + " from map");
|
||||
|
||||
for (String key : wmsDetailsLayerMap.keySet()) {
|
||||
Image layer = wmsDetailsLayerMap.get(key);
|
||||
map.removeLayer(layer);
|
||||
}
|
||||
|
||||
wmsDetailsLayerMap.clear();
|
||||
|
||||
}
|
||||
|
||||
|
@ -698,12 +714,13 @@ public abstract class OpenLayerOSM {
|
|||
return this.map != null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the layers.
|
||||
* Gets the layers from map.
|
||||
*
|
||||
* @return the layers
|
||||
* @return the layers from map
|
||||
*/
|
||||
public List<String> getLayers() {
|
||||
public List<String> getLayersFromMap() {
|
||||
Collection<Base> layers = map.getLayers();
|
||||
List<String> layerNames = null;
|
||||
if (layers != null) {
|
||||
|
@ -716,7 +733,7 @@ public abstract class OpenLayerOSM {
|
|||
|
||||
Source source = layerImage.getSource();
|
||||
// GWT.log("source: "+source.toString());
|
||||
//GeoportalDataViewerConstants.printJsObj(source);
|
||||
// GeoportalDataViewerConstants.printJsObj(source);
|
||||
String sorceRootObj = GeoportalDataViewerConstants.toJsonObj(source);
|
||||
JSONValue jsonObj = JSONParser.parseStrict(sorceRootObj);
|
||||
// GWT.log("jsonObj: " + jsonObj.toString());
|
||||
|
@ -733,4 +750,22 @@ public abstract class OpenLayerOSM {
|
|||
return layerNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the wms details layer map.
|
||||
*
|
||||
* @return the wms details layer map
|
||||
*/
|
||||
public java.util.Map<String, Image> getWmsDetailsLayerMap() {
|
||||
return wmsDetailsLayerMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the wms layer map.
|
||||
*
|
||||
* @return the wms layer map
|
||||
*/
|
||||
public HashMap<String, Image> getWmsLayerMap() {
|
||||
return wmsLayerMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -151,6 +151,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
//List<UploadedImageDV> listUI = getUploadedImagesForId("Concessione", cId, 1);
|
||||
Map<String, List<UploadedImageDV>> mapImages = new LinkedHashMap<String, List<UploadedImageDV>>();
|
||||
mapImages.put(cId, Arrays.asList(uplImg));
|
||||
//mapImages.put(cId, listUI);
|
||||
geoDAO.setMapImages(mapImages);
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Error on loading uploaded images for concessione: " + cId, e);
|
||||
|
|
Loading…
Reference in New Issue