#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>
|
||||
|
||||
|
|
|
@ -203,46 +203,70 @@ public class LayerManager {
|
|||
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());
|
||||
|
||||
HashMap<String, List<FeatureRow>> listUniqueProducts = new HashMap<String, List<FeatureRow>>();
|
||||
// Clustering features for productId
|
||||
if (features != null && features.size() > 0) {
|
||||
String theProductId = null;
|
||||
for (FeatureRow fRow : features) {
|
||||
List<String> productIdLst = fRow.getMapProperties().get("product_id");
|
||||
if (productIdLst != null) {
|
||||
theProductId = productIdLst.get(0);
|
||||
if (theProductId != null) {
|
||||
List<FeatureRow> listFeatures = listUniqueProducts
|
||||
.get(theProductId);
|
||||
if (listFeatures == null) {
|
||||
listFeatures = new ArrayList<FeatureRow>();
|
||||
}
|
||||
|
||||
listFeatures.add(fRow);
|
||||
listUniqueProducts.put(theProductId, listFeatures);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GWT.log("listUniqueProducts keyset: " + listUniqueProducts.keySet());
|
||||
|
||||
// USING ONLY THE FIRST FEATURE IN THE LIST
|
||||
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");
|
||||
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;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
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, I'm using the first feature returned
|
||||
// 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,26 +281,40 @@ 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) {
|
||||
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
|
||||
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getLayersForId(
|
||||
"concessione", theProductId,
|
||||
new AsyncCallback<List<LayerConcessioneDV>>() {
|
||||
|
@ -291,10 +329,12 @@ public class LayerManager {
|
|||
public void onSuccess(List<LayerConcessioneDV> result) {
|
||||
|
||||
for (LayerConcessioneDV layer : result) {
|
||||
GWT.log("Adding layer: " + layer.getLayerName());
|
||||
GWT.log("Adding layer: "
|
||||
+ layer.getLayerName());
|
||||
addLayer("concessione", layer.getLayerName(),
|
||||
layer.getLayerName(), layer.getWmsLink(),
|
||||
false, false, layer.getLayerUUID(), true,
|
||||
layer.getLayerName(),
|
||||
layer.getWmsLink(), false, false,
|
||||
layer.getLayerUUID(), true,
|
||||
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
|
||||
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,
|
||||
layer.getRefersTo());
|
||||
|
@ -302,6 +342,7 @@ public class LayerManager {
|
|||
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// removing all WMS detail layers if the ZOOM level is <
|
||||
// QUERY_MIN_ZOOM_LEVEL
|
||||
|
@ -624,7 +665,9 @@ public class LayerManager {
|
|||
|
||||
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);
|
||||
|
@ -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));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -724,7 +768,6 @@ public class LayerManager {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
olMap.showPopup(scrollPanel.toString(), queryClick.getCenter());
|
||||
|
||||
}
|
||||
|
@ -898,6 +941,7 @@ public class LayerManager {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue