#23819 Enhancement implemented
This commit is contained in:
parent
3c64fd79f3
commit
bf5265bd63
|
@ -4,6 +4,12 @@
|
||||||
All notable changes to this project will be documented in this file.
|
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).
|
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
|
## [v2.3.1] - 2022-08-29
|
||||||
|
|
||||||
#### Bug fixed
|
#### Bug fixed
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -14,7 +14,7 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>geoportal-data-viewer-app</artifactId>
|
<artifactId>geoportal-data-viewer-app</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>2.3.1</version>
|
<version>2.4.0-SNAPSHOT</version>
|
||||||
<name>GeoPortal Data Viewer App</name>
|
<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>
|
<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())
|
if (listGeonaDataObjects == null || listGeonaDataObjects.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FeatureRow feature = null;
|
List<FeatureRow> theFeatures = null;
|
||||||
|
|
||||||
MapEventType sourceEvent = queryEvent.getSourceMapEventType();
|
MapEventType sourceEvent = queryEvent.getSourceMapEventType();
|
||||||
|
|
||||||
// TODO SWTCH FOR EARCH ITEM TYPE
|
// TODO SWTCH FOR EARCH ITEM TYPE
|
||||||
for (GeoNaSpatialQueryResult geoNaDataObject : listGeonaDataObjects) {
|
for (GeoNaSpatialQueryResult geoNaDataObject : listGeonaDataObjects) {
|
||||||
|
GWT.log("GeoNaDataObject: " + geoNaDataObject);
|
||||||
List<FeatureRow> features = geoNaDataObject.getFeatures();
|
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: "
|
GWT.log("GeoNaDataObject Source layer item name: " + layerItem.getName());
|
||||||
+ geoNaDataObject.getSourceLayerObject().getLayerItem().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
|
// USING ONLY THE FIRST FEATURE IN THE LIST
|
||||||
if (features != null && features.size() > 0) {
|
if (features != null && features.size() > 0) {
|
||||||
String theProductId = null;
|
|
||||||
// I need to show exactly the feature with produc_id == recordId
|
// I need to show exactly the feature with produc_id == recordId
|
||||||
if (mongoItemId != null) {
|
if (mongoItemId != null) {
|
||||||
for (FeatureRow fRow : features) {
|
GWT.log("MongoItemId is not null: " + mongoItemId);
|
||||||
List<String> productIdLst = fRow.getMapProperties()
|
// Searching mongoItemId in the list of product
|
||||||
.get("product_id");
|
theFeatures = listUniqueProducts.get(mongoItemId);
|
||||||
theProductId = productIdLst.get(0);
|
GWT.log("Loaded mongoItemId == product_id with id: " + mongoItemId
|
||||||
try {
|
+ ", the features are: " + theFeatures);
|
||||||
// long productId = Long.parseLong(thePID);
|
|
||||||
if (theProductId == mongoItemId) {
|
// the recordId/mongoItemId to show has been passed but not found into
|
||||||
feature = fRow;
|
// list of
|
||||||
GWT.log("Found recorId == product_id with id: "
|
// FeatureRow
|
||||||
+ theProductId);
|
if (theFeatures == null || theFeatures.isEmpty()) {
|
||||||
break;
|
return;
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
// TODO: handle exception
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If mongoItemId not passed, I'm using the first feature returned
|
// If mongoItemId not passed
|
||||||
if (mongoItemId == null) {
|
if (mongoItemId == null) {
|
||||||
feature = features.get(0);
|
GWT.log("MongoItemId is null");
|
||||||
List<String> productIdLst = feature.getMapProperties()
|
// Checking if the features returned belonging to detail layers (not
|
||||||
.get("product_id");
|
// centroids).
|
||||||
if (productIdLst == null) {
|
if (listUniqueProducts.isEmpty()) {
|
||||||
// in this case the feature/s returned is/are a (detail) layer/s
|
// in this case the feature/s returned is/are a (detail) layer/s
|
||||||
// belonging
|
// belonging
|
||||||
// to a record/concessione (not centroid layer),
|
// to a record/concessione (not centroid layer),
|
||||||
|
@ -257,26 +281,40 @@ public class LayerManager {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
theProductId = productIdLst.get(0);
|
}
|
||||||
} else {
|
|
||||||
// the recordId to show has been passed but not found into list of
|
// The features of the first centroid layer selected
|
||||||
// FeatureRow
|
if (theFeatures == null || theFeatures.size() == 0) {
|
||||||
if (feature == null) {
|
for (String theProductId : listUniqueProducts.keySet()) {
|
||||||
return;
|
|
||||||
|
theFeatures = listUniqueProducts.get(theProductId);
|
||||||
|
|
||||||
|
if (theFeatures.size() > 0)
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GWT.log("the product id is: " + theProductId);
|
// Displaying popup info for centroid layer passing the first feature
|
||||||
// Displaying popup info for centroid layer
|
|
||||||
if (sourceEvent.equals(MapEventType.MOUSE_CLICK)
|
if (sourceEvent.equals(MapEventType.MOUSE_CLICK)
|
||||||
|| sourceEvent.equals(MapEventType.ADDED_CENTROID_LAYER_TO_MAP)) {
|
|| 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());
|
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) {
|
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(
|
GeoportalDataViewerServiceAsync.Util.getInstance().getLayersForId(
|
||||||
"concessione", theProductId,
|
"concessione", theProductId,
|
||||||
new AsyncCallback<List<LayerConcessioneDV>>() {
|
new AsyncCallback<List<LayerConcessioneDV>>() {
|
||||||
|
@ -291,10 +329,12 @@ public class LayerManager {
|
||||||
public void onSuccess(List<LayerConcessioneDV> result) {
|
public void onSuccess(List<LayerConcessioneDV> result) {
|
||||||
|
|
||||||
for (LayerConcessioneDV layer : result) {
|
for (LayerConcessioneDV layer : result) {
|
||||||
GWT.log("Adding layer: " + layer.getLayerName());
|
GWT.log("Adding layer: "
|
||||||
|
+ layer.getLayerName());
|
||||||
addLayer("concessione", layer.getLayerName(),
|
addLayer("concessione", layer.getLayerName(),
|
||||||
layer.getLayerName(), layer.getWmsLink(),
|
layer.getLayerName(),
|
||||||
false, false, layer.getLayerUUID(), true,
|
layer.getWmsLink(), false, false,
|
||||||
|
layer.getLayerUUID(), true,
|
||||||
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
|
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
|
||||||
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,
|
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,
|
||||||
layer.getRefersTo());
|
layer.getRefersTo());
|
||||||
|
@ -302,6 +342,7 @@ public class LayerManager {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// removing all WMS detail layers if the ZOOM level is <
|
// removing all WMS detail layers if the ZOOM level is <
|
||||||
// QUERY_MIN_ZOOM_LEVEL
|
// QUERY_MIN_ZOOM_LEVEL
|
||||||
|
@ -624,7 +665,9 @@ public class LayerManager {
|
||||||
|
|
||||||
String nomeConcessione = lo.getSourceConcessione().getNome();
|
String nomeConcessione = lo.getSourceConcessione().getNome();
|
||||||
if (prevConcessioneName.compareTo(nomeConcessione) != 0) {
|
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 heading = new Heading(4, concessioneIntro);
|
||||||
heading.setTitle(nomeConcessione);
|
heading.setTitle(nomeConcessione);
|
||||||
heading.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
heading.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||||
|
@ -651,7 +694,8 @@ public class LayerManager {
|
||||||
@Override
|
@Override
|
||||||
public void onBrowserEvent(Event event) {
|
public void onBrowserEvent(Event event) {
|
||||||
if (Event.ONCLICK == event.getTypeInt()) {
|
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());
|
olMap.showPopup(scrollPanel.toString(), queryClick.getCenter());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -898,6 +941,7 @@ public class LayerManager {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue