moved to gwt-ol3 v8.1.0-gwt2_9. Implementing Map credits (it is buggy in
the gwt-ol3)
This commit is contained in:
parent
c36754a7b3
commit
143fed7c79
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/geoportal-data-viewer-app-2.0.0/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/geoportal-data-viewer-app-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-2.0.0/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -35,5 +35,5 @@
|
||||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/geoportal-data-viewer-app-2.0.0/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/geoportal-data-viewer-app-2.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-2.0.0
|
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-2.1.0-SNAPSHOT
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
|
@ -1,21 +1,31 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
|
||||||
<wb-module deploy-name="geoportal-data-viewer-app-2.0.0">
|
|
||||||
|
<wb-module deploy-name="geoportal-data-viewer-app-2.1.0-SNAPSHOT">
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
|
|
||||||
|
|
||||||
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="geoportal-data-viewer-app"/>
|
<property name="context-root" value="geoportal-data-viewer-app"/>
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
</project-modules>
|
</project-modules>
|
||||||
|
|
|
@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
#### Enhancements
|
#### Enhancements
|
||||||
|
|
||||||
- [#22370] Use a max-height for preview image shown in the pop-up
|
- [#22370] Use a max-height for preview image shown in the pop-up
|
||||||
|
- Moved to gwt-ol3 v8.1.0-gwt2_9
|
||||||
|
|
||||||
## [v2.0.1] - 2021-11-10
|
## [v2.0.1] - 2021-11-10
|
||||||
|
|
||||||
|
|
4
pom.xml
4
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.0.1</version>
|
<version>2.1.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>
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.tdesjardins</groupId>
|
<groupId>com.github.tdesjardins</groupId>
|
||||||
<artifactId>gwt-ol3</artifactId>
|
<artifactId>gwt-ol3</artifactId>
|
||||||
<version>8.0.0-gwt2_9</version>
|
<version>8.1.0-gwt2_9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.gwtbootstrap</groupId>
|
<groupId>com.github.gwtbootstrap</groupId>
|
||||||
|
|
|
@ -43,6 +43,7 @@ import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.user.client.Timer;
|
import com.google.gwt.user.client.Timer;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.RootPanel;
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
|
@ -105,6 +106,16 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
layerManager.getLayerManagerBus());
|
layerManager.getLayerManagerBus());
|
||||||
layerManager.setOlMap(olMapMng.getOLOSMMap());
|
layerManager.setOlMap(olMapMng.getOLOSMMap());
|
||||||
mainPanel.setMap(olMapMng.getOLOSMMap());
|
mainPanel.setMap(olMapMng.getOLOSMMap());
|
||||||
|
|
||||||
|
|
||||||
|
String attributionHTML = "<div class='map-credits'><div class='map-attribution-container'>"
|
||||||
|
+olMapMng.getOLOSMMap().getMapAttribution()+
|
||||||
|
"</div></div>";
|
||||||
|
|
||||||
|
|
||||||
|
RootPanel.get(APP_DIV).add(new HTML(attributionHTML));
|
||||||
|
|
||||||
|
//mainPanel.setMapAttribution(olMapMng.getOLOSMMap().getMapAttribution());
|
||||||
updateSize();
|
updateSize();
|
||||||
ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
||||||
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
||||||
|
|
|
@ -40,7 +40,6 @@ public class OLMapManager {
|
||||||
public static final Double LAYER_DETAIL_MIN_RESOLUTION = 0.01;
|
public static final Double LAYER_DETAIL_MIN_RESOLUTION = 0.01;
|
||||||
public static final Double LAYER_DETAIL_MAX_RESOLUTION = 18.5;
|
public static final Double LAYER_DETAIL_MAX_RESOLUTION = 18.5;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new OL map manager.
|
* Instantiates a new OL map manager.
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
||||||
|
|
||||||
import ol.Collection;
|
import ol.Collection;
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
|
import ol.control.Attribution;
|
||||||
import ol.control.Control;
|
import ol.control.Control;
|
||||||
import ol.control.FullScreen;
|
import ol.control.FullScreen;
|
||||||
import ol.control.MousePosition;
|
import ol.control.MousePosition;
|
||||||
|
@ -32,6 +33,10 @@ public final class MapUtils {
|
||||||
MousePosition mousePosition = new MousePosition();
|
MousePosition mousePosition = new MousePosition();
|
||||||
mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
|
mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
|
||||||
controls.push(mousePosition);
|
controls.push(mousePosition);
|
||||||
|
|
||||||
|
Attribution attribution = new Attribution();
|
||||||
|
attribution.setCollapsed(true);
|
||||||
|
controls.push(attribution);
|
||||||
//controls.push(new ZoomToExtent());
|
//controls.push(new ZoomToExtent());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerCon
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
@ -35,7 +36,6 @@ import ol.OverlayOptions;
|
||||||
import ol.Size;
|
import ol.Size;
|
||||||
import ol.View;
|
import ol.View;
|
||||||
import ol.ViewOptions;
|
import ol.ViewOptions;
|
||||||
import ol.control.Attribution;
|
|
||||||
import ol.event.EventListener;
|
import ol.event.EventListener;
|
||||||
import ol.geom.Geometry;
|
import ol.geom.Geometry;
|
||||||
import ol.interaction.Draw;
|
import ol.interaction.Draw;
|
||||||
|
@ -47,6 +47,7 @@ import ol.interaction.KeyboardPan;
|
||||||
import ol.interaction.KeyboardZoom;
|
import ol.interaction.KeyboardZoom;
|
||||||
import ol.layer.Base;
|
import ol.layer.Base;
|
||||||
import ol.layer.Image;
|
import ol.layer.Image;
|
||||||
|
import ol.layer.Layer;
|
||||||
import ol.layer.LayerOptions;
|
import ol.layer.LayerOptions;
|
||||||
import ol.layer.Tile;
|
import ol.layer.Tile;
|
||||||
import ol.layer.VectorLayerOptions;
|
import ol.layer.VectorLayerOptions;
|
||||||
|
@ -58,6 +59,7 @@ import ol.source.ImageWmsParams;
|
||||||
import ol.source.Osm;
|
import ol.source.Osm;
|
||||||
import ol.source.Source;
|
import ol.source.Source;
|
||||||
import ol.source.Vector;
|
import ol.source.Vector;
|
||||||
|
import ol.source.Xyz;
|
||||||
import ol.source.XyzOptions;
|
import ol.source.XyzOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,6 +140,10 @@ public abstract class OpenLayerOSM {
|
||||||
|
|
||||||
private LinkedHashMap<String, Image> wmsLayerMap;
|
private LinkedHashMap<String, Image> wmsLayerMap;
|
||||||
|
|
||||||
|
private Layer baseLayerTile;
|
||||||
|
|
||||||
|
private String mapAttribution;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new open layer OSM.
|
* Instantiates a new open layer OSM.
|
||||||
*
|
*
|
||||||
|
@ -156,16 +162,6 @@ public abstract class OpenLayerOSM {
|
||||||
wmsDetailsLayerZIndex[i] = 1000 + i;
|
wmsDetailsLayerZIndex[i] = 1000 + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a OSM-layer
|
|
||||||
XyzOptions xyzOptions = OLFactory.createOptions();
|
|
||||||
// osmSourceOptions.setCrossOrigin("Anonymous");
|
|
||||||
// osmSourceOptions.setTileLoadFunction(null);
|
|
||||||
|
|
||||||
Osm osmSource = new Osm(xyzOptions);
|
|
||||||
LayerOptions osmLayerOptions = OLFactory.createOptions();
|
|
||||||
osmLayerOptions.setSource(osmSource);
|
|
||||||
|
|
||||||
Tile osmLayer = new Tile(osmLayerOptions);
|
|
||||||
// create a projection
|
// create a projection
|
||||||
projectionOptions.setCode(MAP_PROJECTION.EPSG_3857.getName());
|
projectionOptions.setCode(MAP_PROJECTION.EPSG_3857.getName());
|
||||||
projectionOptions.setUnits("m");
|
projectionOptions.setUnits("m");
|
||||||
|
@ -184,25 +180,72 @@ public abstract class OpenLayerOSM {
|
||||||
|
|
||||||
map = new Map(mapOptions);
|
map = new Map(mapOptions);
|
||||||
|
|
||||||
map.addLayer(osmLayer);
|
//map.addLayer(baseLayerTile);
|
||||||
// map.addLayer(tileDebugLayer);
|
// map.addLayer(tileDebugLayer);
|
||||||
|
|
||||||
// add some controls
|
// add some controls
|
||||||
map.addControl(OLFactory.createScaleLine());
|
map.addControl(OLFactory.createScaleLine());
|
||||||
MapUtils.addDefaultControls(map.getControls());
|
MapUtils.addDefaultControls(map.getControls());
|
||||||
|
|
||||||
Attribution attribution = new Attribution();
|
|
||||||
attribution.setCollapsed(true);
|
|
||||||
map.addControl(attribution);
|
|
||||||
|
|
||||||
// add some interactions
|
// add some interactions
|
||||||
map.addInteraction(new KeyboardPan());
|
map.addInteraction(new KeyboardPan());
|
||||||
map.addInteraction(new KeyboardZoom());
|
map.addInteraction(new KeyboardZoom());
|
||||||
|
|
||||||
|
|
||||||
|
String attribution = "© <a href='https://www.mapbox.com/about/maps/'>Mapbox</a> © <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a> <strong><a href='https://www.mapbox.com/map-feedback/' target='_blank'>Improve this map</a></strong>";
|
||||||
|
BaseMapLayer baseLayer = new BaseMapLayer(
|
||||||
|
"https://{a-d}.tiles.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoiZDRzY2llbmNlIiwiYSI6ImNpcW1nZjE4MDAwMXNod25rdHJsemRoNTQifQ.YPNkNLb8EzjThpvJl1tg4w",
|
||||||
|
attribution, BaseMapLayer.OL_BASE_MAP.MAPBOX);
|
||||||
|
|
||||||
|
//applying base map
|
||||||
|
changeBaseMap(baseLayer);
|
||||||
|
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changeBaseMap(BaseMapLayer baseLayer) {
|
||||||
|
|
||||||
|
BaseMapLayer.OL_BASE_MAP baseMap = baseLayer.getType() == null ? BaseMapLayer.OL_BASE_MAP.OSM
|
||||||
|
: baseLayer.getType();
|
||||||
|
this.mapAttribution = baseLayer.getAttribution();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (baseLayerTile != null)
|
||||||
|
map.removeLayer(baseLayerTile);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (baseMap) {
|
||||||
|
case OSM:
|
||||||
|
XyzOptions xyzOptions = OLFactory.createOptions();
|
||||||
|
Osm osmSource = new Osm(xyzOptions);
|
||||||
|
LayerOptions layerOptions = OLFactory.createOptions();
|
||||||
|
layerOptions.setSource(osmSource);
|
||||||
|
baseLayerTile = new Tile(layerOptions);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MAPBOX:
|
||||||
|
case OTHER:
|
||||||
|
|
||||||
|
XyzOptions xyzOptions2 = OLFactory.createOptions();
|
||||||
|
Xyz xyz = new Xyz(xyzOptions2);
|
||||||
|
xyz.setAttributions(mapAttribution);
|
||||||
|
xyz.setUrl(baseLayer.getUrl());
|
||||||
|
LayerOptions layerOptions2 = OLFactory.createOptions();
|
||||||
|
layerOptions2.setSource(xyz);
|
||||||
|
baseLayerTile = new Tile(layerOptions2);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// map == null at init time
|
||||||
|
if (map != null)
|
||||||
|
map.addLayer(baseLayerTile);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind events.
|
* Bind events.
|
||||||
*/
|
*/
|
||||||
|
@ -830,14 +873,14 @@ public abstract class OpenLayerOSM {
|
||||||
Image layer1 = wmsDetailsLayerMap.get(layerSource);
|
Image layer1 = wmsDetailsLayerMap.get(layerSource);
|
||||||
Image layer2 = wmsDetailsLayerMap.get(layerTarget);
|
Image layer2 = wmsDetailsLayerMap.get(layerTarget);
|
||||||
|
|
||||||
int zIndexS = swapLSource.getPosition()+1;
|
int zIndexS = swapLSource.getPosition() + 1;
|
||||||
int zIndexT = swapLTarget.getPosition()+1;
|
int zIndexT = swapLTarget.getPosition() + 1;
|
||||||
GWT.log("new zindex source: "+zIndexS+", new zTarget: "+zIndexT);
|
GWT.log("new zindex source: " + zIndexS + ", new zTarget: " + zIndexT);
|
||||||
layer1.setZIndex(zIndexT);
|
layer1.setZIndex(zIndexT);
|
||||||
layer2.setZIndex(zIndexS);
|
layer2.setZIndex(zIndexS);
|
||||||
|
|
||||||
GWT.log("layer1 source: "+layerSource+", new zIndex: "+layer1.getZIndex());
|
GWT.log("layer1 source: " + layerSource + ", new zIndex: " + layer1.getZIndex());
|
||||||
GWT.log("layer1 target: "+layerTarget+", new zIndex: "+layer2.getZIndex());
|
GWT.log("layer1 target: " + layerTarget + ", new zIndex: " + layer2.getZIndex());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -852,4 +895,8 @@ public abstract class OpenLayerOSM {
|
||||||
return map.get((map.keySet().toArray())[index]);
|
return map.get((map.keySet().toArray())[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMapAttribution() {
|
||||||
|
return mapAttribution;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.L
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
|
@ -25,6 +26,7 @@ import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
import com.google.gwt.user.client.ui.Image;
|
import com.google.gwt.user.client.ui.Image;
|
||||||
|
import com.google.gwt.user.client.ui.Label;
|
||||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
@ -79,6 +81,9 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
ScrollPanel overlayLayersPanel;
|
ScrollPanel overlayLayersPanel;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel panelAttribution;
|
||||||
|
|
||||||
private MapPanel mapPanel;
|
private MapPanel mapPanel;
|
||||||
|
|
||||||
private OpenLayerOSM map;
|
private OpenLayerOSM map;
|
||||||
|
@ -113,7 +118,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
extentToEarth.getElement().appendChild(worldImg.getElement());
|
extentToEarth.getElement().appendChild(worldImg.getElement());
|
||||||
extentToEarth.setWidth("140px");
|
extentToEarth.setWidth("140px");
|
||||||
|
|
||||||
//layersDDB.setToggle(true);
|
// layersDDB.setToggle(true);
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -127,9 +132,9 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
GWT.log("layersDDB clicked");
|
GWT.log("layersDDB clicked");
|
||||||
|
|
||||||
if(overlayLayersPanel.isVisible()) {
|
if (overlayLayersPanel.isVisible()) {
|
||||||
overlayLayersPanel.setVisible(false);
|
overlayLayersPanel.setVisible(false);
|
||||||
}else {
|
} else {
|
||||||
overlayLayersPanel.setVisible(true);
|
overlayLayersPanel.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,8 +158,8 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
private void setOverlayPanelMaxHeight() {
|
private void setOverlayPanelMaxHeight() {
|
||||||
|
|
||||||
String overlMH = mapPanel.getOffsetHeight()-130+"px";
|
String overlMH = mapPanel.getOffsetHeight() - 130 + "px";
|
||||||
GWT.log("overlayLayersPanel maxHeight: "+overlMH);
|
GWT.log("overlayLayersPanel maxHeight: " + overlMH);
|
||||||
overlayLayersPanel.getElement().getStyle().setProperty("maxHeight", overlMH);
|
overlayLayersPanel.getElement().getStyle().setProperty("maxHeight", overlMH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,21 +291,22 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
*/
|
*/
|
||||||
public void showOverlayLayers(FlowPanel panel) {
|
public void showOverlayLayers(FlowPanel panel) {
|
||||||
GWT.log("showOverlayLayers");
|
GWT.log("showOverlayLayers");
|
||||||
//layersDDB.setVisible(true);
|
// layersDDB.setVisible(true);
|
||||||
overlayLayersPanel.setVisible(true);
|
overlayLayersPanel.setVisible(true);
|
||||||
overlayLayersPanel.clear();
|
overlayLayersPanel.clear();
|
||||||
|
|
||||||
setOverlayPanelMaxHeight();
|
setOverlayPanelMaxHeight();
|
||||||
overlayLayersPanel.add(panel);
|
overlayLayersPanel.add(panel);
|
||||||
//layersDDBClickEvent();
|
// layersDDBClickEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void layersDDBClickEvent() {
|
private void layersDDBClickEvent() {
|
||||||
layersDDB.fireEvent( new GwtEvent<ClickHandler>() {
|
layersDDB.fireEvent(new GwtEvent<ClickHandler>() {
|
||||||
@Override
|
@Override
|
||||||
public com.google.gwt.event.shared.GwtEvent.Type<ClickHandler> getAssociatedType() {
|
public com.google.gwt.event.shared.GwtEvent.Type<ClickHandler> getAssociatedType() {
|
||||||
return ClickEvent.getType();
|
return ClickEvent.getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dispatch(ClickHandler handler) {
|
protected void dispatch(ClickHandler handler) {
|
||||||
handler.onClick(null);
|
handler.onClick(null);
|
||||||
|
@ -314,9 +320,17 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
public void hideOverlayLayers() {
|
public void hideOverlayLayers() {
|
||||||
GWT.log("hideOverlayLayers");
|
GWT.log("hideOverlayLayers");
|
||||||
overlayLayersPanel.clear();
|
overlayLayersPanel.clear();
|
||||||
//layersDDB.setVisible(false);
|
// layersDDB.setVisible(false);
|
||||||
overlayLayersPanel.setVisible(false);
|
overlayLayersPanel.setVisible(false);
|
||||||
//layersDDBClickEvent();
|
// layersDDBClickEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMapAttribution(String attribution) {
|
||||||
|
panelAttribution.clear();
|
||||||
|
Label label = new Label("Base Map Credits");
|
||||||
|
Paragraph p = new Paragraph(attribution);
|
||||||
|
panelAttribution.add(label);
|
||||||
|
panelAttribution.add(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<g:HTMLPanel ui:field="mainToolBar"
|
<g:HTMLPanel ui:field="mainToolBar"
|
||||||
addStyleNames="inner-toolbar">
|
addStyleNames="inner-toolbar">
|
||||||
<b:DropdownButton type="LINK" text=" " icon="INFO">
|
<b:DropdownButton type="LINK" text=" " icon="INFO">
|
||||||
<g:HTMLPanel ui:field="panelMI"
|
<g:HTMLPanel ui:field="panelInfo"
|
||||||
addStyleNames="info-interaction">
|
addStyleNames="info-interaction">
|
||||||
<g:Label>Map Interactions</g:Label>
|
<g:Label>Map Interactions</g:Label>
|
||||||
<b:Paragraph>
|
<b:Paragraph>
|
||||||
|
@ -30,6 +30,9 @@
|
||||||
<b:Icon type="HAND_UP" />
|
<b:Icon type="HAND_UP" />
|
||||||
Click on the Points shown on the Map to view their features
|
Click on the Points shown on the Map to view their features
|
||||||
</b:Paragraph>
|
</b:Paragraph>
|
||||||
|
<g:HTMLPanel ui:field="panelAttribution"
|
||||||
|
addStyleNames="info-interaction" visible="false">
|
||||||
|
</g:HTMLPanel>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK"
|
<b:DropdownButton type="LINK"
|
||||||
|
|
|
@ -0,0 +1,109 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class BaseMapLayer.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 11, 2021
|
||||||
|
*/
|
||||||
|
public class BaseMapLayer implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -6204769725053516674L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum OL_BASE_MAP.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 11, 2021
|
||||||
|
*/
|
||||||
|
public static enum OL_BASE_MAP {
|
||||||
|
OSM, MAPBOX, OTHER
|
||||||
|
};
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
private String attribution;
|
||||||
|
private OL_BASE_MAP type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new base map layer.
|
||||||
|
*/
|
||||||
|
public BaseMapLayer() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new base map layer.
|
||||||
|
*
|
||||||
|
* @param url the url
|
||||||
|
* @param attribution the attribution
|
||||||
|
* @param type the type
|
||||||
|
*/
|
||||||
|
public BaseMapLayer(String url, String attribution, OL_BASE_MAP type) {
|
||||||
|
super();
|
||||||
|
this.url = url;
|
||||||
|
this.attribution = attribution;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the url.
|
||||||
|
*
|
||||||
|
* @return the url
|
||||||
|
*/
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the attribution.
|
||||||
|
*
|
||||||
|
* @return the attribution
|
||||||
|
*/
|
||||||
|
public String getAttribution() {
|
||||||
|
return attribution;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the type.
|
||||||
|
*
|
||||||
|
* @return the type
|
||||||
|
*/
|
||||||
|
public OL_BASE_MAP getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the url.
|
||||||
|
*
|
||||||
|
* @param url the new url
|
||||||
|
*/
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the attribution.
|
||||||
|
*
|
||||||
|
* @param attribution the new attribution
|
||||||
|
*/
|
||||||
|
public void setAttribution(String attribution) {
|
||||||
|
this.attribution = attribution;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the type.
|
||||||
|
*
|
||||||
|
* @param type the new type
|
||||||
|
*/
|
||||||
|
public void setType(OL_BASE_MAP type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -358,3 +358,18 @@ body {
|
||||||
.range-slider input {
|
.range-slider input {
|
||||||
width: 280px;
|
width: 280px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.map-credits {
|
||||||
|
width: 100%;
|
||||||
|
max-height: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-attribution-container {
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
position: absolute;
|
||||||
|
display: block;
|
||||||
|
margin: 10px 5px;
|
||||||
|
padding: 2px 4px;
|
||||||
|
background: white;
|
||||||
|
}
|
Loading…
Reference in New Issue