#23819 Enhancement implemented #6
|
@ -4,6 +4,12 @@
|
|||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v2.4.0-SNAPSHOT] - 2022-09-07
|
||||
|
||||
#### Enhancement
|
||||
|
||||
- [#23819] Adding layers to principal map belonging to more centroids with the same spatial position
|
||||
|
||||
## [v2.3.1] - 2022-08-29
|
||||
|
||||
#### Bug fixed
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -14,7 +14,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>geoportal-data-viewer-app</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.3.1</version>
|
||||
<version>2.4.0-SNAPSHOT</version>
|
||||
<name>GeoPortal Data Viewer App</name>
|
||||
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Web-Map Interface</description>
|
||||
|
||||
|
|
|
@ -158,15 +158,15 @@ public class LayerManager {
|
|||
if (olMap.getCurrentResolution() < OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
|
||||
Collection<LayerObject> collLO = mapDetailLayerObjects.values();
|
||||
listLO.addAll(collLO);
|
||||
|
||||
|
||||
ArrayList<LayerObject> layerVisibility = new ArrayList<LayerObject>(collLO.size());
|
||||
layerVisibility.addAll(collLO);
|
||||
//Managing layer visibility. If a layer is not visible has to be not queryable
|
||||
// Managing layer visibility. If a layer is not visible has to be not queryable
|
||||
for (LayerObject layerObject : layerVisibility) {
|
||||
String layerName = layerObject.getLayerItem().getName();
|
||||
boolean isLayerVisible = olMap.isLayerVisible(layerName);
|
||||
if(!isLayerVisible) {
|
||||
GWT.log("From querying removing layername: "+layerName + ", it is not visible");
|
||||
if (!isLayerVisible) {
|
||||
GWT.log("From querying removing layername: " + layerName + ", it is not visible");
|
||||
listLO.remove(layerObject);
|
||||
}
|
||||
// else {
|
||||
|
@ -197,52 +197,76 @@ public class LayerManager {
|
|||
|
||||
GWT.log("GeoNaDataObject's is/are " + listGeonaDataObjects.size());
|
||||
// GWT.log("GeoNaDataObject's: " + listGeonaDataObjects);
|
||||
// GeoportalDataViewerConstants.print("GeoNaDataObject's:
|
||||
// "+listGeonaDataObjects);
|
||||
// GeoportalDataViewerConstants.print("GeoNaDataObject's:
|
||||
// "+listGeonaDataObjects);
|
||||
|
||||
if (listGeonaDataObjects == null || listGeonaDataObjects.isEmpty())
|
||||
return;
|
||||
|
||||
FeatureRow feature = null;
|
||||
List<FeatureRow> theFeatures = null;
|
||||
|
||||
MapEventType sourceEvent = queryEvent.getSourceMapEventType();
|
||||
|
||||
// TODO SWTCH FOR EARCH ITEM TYPE
|
||||
for (GeoNaSpatialQueryResult geoNaDataObject : listGeonaDataObjects) {
|
||||
GWT.log("GeoNaDataObject: " + geoNaDataObject);
|
||||
List<FeatureRow> features = geoNaDataObject.getFeatures();
|
||||
LayerItem layerItem = geoNaDataObject.getSourceLayerObject().getLayerItem();
|
||||
GWT.log(" features: " + features);
|
||||
GWT.log(" layerItem: " + layerItem);
|
||||
|
||||
GWT.log("GeoNaDataObject Source layer item name: "
|
||||
+ geoNaDataObject.getSourceLayerObject().getLayerItem().getName());
|
||||
GWT.log("GeoNaDataObject Source layer item name: " + layerItem.getName());
|
||||
|
||||
// USING ONLY THE FIRST FEATURE IN THE LIST
|
||||
HashMap<String, List<FeatureRow>> listUniqueProducts = new HashMap<String, List<FeatureRow>>();
|
||||
// Clustering features for productId
|
||||
if (features != null && features.size() > 0) {
|
||||
String theProductId = null;
|
||||
// I need to show exactly the feature with produc_id == recordId
|
||||
if (mongoItemId != null) {
|
||||
for (FeatureRow fRow : features) {
|
||||
List<String> productIdLst = fRow.getMapProperties()
|
||||
.get("product_id");
|
||||
for (FeatureRow fRow : features) {
|
||||
List<String> productIdLst = fRow.getMapProperties().get("product_id");
|
||||
if (productIdLst != null) {
|
||||
theProductId = productIdLst.get(0);
|
||||
try {
|
||||
// long productId = Long.parseLong(thePID);
|
||||
if (theProductId == mongoItemId) {
|
||||
feature = fRow;
|
||||
GWT.log("Found recorId == product_id with id: "
|
||||
+ theProductId);
|
||||
break;
|
||||
if (theProductId != null) {
|
||||
List<FeatureRow> listFeatures = listUniqueProducts
|
||||
.get(theProductId);
|
||||
if (listFeatures == null) {
|
||||
listFeatures = new ArrayList<FeatureRow>();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
|
||||
listFeatures.add(fRow);
|
||||
listUniqueProducts.put(theProductId, listFeatures);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If mongoItemId not passed, I'm using the first feature returned
|
||||
}
|
||||
|
||||
GWT.log("listUniqueProducts keyset: " + listUniqueProducts.keySet());
|
||||
|
||||
// USING ONLY THE FIRST FEATURE IN THE LIST
|
||||
if (features != null && features.size() > 0) {
|
||||
|
||||
// I need to show exactly the feature with produc_id == recordId
|
||||
if (mongoItemId != null) {
|
||||
GWT.log("MongoItemId is not null: " + mongoItemId);
|
||||
// Searching mongoItemId in the list of product
|
||||
theFeatures = listUniqueProducts.get(mongoItemId);
|
||||
GWT.log("Loaded mongoItemId == product_id with id: " + mongoItemId
|
||||
+ ", the features are: " + theFeatures);
|
||||
|
||||
// the recordId/mongoItemId to show has been passed but not found into
|
||||
// list of
|
||||
// FeatureRow
|
||||
if (theFeatures == null || theFeatures.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If mongoItemId not passed
|
||||
if (mongoItemId == null) {
|
||||
feature = features.get(0);
|
||||
List<String> productIdLst = feature.getMapProperties()
|
||||
.get("product_id");
|
||||
if (productIdLst == null) {
|
||||
GWT.log("MongoItemId is null");
|
||||
// Checking if the features returned belonging to detail layers (not
|
||||
// centroids).
|
||||
if (listUniqueProducts.isEmpty()) {
|
||||
// in this case the feature/s returned is/are a (detail) layer/s
|
||||
// belonging
|
||||
// to a record/concessione (not centroid layer),
|
||||
|
@ -257,51 +281,68 @@ public class LayerManager {
|
|||
}
|
||||
return;
|
||||
}
|
||||
theProductId = productIdLst.get(0);
|
||||
} else {
|
||||
// the recordId to show has been passed but not found into list of
|
||||
// FeatureRow
|
||||
if (feature == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The features of the first centroid layer selected
|
||||
if (theFeatures == null || theFeatures.size() == 0) {
|
||||
for (String theProductId : listUniqueProducts.keySet()) {
|
||||
|
||||
theFeatures = listUniqueProducts.get(theProductId);
|
||||
|
||||
if (theFeatures.size() > 0)
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
GWT.log("the product id is: " + theProductId);
|
||||
// Displaying popup info for centroid layer
|
||||
// Displaying popup info for centroid layer passing the first feature
|
||||
if (sourceEvent.equals(MapEventType.MOUSE_CLICK)
|
||||
|| sourceEvent.equals(MapEventType.ADDED_CENTROID_LAYER_TO_MAP)) {
|
||||
showPopupInfoForCentroidLayer(geoNaDataObject, feature,
|
||||
GWT.log("Source event is: " + MapEventType.MOUSE_CLICK + ", or "
|
||||
+ MapEventType.ADDED_CENTROID_LAYER_TO_MAP);
|
||||
|
||||
// Displaying popup info for centroid layer passing the first feature
|
||||
showPopupInfoForCentroidLayer(geoNaDataObject, theFeatures.get(0),
|
||||
queryEvent.getQueryClickExtent().getCenter());
|
||||
}
|
||||
|
||||
// retrieving and showing WMS layers of a concessione if the ZOOM level is >
|
||||
// QUERY_MIN_ZOOM_LEVEL
|
||||
if (olMap.getCurrentZoomLevel() > OLMapManager.QUERY_MIN_ZOOM_LEVEL) {
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getLayersForId(
|
||||
"concessione", theProductId,
|
||||
new AsyncCallback<List<LayerConcessioneDV>>() {
|
||||
GWT.log("Current zoom level is less than QUERY_MIN_ZOOM_LEVEL, Loading all layers of any product");
|
||||
for (String theProductId : listUniqueProducts.keySet()) {
|
||||
GWT.log("Loading layers of theProductId: " + theProductId);
|
||||
// retrieving and showing WMS layers of a concessione if the ZOOM
|
||||
// level
|
||||
// is >
|
||||
// QUERY_MIN_ZOOM_LEVEL
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getLayersForId(
|
||||
"concessione", theProductId,
|
||||
new AsyncCallback<List<LayerConcessioneDV>>() {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<LayerConcessioneDV> result) {
|
||||
|
||||
for (LayerConcessioneDV layer : result) {
|
||||
GWT.log("Adding layer: " + layer.getLayerName());
|
||||
addLayer("concessione", layer.getLayerName(),
|
||||
layer.getLayerName(), layer.getWmsLink(),
|
||||
false, false, layer.getLayerUUID(), true,
|
||||
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
|
||||
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,
|
||||
layer.getRefersTo());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onSuccess(List<LayerConcessioneDV> result) {
|
||||
|
||||
for (LayerConcessioneDV layer : result) {
|
||||
GWT.log("Adding layer: "
|
||||
+ layer.getLayerName());
|
||||
addLayer("concessione", layer.getLayerName(),
|
||||
layer.getLayerName(),
|
||||
layer.getWmsLink(), false, false,
|
||||
layer.getLayerUUID(), true,
|
||||
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
|
||||
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,
|
||||
layer.getRefersTo());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// removing all WMS detail layers if the ZOOM level is <
|
||||
// QUERY_MIN_ZOOM_LEVEL
|
||||
|
@ -453,7 +494,7 @@ public class LayerManager {
|
|||
mapDetailLayerObjects.put(key, lo);
|
||||
olMap.addWMSDetailLayer(layerItem);
|
||||
overlayLayerManager.addLayerItem(lo);
|
||||
//overlayLayerManager.show();
|
||||
// overlayLayerManager.show();
|
||||
} else {
|
||||
GWT.log("Skipping detail layer " + key + " already added to Map");
|
||||
}
|
||||
|
@ -550,7 +591,7 @@ public class LayerManager {
|
|||
* Show popup info for layer.
|
||||
*
|
||||
* @param listGeoNaDataObject the list geo na data object
|
||||
* @param queryClick the query click
|
||||
* @param queryClick the query click
|
||||
*/
|
||||
public void showPopupInfoForLayer(List<GeoNaSpatialQueryResult> listGeoNaDataObject, ExtentWrapped queryClick) {
|
||||
|
||||
|
@ -558,9 +599,9 @@ public class LayerManager {
|
|||
final FlowPanel flowPanel = new FlowPanel();
|
||||
flowPanel.getElement().getStyle().setProperty("maxHeight", "600px");
|
||||
scrollPanel.add(flowPanel);
|
||||
|
||||
|
||||
List<Button> listOpenProject = new ArrayList<Button>();
|
||||
|
||||
|
||||
final Button expandButton = new Button("Expand");
|
||||
expandButton.setType(ButtonType.LINK);
|
||||
expandButton.setIcon(IconType.EXPAND);
|
||||
|
@ -568,7 +609,7 @@ public class LayerManager {
|
|||
expandButton.setTitle("Show this view in new Window");
|
||||
|
||||
flowPanel.add(expandButton);
|
||||
|
||||
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
|
@ -581,7 +622,7 @@ public class LayerManager {
|
|||
public void onBrowserEvent(Event event) {
|
||||
if (Event.ONCLICK == event.getTypeInt()) {
|
||||
expandButton.setVisible(false);
|
||||
//hiding the Open Project in expand mode (Modal Window)
|
||||
// hiding the Open Project in expand mode (Modal Window)
|
||||
for (Button butt : listOpenProject) {
|
||||
butt.setVisible(false);
|
||||
}
|
||||
|
@ -591,7 +632,7 @@ public class LayerManager {
|
|||
Coordinate center = queryClick.getCenter();
|
||||
double x = center.getX();
|
||||
double y = center.getY();
|
||||
//"with center x: "+x +", y: "+y;
|
||||
// "with center x: "+x +", y: "+y;
|
||||
ModalWindow mw = new ModalWindow("Query results...", width, height);
|
||||
mw.add(flowPanel);
|
||||
mw.show();
|
||||
|
@ -600,7 +641,7 @@ public class LayerManager {
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
String prevConcessioneName = "";
|
||||
for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
|
||||
try {
|
||||
|
@ -615,23 +656,25 @@ public class LayerManager {
|
|||
|| layerSourceName.compareToIgnoreCase(baseLayerFromISProfile.getName()) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
List<FeatureRow> features = geoNaSpatialQueryResult.getFeatures();
|
||||
|
||||
|
||||
if (features == null || features.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
String nomeConcessione = lo.getSourceConcessione().getNome();
|
||||
if (prevConcessioneName.compareTo(nomeConcessione) != 0) {
|
||||
String concessioneIntro = nomeConcessione.length()>100? StringUtil.ellipsize(nomeConcessione, 100):nomeConcessione;
|
||||
String concessioneIntro = nomeConcessione.length() > 100
|
||||
? StringUtil.ellipsize(nomeConcessione, 100)
|
||||
: nomeConcessione;
|
||||
Heading heading = new Heading(4, concessioneIntro);
|
||||
heading.setTitle(nomeConcessione);
|
||||
heading.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||
flowPanel.add(heading);
|
||||
|
||||
|
||||
Button buttOpenProject = new Button("Open Project");
|
||||
final String buttId = "open-details-"+Random.nextInt();
|
||||
final String buttId = "open-details-" + Random.nextInt();
|
||||
Element bEl = buttOpenProject.getElement();
|
||||
bEl.setId(buttId);
|
||||
bEl.getStyle().setPaddingLeft(0, Unit.PX);
|
||||
|
@ -651,7 +694,8 @@ public class LayerManager {
|
|||
@Override
|
||||
public void onBrowserEvent(Event event) {
|
||||
if (Event.ONCLICK == event.getTypeInt()) {
|
||||
applicationBus.fireEvent(new ShowDetailsEvent("concessione", lo.getSourceConcessione().getItemId(), nomeConcessione, null));
|
||||
applicationBus.fireEvent(new ShowDetailsEvent("concessione",
|
||||
lo.getSourceConcessione().getItemId(), nomeConcessione, null));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -723,12 +767,11 @@ public class LayerManager {
|
|||
GeoportalDataViewerConstants.printJs("Error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
olMap.showPopup(scrollPanel.toString(), queryClick.getCenter());
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show popup info for centroid layer.
|
||||
*
|
||||
|
@ -790,7 +833,7 @@ public class LayerManager {
|
|||
GWT.log("Adding images: " + listUI);
|
||||
if (listUI != null && listUI.size() > 0) {
|
||||
UploadedImageDV img = listUI.get(0);
|
||||
if (img!= null && img.getListWsContent() != null) {
|
||||
if (img != null && img.getListWsContent() != null) {
|
||||
WorkspaceContentDV wsContent = img.getListWsContent().get(img.getListWsContent().size() - 1);
|
||||
String theImgHTML = "<img src=\"" + wsContent.getLink() + "\"></img>";
|
||||
GWT.log("theImgHTML: " + theImgHTML);
|
||||
|
@ -898,6 +941,7 @@ public class LayerManager {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue