Setting initial layer opacity at 0.8

This commit is contained in:
Francesco Mangiacrapa 2023-06-09 13:54:45 +02:00
parent b7885b3b72
commit 23feb1a3c8
7 changed files with 16 additions and 14 deletions

View File

@ -521,9 +521,6 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="geoportal-data-common-2.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type>
</dependent-module>

View File

@ -4,7 +4,7 @@
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).
## [v3.5.0] ## [v3.5.0-SNAPSHOT]
- Supported the cross-filtering [#25074] - Supported the cross-filtering [#25074]
- Supported the grouped custom layers [#25110] - Supported the grouped custom layers [#25110]

View File

@ -14,13 +14,13 @@
<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>3.5.0</version> <version>3.5.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 Geoportal projects/documents by a Web-Map Interface</description> <description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the Geoportal projects/documents by a Web-Map Interface</description>
<properties> <properties>
<!-- Convenience property to set the GWT version --> <!-- Convenience property to set the GWT version -->
<gwt.version>2.9.0</gwt.version> <gwt.version>2.10.0</gwt.version>
<gwt.compiler.style>PRETTY</gwt.compiler.style> <gwt.compiler.style>PRETTY</gwt.compiler.style>
<gson.version>2.6.2</gson.version> <gson.version>2.6.2</gson.version>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory> <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>

View File

@ -25,7 +25,8 @@ public class GeoportalDataViewerConstants {
public static final String GET_MAX_ZOOM_LEVEL = OpenLayersMapParameters.OL_MAP_PARAM.maxzoomlevel.name(); public static final String GET_MAX_ZOOM_LEVEL = OpenLayersMapParameters.OL_MAP_PARAM.maxzoomlevel.name();
public static final String GET_ZOOM = OpenLayersMapParameters.OL_MAP_PARAM.zoom.name(); public static final String GET_ZOOM = OpenLayersMapParameters.OL_MAP_PARAM.zoom.name();
public static final String GET_CENTER_MAP_TO_LONG_LAT = OpenLayersMapParameters.OL_MAP_PARAM.centermap.name(); public static final String GET_CENTER_MAP_TO_LONG_LAT = OpenLayersMapParameters.OL_MAP_PARAM.centermap.name();
public static final Double INITIAL_LAYER_OPACITY = 0.8;
public static final int SEARCH_LIMIT_RESULTS_TO_MAXIMUM = 50; public static final int SEARCH_LIMIT_RESULTS_TO_MAXIMUM = 50;
public static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getFormat("dd MMMM yyyy"); public static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getFormat("dd MMMM yyyy");

View File

@ -553,7 +553,7 @@ public class LayerManager {
theLo = lo; theLo = lo;
mapOtherLayerObjects.put(layerNameKey, theLo); mapOtherLayerObjects.put(layerNameKey, theLo);
GWT.log("PROJECT_LAYER mapOtherLayerObjects is: " + mapOtherLayerObjects); GWT.log("PROJECT_LAYER mapOtherLayerObjects is: " + mapOtherLayerObjects);
olMap.addWMSDetailLayer(layerItem); olMap.addWMSDetailLayer(layerItem, GeoportalDataViewerConstants.INITIAL_LAYER_OPACITY);
overlayLayerManager.addLayerItem(theLo); overlayLayerManager.addLayerItem(theLo);
} else { } else {
GWT.log("Skipping " + lo.getType() + " layer " + theLo.getLayerItem().getName() GWT.log("Skipping " + lo.getType() + " layer " + theLo.getLayerItem().getName()

View File

@ -523,12 +523,14 @@ public abstract class OpenLayerMap {
return setCQLFilter; return setCQLFilter;
} }
/** /**
* Adds the WMS detail layer. * Adds the WMS detail layer.
* *
* @param layerItem the layer item * @param layerItem the layer item
* @param initialOpacity the initial opacity
*/ */
public void addWMSDetailLayer(LayerItem layerItem) { public void addWMSDetailLayer(LayerItem layerItem, double initialOpacity) {
if (wmsDetailsLayerMap == null) if (wmsDetailsLayerMap == null)
wmsDetailsLayerMap = new LinkedHashMap<String, Image>(); wmsDetailsLayerMap = new LinkedHashMap<String, Image>();
@ -562,6 +564,7 @@ public abstract class OpenLayerMap {
Image wmsLayer = new Image(layerOptions); Image wmsLayer = new Image(layerOptions);
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.WMS_DETAIL) + wmsDetailsLayerMap.size() + 1; int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.WMS_DETAIL) + wmsDetailsLayerMap.size() + 1;
wmsLayer.setZIndex(zIndex); wmsLayer.setZIndex(zIndex);
wmsLayer.setOpacity(initialOpacity);
map.addLayer(wmsLayer); map.addLayer(wmsLayer);
wmsDetailsLayerMap.put(key, wmsLayer); wmsDetailsLayerMap.put(key, wmsLayer);

View File

@ -1,5 +1,6 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd; package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION; import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
@ -38,8 +39,8 @@ public class RangeSlider extends Composite {
sliderId = "slider-" + Random.nextInt(); sliderId = "slider-" + Random.nextInt();
theSlider.addClassName("slider"); theSlider.addClassName("slider");
theSlider.setId(sliderId); theSlider.setId(sliderId);
theSlider.setTitle("Set opacity of the layer");
theSlider.setTitle("Set opacity of "+layer.getName()); theSlider.setPropertyObject("value", GeoportalDataViewerConstants.INITIAL_LAYER_OPACITY*100);
bindEvents(); bindEvents();
} }
@ -56,9 +57,9 @@ public class RangeSlider extends Composite {
DoActionOnDetailLayersEvent actionChangeOpacity = new DoActionOnDetailLayersEvent( DoActionOnDetailLayersEvent actionChangeOpacity = new DoActionOnDetailLayersEvent(
DO_LAYER_ACTION.OPACITY, layer, null); DO_LAYER_ACTION.OPACITY, layer, null);
int value = Integer.parseInt((String) theSlider.getPropertyObject("value")); int value = Integer.parseInt((String) theSlider.getPropertyObject("value"));
//GWT.log("opacity int value: "+value); // GWT.log("opacity int value: "+value);
double opacity = (double) ((double) value/100); double opacity = (double) ((double) value / 100);
GWT.log("opacity double value: "+opacity); GWT.log("opacity double value: " + opacity);
actionChangeOpacity.setOpacity(opacity); actionChangeOpacity.setOpacity(opacity);
applicationBus.fireEvent(actionChangeOpacity); applicationBus.fireEvent(actionChangeOpacity);
} }