task_22027 #4
|
@ -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,41 @@
|
||||||
<?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>
|
||||||
|
|
|
@ -4,6 +4,15 @@
|
||||||
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.1.0-SNAPSHOT] - 2021-11-10
|
||||||
|
|
||||||
|
#### Enhancements
|
||||||
|
|
||||||
|
- [#22027] Integrated with MapBox Satellite
|
||||||
|
- Added link "Open Project" in the pop-up of WFS details
|
||||||
|
- Moved to gwt-ol3 v8.1.0-gwt2_9
|
||||||
|
|
||||||
## [v2.0.1] - 2021-11-10
|
## [v2.0.1] - 2021-11-10
|
||||||
|
|
||||||
#### Fixes
|
#### Fixes
|
||||||
|
|
|
@ -11,7 +11,7 @@ The GeoPortal Data Viewer App is an application to access, discovery and navigat
|
||||||
|
|
||||||
* GWT v.2.9.0. [GWT](http://www.gwtproject.org) is licensed under [Apache License 2.0](http://www.gwtproject.org/terms.html)
|
* GWT v.2.9.0. [GWT](http://www.gwtproject.org) is licensed under [Apache License 2.0](http://www.gwtproject.org/terms.html)
|
||||||
* GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
* GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||||
* GWT-OpenLayers 3+ v.8.0.0-gwt2_9. [GWT-OL3](https://github.com/TDesjardins/gwt-ol)
|
* GWT-OpenLayers 3+ v.8.1.0-gwt2_9. [GWT-OL3](https://github.com/TDesjardins/gwt-ol)
|
||||||
* OpenLayers v.6.X. [OpenLayers](https://openlayers.org/) is licensed under [BSD 2-Clause "Simplified"](https://github.com/openlayers/openlayers/blob/main/LICENSE.md)
|
* OpenLayers v.6.X. [OpenLayers](https://openlayers.org/) is licensed under [BSD 2-Clause "Simplified"](https://github.com/openlayers/openlayers/blob/main/LICENSE.md)
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
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>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
|
@ -12,6 +13,8 @@ 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.AddedLayerToMapEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
||||||
|
@ -27,9 +30,11 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMini
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||||
|
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
|
@ -43,6 +48,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;
|
||||||
|
@ -60,7 +66,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
public final static String APP_DIV = "geoportal-data-viewer";
|
public final static String APP_DIV = "geoportal-data-viewer";
|
||||||
|
|
||||||
/** The ol map. */
|
/** The ol map. */
|
||||||
// private OpenLayerOSM olMap = null;
|
// private OpenLayerMap olMap = null;
|
||||||
|
|
||||||
/** The main panel. */
|
/** The main panel. */
|
||||||
private GeonaDataViewMainPanel mainPanel;
|
private GeonaDataViewMainPanel mainPanel;
|
||||||
|
@ -89,10 +95,31 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
int attempt = 0;
|
int attempt = 0;
|
||||||
|
|
||||||
|
private LoaderIcon loaderApp = new LoaderIcon("Loading application... please wait");
|
||||||
|
|
||||||
|
private HTML attributionDiv = new HTML();
|
||||||
|
|
||||||
|
private static List<BaseMapLayer> listBaseMapLayers = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the entry point method.
|
* This is the entry point method.
|
||||||
*/
|
*/
|
||||||
public void onModuleLoad() {
|
public void onModuleLoad() {
|
||||||
|
|
||||||
|
loaderApp.getElement().addClassName("loader-gna-app");
|
||||||
|
RootPanel.get(APP_DIV).add(loaderApp);
|
||||||
|
|
||||||
|
paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER);
|
||||||
|
paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE);
|
||||||
|
paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID);
|
||||||
|
paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE);
|
||||||
|
GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest);
|
||||||
|
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE + " = " + paramGeonaItemType);
|
||||||
|
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + paramGeonaItemID);
|
||||||
|
GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle);
|
||||||
|
|
||||||
|
RootPanel.get(APP_DIV).add(loaderApp);
|
||||||
|
|
||||||
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight());
|
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight());
|
||||||
RootPanel.get(APP_DIV).add(mainPanel);
|
RootPanel.get(APP_DIV).add(mainPanel);
|
||||||
|
|
||||||
|
@ -101,13 +128,44 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
|
||||||
olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),
|
//LOADING THE BASE MAP LAYERS
|
||||||
layerManager.getLayerManagerBus());
|
GeoportalDataViewerServiceAsync.Util.getInstance().getListBaseLayers(new AsyncCallback<List<BaseMapLayer>>() {
|
||||||
layerManager.setOlMap(olMapMng.getOLOSMMap());
|
|
||||||
mainPanel.setMap(olMapMng.getOLOSMMap());
|
@Override
|
||||||
updateSize();
|
public void onFailure(Throwable caught) {
|
||||||
ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
RootPanel.get(APP_DIV).remove(loaderApp);
|
||||||
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
Window.alert("Sorry, an error occurred on instancing the GeoPortale Viewer. Please, contact the support");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<BaseMapLayer> listBaseMapLayers) {
|
||||||
|
try {
|
||||||
|
RootPanel.get(APP_DIV).remove(loaderApp);
|
||||||
|
}catch (Exception e) {
|
||||||
|
loaderApp.setVisible(false);
|
||||||
|
}
|
||||||
|
GeoportalDataViewer.listBaseMapLayers = listBaseMapLayers;
|
||||||
|
//now the map is loaded and I'm sure that I can load the GeonaDataViewer Profile
|
||||||
|
loadGeonaDataViewerProfile();
|
||||||
|
mainPanel.setBaseLayers(listBaseMapLayers);
|
||||||
|
|
||||||
|
BaseMapLayer firstBaseLayer = listBaseMapLayers.get(0);
|
||||||
|
//Passing the first base map layer that will be applied as first base layer
|
||||||
|
olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),
|
||||||
|
layerManager.getLayerManagerBus(), firstBaseLayer);
|
||||||
|
OpenLayerMap olMap = olMapMng.getOLMap();
|
||||||
|
layerManager.setOLMap(olMap);
|
||||||
|
mainPanel.setMap(olMap);
|
||||||
|
|
||||||
|
updateSize();
|
||||||
|
ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
||||||
|
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -118,27 +176,18 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER);
|
|
||||||
paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE);
|
|
||||||
// paramUUID =
|
|
||||||
// Window.Location.getParameter(GeoportalDataViewerConstants.GET_UUID_PARAMETER);
|
|
||||||
paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID);
|
|
||||||
paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE);
|
|
||||||
GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest);
|
|
||||||
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE + " = " + paramGeonaItemType);
|
|
||||||
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + paramGeonaItemID);
|
|
||||||
// GWT.log(GeoportalDataViewerConstants.GET_UUID_PARAMETER + " = " + paramUUID);
|
|
||||||
GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle);
|
|
||||||
|
|
||||||
// VALIDATING THE LONG FORMAT FOR GID
|
|
||||||
// try {
|
bindEvents();
|
||||||
// if (paramGeonaItemID != null)
|
|
||||||
// Long.parseLong(paramGeonaItemID);
|
RootPanel.get(APP_DIV).add(attributionDiv);
|
||||||
// } catch (Exception e) {
|
}
|
||||||
// Window.alert("Bad format for parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_ID
|
|
||||||
// + ". It must be a Long");
|
public static List<BaseMapLayer> getListBaseMapLayers() {
|
||||||
// paramGeonaItemID = null;
|
return listBaseMapLayers;
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
private void loadGeonaDataViewerProfile() {
|
||||||
|
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
|
@ -196,7 +245,6 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bindEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -271,8 +319,6 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
@Override
|
@Override
|
||||||
public void onLayerRendered(AddedLayerToMapEvent addedLayerToMapEvent) {
|
public void onLayerRendered(AddedLayerToMapEvent addedLayerToMapEvent) {
|
||||||
GWT.log("Fired AddedLayerToMapEvent " + addedLayerToMapEvent.getLayerItem() + "layer type: "+addedLayerToMapEvent.getLayerType());
|
GWT.log("Fired AddedLayerToMapEvent " + addedLayerToMapEvent.getLayerItem() + "layer type: "+addedLayerToMapEvent.getLayerType());
|
||||||
// GeoportalDataViewerConstants.print("Fired AddedLayerToMapEvent
|
|
||||||
// "+addedLayerToMapEvent.getLayerItem());
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -370,7 +416,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
DO_LAYER_ACTION doAction = doLayerActionEvent.getDoAction();
|
DO_LAYER_ACTION doAction = doLayerActionEvent.getDoAction();
|
||||||
GWT.log("event: "+doAction);
|
GWT.log("event: "+doAction);
|
||||||
GWT.log("layer source: "+doLayerActionEvent.getLayerItem().getName());
|
GWT.log("layer source: "+doLayerActionEvent.getLayerItem().getName());
|
||||||
OpenLayerOSM olMap = olMapMng.getOLOSMMap();
|
OpenLayerMap olMap = olMapMng.getOLMap();
|
||||||
|
|
||||||
switch (doAction) {
|
switch (doAction) {
|
||||||
case OPACITY:
|
case OPACITY:
|
||||||
|
@ -400,6 +446,30 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
applicationBus.addHandler(ChangeMapLayerEvent.TYPE, new ChangeMapLayerEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeBaseMapLayer(ChangeMapLayerEvent changeMapLayerEvent) {
|
||||||
|
|
||||||
|
BaseMapLayer baseLayer = changeMapLayerEvent.getBaseMapLayer();
|
||||||
|
|
||||||
|
if (baseLayer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
String attributionHTML = "<div class='map-credits'><div class='map-credits-container'>"
|
||||||
|
+ baseLayer.getAttribution() + "</div></div>";
|
||||||
|
olMapMng.getOLMap().changeBaseMap(baseLayer);
|
||||||
|
|
||||||
|
// THE OSM Contributors are automatically added by gwt-ol, others ones not.
|
||||||
|
if (!baseLayer.getType().equals(BaseMapLayer.OL_BASE_MAP.OSM)) {
|
||||||
|
attributionDiv.setHTML(attributionHTML);
|
||||||
|
} else
|
||||||
|
attributionDiv.setHTML("");
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
|
||||||
|
@ -124,5 +125,7 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
List<GeoNaSpatialQueryResult> getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName,
|
List<GeoNaSpatialQueryResult> getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName,
|
||||||
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel);
|
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel);
|
||||||
|
|
||||||
|
List<BaseMapLayer> getListBaseLayers();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
|
||||||
|
@ -58,4 +59,6 @@ public interface GeoportalDataViewerServiceAsync {
|
||||||
void getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature,
|
void getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature,
|
||||||
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
|
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
|
||||||
|
|
||||||
|
void getListBaseLayers(AsyncCallback<List<BaseMapLayer>> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMini
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||||
|
@ -57,6 +57,7 @@ import com.google.gwt.user.client.DOM;
|
||||||
import com.google.gwt.user.client.Element;
|
import com.google.gwt.user.client.Element;
|
||||||
import com.google.gwt.user.client.Event;
|
import com.google.gwt.user.client.Event;
|
||||||
import com.google.gwt.user.client.EventListener;
|
import com.google.gwt.user.client.EventListener;
|
||||||
|
import com.google.gwt.user.client.Random;
|
||||||
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.FlexTable;
|
import com.google.gwt.user.client.ui.FlexTable;
|
||||||
|
@ -81,7 +82,7 @@ import ol.geom.Geometry;
|
||||||
public class LayerManager {
|
public class LayerManager {
|
||||||
|
|
||||||
/** The ol map. */
|
/** The ol map. */
|
||||||
private OpenLayerOSM olMap;
|
private OpenLayerMap olMap;
|
||||||
|
|
||||||
private Map<String, LayerObject> mapDetailLayerObjects = new HashMap<String, LayerObject>();
|
private Map<String, LayerObject> mapDetailLayerObjects = new HashMap<String, LayerObject>();
|
||||||
private Map<String, LayerObject> mapBaseLayerObjects = new HashMap<String, LayerObject>();
|
private Map<String, LayerObject> mapBaseLayerObjects = new HashMap<String, LayerObject>();
|
||||||
|
@ -558,6 +559,8 @@ public class LayerManager {
|
||||||
flowPanel.getElement().getStyle().setProperty("maxHeight", "600px");
|
flowPanel.getElement().getStyle().setProperty("maxHeight", "600px");
|
||||||
scrollPanel.add(flowPanel);
|
scrollPanel.add(flowPanel);
|
||||||
|
|
||||||
|
List<Button> listOpenProject = new ArrayList<Button>();
|
||||||
|
|
||||||
final Button expandButton = new Button("Expand");
|
final Button expandButton = new Button("Expand");
|
||||||
expandButton.setType(ButtonType.LINK);
|
expandButton.setType(ButtonType.LINK);
|
||||||
expandButton.setIcon(IconType.EXPAND);
|
expandButton.setIcon(IconType.EXPAND);
|
||||||
|
@ -578,6 +581,10 @@ public class LayerManager {
|
||||||
public void onBrowserEvent(Event event) {
|
public void onBrowserEvent(Event event) {
|
||||||
if (Event.ONCLICK == event.getTypeInt()) {
|
if (Event.ONCLICK == event.getTypeInt()) {
|
||||||
expandButton.setVisible(false);
|
expandButton.setVisible(false);
|
||||||
|
//hiding the Open Project in expand mode (Modal Window)
|
||||||
|
for (Button butt : listOpenProject) {
|
||||||
|
butt.setVisible(false);
|
||||||
|
}
|
||||||
flowPanel.getElement().getStyle().setProperty("maxHeight", "100%");
|
flowPanel.getElement().getStyle().setProperty("maxHeight", "100%");
|
||||||
int width = Window.getClientWidth() * 75 / 100;
|
int width = Window.getClientWidth() * 75 / 100;
|
||||||
int height = Window.getClientHeight() * 70 / 100;
|
int height = Window.getClientHeight() * 70 / 100;
|
||||||
|
@ -594,8 +601,6 @@ public class LayerManager {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//fillLayersAndProperties(listGeoNaDataObject, expandButton, flowPanel);
|
|
||||||
|
|
||||||
String prevConcessioneName = "";
|
String prevConcessioneName = "";
|
||||||
for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
|
for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
|
||||||
try {
|
try {
|
||||||
|
@ -624,6 +629,38 @@ public class LayerManager {
|
||||||
heading.setTitle(nomeConcessione);
|
heading.setTitle(nomeConcessione);
|
||||||
heading.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
heading.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||||
flowPanel.add(heading);
|
flowPanel.add(heading);
|
||||||
|
|
||||||
|
Button buttOpenProject = new Button("Open Project");
|
||||||
|
final String buttId = "open-details-"+Random.nextInt();
|
||||||
|
Element bEl = buttOpenProject.getElement();
|
||||||
|
bEl.setId(buttId);
|
||||||
|
bEl.getStyle().setPaddingLeft(0, Unit.PX);
|
||||||
|
buttOpenProject.setType(ButtonType.LINK);
|
||||||
|
|
||||||
|
if (buttOpenProject != null) {
|
||||||
|
flowPanel.add(buttOpenProject);
|
||||||
|
buttOpenProject.setType(ButtonType.LINK);
|
||||||
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
Element buttonElement = DOM.getElementById(buttId);
|
||||||
|
Event.sinkEvents(buttonElement, Event.ONCLICK);
|
||||||
|
Event.setEventListener(buttonElement, new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBrowserEvent(Event event) {
|
||||||
|
if (Event.ONCLICK == event.getTypeInt()) {
|
||||||
|
applicationBus.fireEvent(new ShowDetailsEvent("concessione", lo.getSourceConcessione().getItemId(), nomeConcessione, null));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
listOpenProject.add(buttOpenProject);
|
||||||
|
|
||||||
HTML subText = new HTML(
|
HTML subText = new HTML(
|
||||||
"<p style=\"color:#999; font-size:14px; margin:5px 0 5px 0;\">Layers and Properties</p>");
|
"<p style=\"color:#999; font-size:14px; margin:5px 0 5px 0;\">Layers and Properties</p>");
|
||||||
flowPanel.add(subText);
|
flowPanel.add(subText);
|
||||||
|
@ -687,6 +724,7 @@ public class LayerManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
olMap.showPopup(scrollPanel.toString(), queryClick.getCenter());
|
olMap.showPopup(scrollPanel.toString(), queryClick.getCenter());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -869,7 +907,7 @@ public class LayerManager {
|
||||||
*
|
*
|
||||||
* @param olMap the new ol map
|
* @param olMap the new ol map
|
||||||
*/
|
*/
|
||||||
public void setOlMap(OpenLayerOSM olMap) {
|
public void setOLMap(OpenLayerMap olMap) {
|
||||||
this.olMap = olMap;
|
this.olMap = olMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,11 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
||||||
|
|
||||||
|
@ -31,7 +32,7 @@ public class OLMapManager {
|
||||||
|
|
||||||
private String targetId;
|
private String targetId;
|
||||||
private HandlerManager layerManagerBus;
|
private HandlerManager layerManagerBus;
|
||||||
private OpenLayerOSM olMap;
|
private OpenLayerMap olMap;
|
||||||
private ol.Extent dragStartExtent = null;
|
private ol.Extent dragStartExtent = null;
|
||||||
private Double zoomStart = null;
|
private Double zoomStart = null;
|
||||||
private Double zoomEnd = null;
|
private Double zoomEnd = null;
|
||||||
|
@ -40,25 +41,27 @@ 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.
|
||||||
*
|
*
|
||||||
* @param targetId the target id
|
* @param targetId the target id
|
||||||
* @param layerManagerBus the layer manager bus
|
* @param layerManagerBus the layer manager bus
|
||||||
|
* @param baseMapLayer the base map layer
|
||||||
*/
|
*/
|
||||||
public OLMapManager(String targetId, HandlerManager layerManagerBus) {
|
public OLMapManager(String targetId, HandlerManager layerManagerBus, BaseMapLayer baseMapLayer) {
|
||||||
this.targetId = targetId;
|
this.targetId = targetId;
|
||||||
this.layerManagerBus = layerManagerBus;
|
this.layerManagerBus = layerManagerBus;
|
||||||
instanceOLMap();
|
instanceOLMap(baseMapLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance OL map.
|
* Instance OL map.
|
||||||
|
*
|
||||||
|
* @param baseMapLayer the base map layer
|
||||||
*/
|
*/
|
||||||
public void instanceOLMap() {
|
public void instanceOLMap(BaseMapLayer baseMapLayer) {
|
||||||
|
|
||||||
olMap = new OpenLayerOSM(targetId, layerManagerBus) {
|
olMap = new OpenLayerMap(targetId, layerManagerBus, baseMapLayer) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clickListener(MapBrowserEvent event) {
|
public void clickListener(MapBrowserEvent event) {
|
||||||
|
@ -138,6 +141,7 @@ public class OLMapManager {
|
||||||
* To data point query.
|
* To data point query.
|
||||||
*
|
*
|
||||||
* @param coordinate the coordinate
|
* @param coordinate the coordinate
|
||||||
|
* @param manualClick the manual click
|
||||||
* @return the geo query
|
* @return the geo query
|
||||||
*/
|
*/
|
||||||
public GeoQuery toDataPointQuery(Coordinate coordinate, boolean manualClick) {
|
public GeoQuery toDataPointQuery(Coordinate coordinate, boolean manualClick) {
|
||||||
|
@ -176,16 +180,18 @@ public class OLMapManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the OLOSM map.
|
* Gets the OL map.
|
||||||
*
|
*
|
||||||
* @return the OLOSM map
|
* @return the OL map
|
||||||
*/
|
*/
|
||||||
public OpenLayerOSM getOLOSMMap() {
|
public OpenLayerMap getOLMap() {
|
||||||
return olMap;
|
return olMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check select query.
|
* Check select query.
|
||||||
|
*
|
||||||
|
* @param mapEventType the map event type
|
||||||
*/
|
*/
|
||||||
private void checkSelectQuery(MapEventType mapEventType) {
|
private void checkSelectQuery(MapEventType mapEventType) {
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class ChangeMapLayerEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 12, 2021
|
||||||
|
*/
|
||||||
|
public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
|
||||||
|
public static Type<ChangeMapLayerEventHandler> TYPE = new Type<ChangeMapLayerEventHandler>();
|
||||||
|
private BaseMapLayer baseMapLayer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new change map layer event.
|
||||||
|
*
|
||||||
|
* @param baseMapLayer the base map layer
|
||||||
|
*/
|
||||||
|
public ChangeMapLayerEvent(BaseMapLayer baseMapLayer) {
|
||||||
|
this.baseMapLayer = baseMapLayer;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<ChangeMapLayerEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(ChangeMapLayerEventHandler handler) {
|
||||||
|
handler.onChangeBaseMapLayer(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the base map layer.
|
||||||
|
*
|
||||||
|
* @return the base map layer
|
||||||
|
*/
|
||||||
|
public BaseMapLayer getBaseMapLayer() {
|
||||||
|
return baseMapLayer;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface ChangeMapLayerEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 12, 2021
|
||||||
|
*/
|
||||||
|
public interface ChangeMapLayerEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On change base map layer.
|
||||||
|
*
|
||||||
|
* @param changeMapLayerEvent the change map layer event
|
||||||
|
*/
|
||||||
|
void onChangeBaseMapLayer(ChangeMapLayerEvent changeMapLayerEvent);
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class LayerOrder.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 12, 2021
|
||||||
|
*/
|
||||||
|
public class LayerOrder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum LAYER_TYPE.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 12, 2021
|
||||||
|
*/
|
||||||
|
public static enum LAYER_TYPE {
|
||||||
|
BASE_MAP, BASE_WMS, WMS_DETAIL, VECTOR
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final HashMap<LAYER_TYPE, Integer> LAYER_OFFSET = new HashMap<LAYER_TYPE, Integer>(5);
|
||||||
|
|
||||||
|
static {
|
||||||
|
|
||||||
|
LAYER_OFFSET.put(LAYER_TYPE.BASE_MAP, 0);
|
||||||
|
LAYER_OFFSET.put(LAYER_TYPE.BASE_WMS, 70);
|
||||||
|
LAYER_OFFSET.put(LAYER_TYPE.WMS_DETAIL, 140);
|
||||||
|
LAYER_OFFSET.put(LAYER_TYPE.VECTOR, 210);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new layer order.
|
||||||
|
*/
|
||||||
|
public LayerOrder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the offset.
|
||||||
|
*
|
||||||
|
* @param layerType the layer type
|
||||||
|
* @return the offset
|
||||||
|
*/
|
||||||
|
public Integer getOffset(LAYER_TYPE layerType) {
|
||||||
|
return LAYER_OFFSET.get(layerType);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,9 +5,11 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.Images;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
|
||||||
|
|
||||||
|
@ -27,6 +29,7 @@ import ol.MapOptions;
|
||||||
import ol.OLFactory;
|
import ol.OLFactory;
|
||||||
import ol.View;
|
import ol.View;
|
||||||
import ol.ViewOptions;
|
import ol.ViewOptions;
|
||||||
|
import ol.color.Color;
|
||||||
import ol.control.Attribution;
|
import ol.control.Attribution;
|
||||||
import ol.event.EventListener;
|
import ol.event.EventListener;
|
||||||
import ol.geom.Point;
|
import ol.geom.Point;
|
||||||
|
@ -34,6 +37,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;
|
||||||
|
@ -44,21 +48,26 @@ import ol.source.ImageWmsOptions;
|
||||||
import ol.source.ImageWmsParams;
|
import ol.source.ImageWmsParams;
|
||||||
import ol.source.Osm;
|
import ol.source.Osm;
|
||||||
import ol.source.Source;
|
import ol.source.Source;
|
||||||
|
import ol.source.Xyz;
|
||||||
import ol.source.XyzOptions;
|
import ol.source.XyzOptions;
|
||||||
|
import ol.style.Fill;
|
||||||
|
import ol.style.FillOptions;
|
||||||
import ol.style.Icon;
|
import ol.style.Icon;
|
||||||
import ol.style.IconOptions;
|
import ol.style.IconOptions;
|
||||||
|
import ol.style.Stroke;
|
||||||
|
import ol.style.StrokeOptions;
|
||||||
import ol.style.Style;
|
import ol.style.Style;
|
||||||
import ol.style.Text;
|
import ol.style.Text;
|
||||||
import ol.style.TextOptions;
|
import ol.style.TextOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class LightOpenLayerOSM.
|
* The Class LightOpenLayerMap.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Nov 11, 2020
|
* Nov 12, 2021
|
||||||
*/
|
*/
|
||||||
public class LightOpenLayerOSM {
|
public class LightOpenLayerMap {
|
||||||
|
|
||||||
public static final int MAX_ZOOM = 20;
|
public static final int MAX_ZOOM = 20;
|
||||||
|
|
||||||
|
@ -78,24 +87,19 @@ public class LightOpenLayerOSM {
|
||||||
|
|
||||||
private ol.layer.Vector geometryLayer;
|
private ol.layer.Vector geometryLayer;
|
||||||
|
|
||||||
private String markerURL = Images.ICONS.mapMarkerIcon().getURL();
|
private String markerURL = GNAImages.ICONS.mapMarkerIcon().getURL();
|
||||||
|
|
||||||
|
private LayerOrder layerOrder = new LayerOrder();
|
||||||
|
|
||||||
|
private Layer baseLayerTile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new light open layer OSM.
|
* Instantiates a new light open layer map.
|
||||||
*
|
*
|
||||||
* @param divTargetId the div target id
|
* @param divTargetId the div target id
|
||||||
*/
|
*/
|
||||||
public LightOpenLayerOSM(String divTargetId) {
|
public LightOpenLayerMap(String divTargetId) {
|
||||||
|
|
||||||
// create a OSM-layer
|
|
||||||
XyzOptions osmSourceOptions = OLFactory.createOptions();
|
|
||||||
osmSourceOptions.setCrossOrigin("Anonymous");
|
|
||||||
// osmSourceOptions.setTileLoadFunction(null);
|
|
||||||
|
|
||||||
Osm osmSource = new Osm(osmSourceOptions);
|
|
||||||
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");
|
||||||
|
@ -114,7 +118,7 @@ public class LightOpenLayerOSM {
|
||||||
|
|
||||||
map = new Map(mapOptions);
|
map = new Map(mapOptions);
|
||||||
|
|
||||||
map.addLayer(osmLayer);
|
//map.addLayer(osmLayer);
|
||||||
// map.addLayer(tileDebugLayer);
|
// map.addLayer(tileDebugLayer);
|
||||||
|
|
||||||
Attribution attribution = new Attribution();
|
Attribution attribution = new Attribution();
|
||||||
|
@ -162,6 +166,72 @@ public class LightOpenLayerOSM {
|
||||||
map.addInteraction(new KeyboardPan());
|
map.addInteraction(new KeyboardPan());
|
||||||
map.addInteraction(new KeyboardZoom());
|
map.addInteraction(new KeyboardZoom());
|
||||||
|
|
||||||
|
List<BaseMapLayer> listBaseMapLayers = GeoportalDataViewer.getListBaseMapLayers();
|
||||||
|
BaseMapLayer bml = null;
|
||||||
|
if(listBaseMapLayers!=null)
|
||||||
|
bml = listBaseMapLayers.get(0);
|
||||||
|
|
||||||
|
changeBaseMap(bml);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change base map.
|
||||||
|
*
|
||||||
|
* @param baseLayer the base layer
|
||||||
|
*/
|
||||||
|
public void changeBaseMap(BaseMapLayer baseLayer) {
|
||||||
|
|
||||||
|
BaseMapLayer.OL_BASE_MAP baseMap = baseLayer.getType() == null ? BaseMapLayer.OL_BASE_MAP.OSM
|
||||||
|
: baseLayer.getType();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (baseLayerTile != null)
|
||||||
|
map.removeLayer(baseLayerTile);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (baseMap) {
|
||||||
|
case MAPBOX:
|
||||||
|
case OTHER:
|
||||||
|
|
||||||
|
XyzOptions xyzOptions2 = OLFactory.createOptions();
|
||||||
|
xyzOptions2.setCrossOrigin("Anonymous");
|
||||||
|
Xyz xyz = new Xyz(xyzOptions2);
|
||||||
|
//setAttributions is buggy
|
||||||
|
//xyz.setAttributions(baseLayer.getAttribution());
|
||||||
|
xyz.setUrl(baseLayer.getUrl());
|
||||||
|
|
||||||
|
LayerOptions layerOptions2 = OLFactory.createOptions();
|
||||||
|
layerOptions2.setSource(xyz);
|
||||||
|
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_MAP)+1;
|
||||||
|
layerOptions2.setZIndex(zIndex);
|
||||||
|
baseLayerTile = new Tile(layerOptions2);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case OSM:
|
||||||
|
default:
|
||||||
|
XyzOptions osmSourceOptions = OLFactory.createOptions();
|
||||||
|
osmSourceOptions.setCrossOrigin("Anonymous");
|
||||||
|
Osm osmSource = new Osm(osmSourceOptions);
|
||||||
|
//osmSource.setUrl(baseLayer.getUrl());
|
||||||
|
//setAttributions is buggy
|
||||||
|
//osmSource.setAttributions(baseLayer.getAttribution());
|
||||||
|
LayerOptions layerOptions = OLFactory.createOptions();
|
||||||
|
layerOptions.setSource(osmSource);
|
||||||
|
zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_MAP)+1;
|
||||||
|
layerOptions.setZIndex(zIndex);
|
||||||
|
baseLayerTile = new Tile(layerOptions);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// map == null at init time
|
||||||
|
if (map != null) {
|
||||||
|
map.addLayer(baseLayerTile);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -212,6 +282,8 @@ public class LightOpenLayerOSM {
|
||||||
layerOptions.setSource(imageWMSSource);
|
layerOptions.setSource(imageWMSSource);
|
||||||
|
|
||||||
ol.layer.Image wmsLayer = new ol.layer.Image(layerOptions);
|
ol.layer.Image wmsLayer = new ol.layer.Image(layerOptions);
|
||||||
|
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.WMS_DETAIL)+1;
|
||||||
|
wmsLayer.setZIndex(zIndex);
|
||||||
// visibleLayerItems
|
// visibleLayerItems
|
||||||
map.addLayer(wmsLayer);
|
map.addLayer(wmsLayer);
|
||||||
|
|
||||||
|
@ -265,6 +337,11 @@ public class LightOpenLayerOSM {
|
||||||
return layerNames;
|
return layerNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the layer UR ls property.
|
||||||
|
*
|
||||||
|
* @return the layer UR ls property
|
||||||
|
*/
|
||||||
public java.util.Map<String, String> getLayerURLsProperty() {
|
public java.util.Map<String, String> getLayerURLsProperty() {
|
||||||
|
|
||||||
Collection<Base> layers = map.getLayerGroup().getLayers();
|
Collection<Base> layers = map.getLayerGroup().getLayers();
|
||||||
|
@ -273,7 +350,7 @@ public class LightOpenLayerOSM {
|
||||||
Base[] layersArr = layers.getArray();
|
Base[] layersArr = layers.getArray();
|
||||||
for (int i = 0; i < layersArr.length; i++) {
|
for (int i = 0; i < layersArr.length; i++) {
|
||||||
Base layer = layersArr[i];
|
Base layer = layersArr[i];
|
||||||
//GeoportalDataViewerConstants.printJs(layer.toString());
|
// GeoportalDataViewerConstants.printJs(layer.toString());
|
||||||
if (layer instanceof Image) {
|
if (layer instanceof Image) {
|
||||||
Image layerImage = (Image) layer;
|
Image layerImage = (Image) layer;
|
||||||
|
|
||||||
|
@ -303,7 +380,7 @@ public class LightOpenLayerOSM {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GWT.log("returning mapLayerNameURL: "+mapLayerNameURL);
|
GWT.log("returning mapLayerNameURL: " + mapLayerNameURL);
|
||||||
return mapLayerNameURL;
|
return mapLayerNameURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,14 +410,15 @@ public class LightOpenLayerOSM {
|
||||||
if (showCoordinateText) {
|
if (showCoordinateText) {
|
||||||
TextOptions textOptions = new TextOptions();
|
TextOptions textOptions = new TextOptions();
|
||||||
textOptions.setOffsetY(-25);
|
textOptions.setOffsetY(-25);
|
||||||
// StrokeOptions strokeOptions = new StrokeOptions();
|
StrokeOptions strokeOptions = new StrokeOptions();
|
||||||
// strokeOptions.setColor(new Color(0, 0, 255, 0.0));
|
strokeOptions.setColor(new Color(255, 255, 255, 1.0));
|
||||||
// strokeOptions.setWidth(4);
|
strokeOptions.setWidth(4);
|
||||||
// Stroke stroke = new Stroke(strokeOptions);
|
Stroke stroke = new Stroke(strokeOptions);
|
||||||
// textOptions.setStroke(stroke);
|
stroke.setWidth(5);
|
||||||
// FillOptions fillOptions = new FillOptions();
|
textOptions.setStroke(stroke);
|
||||||
// fillOptions.setColor(new Color(0, 0, 0, 0.0));
|
FillOptions fillOptions = new FillOptions();
|
||||||
// textOptions.setFill(new Fill(fillOptions));
|
fillOptions.setColor(new Color(0, 0, 255, 1.0));
|
||||||
|
textOptions.setFill(new Fill(fillOptions));
|
||||||
|
|
||||||
Coordinate transfCoord = MapUtils.transformCoordiante(coordinate, MAP_PROJECTION.EPSG_3857.getName(),
|
Coordinate transfCoord = MapUtils.transformCoordiante(coordinate, MAP_PROJECTION.EPSG_3857.getName(),
|
||||||
MAP_PROJECTION.EPSG_4326.getName());
|
MAP_PROJECTION.EPSG_4326.getName());
|
||||||
|
@ -365,6 +443,8 @@ public class LightOpenLayerOSM {
|
||||||
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
||||||
vectorLayerOptions.setSource(vector);
|
vectorLayerOptions.setSource(vector);
|
||||||
geometryLayer = new ol.layer.Vector(vectorLayerOptions);
|
geometryLayer = new ol.layer.Vector(vectorLayerOptions);
|
||||||
|
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR)+1;
|
||||||
|
geometryLayer.setZIndex(zIndex);
|
||||||
map.addLayer(geometryLayer);
|
map.addLayer(geometryLayer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,16 +59,17 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class OpenLayerOSM.
|
* The Class OpenLayerMap.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
* Oct 27, 2020
|
* Oct 27, 2020
|
||||||
*/
|
*/
|
||||||
public abstract class OpenLayerOSM {
|
public abstract class OpenLayerMap {
|
||||||
|
|
||||||
public static final int MAX_ZOOM = 21;
|
public static final int MAX_ZOOM = 21;
|
||||||
|
|
||||||
|
@ -134,38 +136,24 @@ public abstract class OpenLayerOSM {
|
||||||
|
|
||||||
private LinkedHashMap<String, Image> wmsDetailsLayerMap;
|
private LinkedHashMap<String, Image> wmsDetailsLayerMap;
|
||||||
|
|
||||||
private Integer[] wmsDetailsLayerZIndex = new Integer[100];
|
|
||||||
|
|
||||||
private LinkedHashMap<String, Image> wmsLayerMap;
|
private LinkedHashMap<String, Image> wmsLayerMap;
|
||||||
|
|
||||||
|
private Layer baseLayerTile;
|
||||||
|
|
||||||
|
private LayerOrder layerOrder = new LayerOrder();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new open layer OSM.
|
* Instantiates a new open layer OSM.
|
||||||
*
|
*
|
||||||
* @param divTargetId the div target id
|
* @param divTargetId the div target id
|
||||||
* @param eventBus the event bus
|
* @param eventBus the event bus
|
||||||
|
* @param baseLayer the base layer
|
||||||
*/
|
*/
|
||||||
/*
|
public OpenLayerMap(String divTargetId, HandlerManager eventBus, BaseMapLayer baseLayer) {
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see de.desjardins.ol3.demo.client.example.Example#show()
|
|
||||||
*/
|
|
||||||
public OpenLayerOSM(String divTargetId, HandlerManager eventBus) {
|
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
for (int i = 0; i < 100; 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 +172,82 @@ 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());
|
||||||
|
|
||||||
|
//applying base map
|
||||||
|
changeBaseMap(baseLayer);
|
||||||
|
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change base map.
|
||||||
|
*
|
||||||
|
* @param baseLayer the base layer
|
||||||
|
*/
|
||||||
|
public void changeBaseMap(BaseMapLayer baseLayer) {
|
||||||
|
|
||||||
|
BaseMapLayer.OL_BASE_MAP baseMap = baseLayer.getType() == null ? BaseMapLayer.OL_BASE_MAP.OSM
|
||||||
|
: baseLayer.getType();
|
||||||
|
|
||||||
|
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);
|
||||||
|
osmSource.setUrl(baseLayer.getUrl());
|
||||||
|
//setAttributions is buggy
|
||||||
|
//osmSource.setAttributions(baseLayer.getAttribution());
|
||||||
|
LayerOptions layerOptions = OLFactory.createOptions();
|
||||||
|
layerOptions.setSource(osmSource);
|
||||||
|
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_MAP)+1;
|
||||||
|
layerOptions.setZIndex(zIndex);
|
||||||
|
baseLayerTile = new Tile(layerOptions);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MAPBOX:
|
||||||
|
case OTHER:
|
||||||
|
|
||||||
|
XyzOptions xyzOptions2 = OLFactory.createOptions();
|
||||||
|
Xyz xyz = new Xyz(xyzOptions2);
|
||||||
|
//setAttributions is buggy
|
||||||
|
//xyz.setAttributions(baseLayer.getAttribution());
|
||||||
|
xyz.setUrl(baseLayer.getUrl());
|
||||||
|
|
||||||
|
LayerOptions layerOptions2 = OLFactory.createOptions();
|
||||||
|
layerOptions2.setSource(xyz);
|
||||||
|
zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_MAP)+1;
|
||||||
|
layerOptions2.setZIndex(zIndex);
|
||||||
|
baseLayerTile = new Tile(layerOptions2);
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// map == null at init time
|
||||||
|
if (map != null) {
|
||||||
|
map.addLayer(baseLayerTile);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind events.
|
* Bind events.
|
||||||
*/
|
*/
|
||||||
|
@ -357,7 +402,6 @@ public abstract class OpenLayerOSM {
|
||||||
// imageWMSOptions.setRatio(1.5f);
|
// imageWMSOptions.setRatio(1.5f);
|
||||||
|
|
||||||
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
|
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
|
||||||
|
|
||||||
LayerOptions layerOptions = OLFactory.createOptions();
|
LayerOptions layerOptions = OLFactory.createOptions();
|
||||||
layerOptions.setSource(imageWMSSource);
|
layerOptions.setSource(imageWMSSource);
|
||||||
|
|
||||||
|
@ -370,7 +414,8 @@ public abstract class OpenLayerOSM {
|
||||||
}
|
}
|
||||||
|
|
||||||
Image wmsLayer = new Image(layerOptions);
|
Image wmsLayer = new Image(layerOptions);
|
||||||
|
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_WMS)+wmsLayerMap.size()+1;
|
||||||
|
wmsLayer.setZIndex(zIndex);
|
||||||
// visibleLayerItems
|
// visibleLayerItems
|
||||||
|
|
||||||
map.addLayer(wmsLayer);
|
map.addLayer(wmsLayer);
|
||||||
|
@ -409,9 +454,9 @@ public abstract class OpenLayerOSM {
|
||||||
// imageWMSOptions.setRatio(1.5f);
|
// imageWMSOptions.setRatio(1.5f);
|
||||||
|
|
||||||
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
|
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
|
||||||
|
|
||||||
LayerOptions layerOptions = OLFactory.createOptions();
|
LayerOptions layerOptions = OLFactory.createOptions();
|
||||||
layerOptions.setSource(imageWMSSource);
|
layerOptions.setSource(imageWMSSource);
|
||||||
|
|
||||||
// Settings MIN and MAX Resolution
|
// Settings MIN and MAX Resolution
|
||||||
if (layerItem.getMinResolution() != null) {
|
if (layerItem.getMinResolution() != null) {
|
||||||
layerOptions.setMinResolution(layerItem.getMinResolution());
|
layerOptions.setMinResolution(layerItem.getMinResolution());
|
||||||
|
@ -421,7 +466,8 @@ public abstract class OpenLayerOSM {
|
||||||
}
|
}
|
||||||
|
|
||||||
Image wmsLayer = new Image(layerOptions);
|
Image wmsLayer = new Image(layerOptions);
|
||||||
wmsLayer.setZIndex(wmsDetailsLayerMap.size() + 1);
|
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.WMS_DETAIL)+wmsDetailsLayerMap.size() + 1;
|
||||||
|
wmsLayer.setZIndex(zIndex);
|
||||||
map.addLayer(wmsLayer);
|
map.addLayer(wmsLayer);
|
||||||
wmsDetailsLayerMap.put(key, wmsLayer);
|
wmsDetailsLayerMap.put(key, wmsLayer);
|
||||||
|
|
||||||
|
@ -481,6 +527,9 @@ public abstract class OpenLayerOSM {
|
||||||
|
|
||||||
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
|
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
|
||||||
|
|
||||||
|
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR)+1;
|
||||||
|
vector.setZIndex(zIndex);
|
||||||
|
|
||||||
map.addLayer(vector);
|
map.addLayer(vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,8 +869,8 @@ public abstract class OpenLayerOSM {
|
||||||
/**
|
/**
|
||||||
* Swap details layers.
|
* Swap details layers.
|
||||||
*
|
*
|
||||||
* @param layerSource the source index
|
* @param swapLSource the swap L source
|
||||||
* @param layerTarget the target index
|
* @param swapLTarget the swap L target
|
||||||
*/
|
*/
|
||||||
public void swapDetailsLayers(SwapLayer swapLSource, SwapLayer swapLTarget) {
|
public void swapDetailsLayers(SwapLayer swapLSource, SwapLayer swapLTarget) {
|
||||||
|
|
||||||
|
@ -830,14 +879,16 @@ 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 zIndexOffset = layerOrder.getOffset(LayerOrder.LAYER_TYPE.WMS_DETAIL);
|
||||||
int zIndexT = swapLTarget.getPosition()+1;
|
int zIndexS = swapLSource.getPosition() + zIndexOffset + 1;
|
||||||
GWT.log("new zindex source: "+zIndexS+", new zTarget: "+zIndexT);
|
int zIndexT = swapLTarget.getPosition() + zIndexOffset + 1;
|
||||||
|
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());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.resources;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.BaseIconType;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.resources.client.ClientBundle;
|
||||||
|
|
||||||
|
public interface GNAIcons extends ClientBundle {
|
||||||
|
|
||||||
|
/** My custom base icon collection */
|
||||||
|
public enum CustomIconType implements BaseIconType {
|
||||||
|
|
||||||
|
MAP("map"),
|
||||||
|
PRESET_LOCATION("preset_location"),
|
||||||
|
LAYERS("layers");
|
||||||
|
|
||||||
|
/** Inject the icon's css once at first usage */
|
||||||
|
static {
|
||||||
|
GNAImages icons = GWT.create(GNAImages.class);
|
||||||
|
icons.css().ensureInjected();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String PREFIX = "myBaseIcon_";
|
||||||
|
private String className;
|
||||||
|
|
||||||
|
private CustomIconType(String className) {
|
||||||
|
this.className = className;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String get() {
|
||||||
|
return PREFIX + className;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.resources;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.resources.client.ClientBundle;
|
||||||
|
import com.google.gwt.resources.client.CssResource;
|
||||||
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
|
||||||
|
public interface GNAImages extends ClientBundle {
|
||||||
|
|
||||||
|
/** Get access to the css resource during gwt compilation */
|
||||||
|
@Source("baseIcons.css")
|
||||||
|
CssResource css();
|
||||||
|
|
||||||
|
public static final GNAImages ICONS = GWT.create(GNAImages.class);
|
||||||
|
|
||||||
|
/** Our sample image icon. Makes the image resource for the gwt-compiler's css composer accessible */
|
||||||
|
@Source("map.png")
|
||||||
|
ImageResource map();
|
||||||
|
|
||||||
|
@Source("preset_location.png")
|
||||||
|
ImageResource preset_location();
|
||||||
|
|
||||||
|
@Source("layers.png")
|
||||||
|
ImageResource layers();
|
||||||
|
|
||||||
|
@Source("loading.gif")
|
||||||
|
ImageResource loading();
|
||||||
|
|
||||||
|
@Source("map-marker-icon.png")
|
||||||
|
ImageResource mapMarkerIcon();
|
||||||
|
|
||||||
|
@Source("icon_share.png")
|
||||||
|
ImageResource shareIcon();
|
||||||
|
|
||||||
|
@Source("italy.png")
|
||||||
|
ImageResource italyIcon();
|
||||||
|
|
||||||
|
@Source("world.png")
|
||||||
|
ImageResource worldIcon();
|
||||||
|
|
||||||
|
}
|
|
@ -1,25 +0,0 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.resources;
|
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
import com.google.gwt.resources.client.ClientBundle;
|
|
||||||
import com.google.gwt.resources.client.ImageResource;
|
|
||||||
|
|
||||||
public interface Images extends ClientBundle {
|
|
||||||
|
|
||||||
public static final Images ICONS = GWT.create(Images.class);
|
|
||||||
|
|
||||||
@Source("loading.gif")
|
|
||||||
ImageResource loading();
|
|
||||||
|
|
||||||
@Source("map-marker-icon.png")
|
|
||||||
ImageResource mapMarkerIcon();
|
|
||||||
|
|
||||||
@Source("icon_share.png")
|
|
||||||
ImageResource shareIcon();
|
|
||||||
|
|
||||||
@Source("italy.png")
|
|
||||||
ImageResource italyIcon();
|
|
||||||
|
|
||||||
@Source("world.png")
|
|
||||||
ImageResource worldIcon();
|
|
||||||
}
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/* Prevent our icons from css obfuscation */
|
||||||
|
@external .myBaseIcon_*; /* Do some css stuff */
|
||||||
|
@sprite .myBaseIcon_map {
|
||||||
|
gwt-image: "map";
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
width: 17px !important;
|
||||||
|
height: 17px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@sprite .myBaseIcon_preset_location {
|
||||||
|
gwt-image: "preset_location";
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
width: 17px !important;
|
||||||
|
height: 17px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@sprite .myBaseIcon_layers {
|
||||||
|
gwt-image: "layers";
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
width: 17px !important;
|
||||||
|
height: 17px !important;
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 403 B |
Binary file not shown.
After Width: | Height: | Size: 465 B |
Binary file not shown.
After Width: | Height: | Size: 500 B |
Binary file not shown.
After Width: | Height: | Size: 581 B |
Binary file not shown.
After Width: | Height: | Size: 683 B |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -1,22 +1,31 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.Images;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
||||||
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;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
@ -25,7 +34,10 @@ 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.RadioButton;
|
||||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||||
|
import com.google.gwt.user.client.ui.SimplePanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,17 +86,30 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
Button extentToEarth;
|
Button extentToEarth;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Button layersDDB;
|
Button linkLayers;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
ScrollPanel overlayLayersPanel;
|
ScrollPanel overlayLayersPanel;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel panelAttribution;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel panelBaseLayers;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
DropdownButton linkMap;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
DropdownButton linkPresetLocation;
|
||||||
|
|
||||||
private MapPanel mapPanel;
|
private MapPanel mapPanel;
|
||||||
|
|
||||||
private OpenLayerOSM map;
|
private OpenLayerMap map;
|
||||||
|
|
||||||
private HandlerManager applicationBus;
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new geona data view main panel.
|
* Instantiates a new geona data view main panel.
|
||||||
*
|
*
|
||||||
|
@ -103,33 +128,37 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
dataBoxSelection.setIcon(IconType.BOOKMARK);
|
dataBoxSelection.setIcon(IconType.BOOKMARK);
|
||||||
removeQuery.setIcon(IconType.REMOVE);
|
removeQuery.setIcon(IconType.REMOVE);
|
||||||
|
|
||||||
Image italyImg = new Image(Images.ICONS.italyIcon());
|
Image italyImg = new Image(GNAImages.ICONS.italyIcon());
|
||||||
italyImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
italyImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
||||||
extentToItaly.getElement().appendChild(italyImg.getElement());
|
extentToItaly.getElement().appendChild(italyImg.getElement());
|
||||||
extentToItaly.setWidth("140px");
|
extentToItaly.setWidth("140px");
|
||||||
|
|
||||||
Image worldImg = new Image(Images.ICONS.worldIcon());
|
Image worldImg = new Image(GNAImages.ICONS.worldIcon());
|
||||||
worldImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
worldImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
||||||
extentToEarth.getElement().appendChild(worldImg.getElement());
|
extentToEarth.getElement().appendChild(worldImg.getElement());
|
||||||
extentToEarth.setWidth("140px");
|
extentToEarth.setWidth("140px");
|
||||||
|
|
||||||
//layersDDB.setToggle(true);
|
linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
||||||
|
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
||||||
|
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
||||||
|
|
||||||
|
// layersDDB.setToggle(true);
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindEvents() {
|
private void bindEvents() {
|
||||||
|
|
||||||
layersDDB.addClickHandler(new ClickHandler() {
|
linkLayers.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
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 +182,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +201,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
*
|
*
|
||||||
* @param map the new map
|
* @param map the new map
|
||||||
*/
|
*/
|
||||||
public void setMap(OpenLayerOSM map) {
|
public void setMap(OpenLayerMap map) {
|
||||||
this.map = map;
|
this.map = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +305,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
* @return the layers DDB
|
* @return the layers DDB
|
||||||
*/
|
*/
|
||||||
public Button getLayersDDB() {
|
public Button getLayersDDB() {
|
||||||
return layersDDB;
|
return linkLayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -286,26 +315,27 @@ 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>() {
|
linkLayers.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
|
|
||||||
protected void dispatch(ClickHandler handler) {
|
@Override
|
||||||
handler.onClick(null);
|
protected void dispatch(ClickHandler handler) {
|
||||||
}
|
handler.onClick(null);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -314,9 +344,51 @@ 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBaseLayers(List<BaseMapLayer> listBaseLayers) {
|
||||||
|
|
||||||
|
if(listBaseLayers==null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
for (BaseMapLayer baseMapLayer : listBaseLayers) {
|
||||||
|
|
||||||
|
RadioButton radio = new RadioButton("base-layer");
|
||||||
|
radio.setText(baseMapLayer.getName());
|
||||||
|
if(i==0) {
|
||||||
|
radio.setValue(true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
radio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||||
|
applicationBus.fireEvent(new ChangeMapLayerEvent(baseMapLayer));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
SimplePanel sp = new SimplePanel(radio);
|
||||||
|
sp.getElement().addClassName("form-inline");
|
||||||
|
sp.getElement().addClassName("map-layers-radio");
|
||||||
|
panelBaseLayers.add(sp);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,10 +30,17 @@
|
||||||
<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>
|
||||||
|
</b:DropdownButton>
|
||||||
|
<b:DropdownButton type="LINK" title="Select the Map" text="Map" ui:field="linkMap">
|
||||||
|
<g:HTMLPanel ui:field="panelBaseLayers">
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK"
|
<b:DropdownButton type="LINK"
|
||||||
text="Preset Location" icon="TH_LARGE">
|
title="Center Map to Location" text="Preset Location" ui:field="linkPresetLocation">
|
||||||
<b:Nav>
|
<b:Nav>
|
||||||
<b:Button type="LINK" ui:field="extentToItaly"
|
<b:Button type="LINK" ui:field="extentToItaly"
|
||||||
text="Italy" title="Center to Italy"></b:Button>
|
text="Italy" title="Center to Italy"></b:Button>
|
||||||
|
@ -55,7 +62,7 @@
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
<b:Button type="LINK" ui:field="removeQuery"
|
<b:Button type="LINK" ui:field="removeQuery"
|
||||||
text="Remove Query" visible="false"></b:Button>
|
text="Remove Query" visible="false"></b:Button>
|
||||||
<b:Button type="LINK" text="Layers" ui:field="layersDDB">
|
<b:Button type="LINK" text="Layers" ui:field="linkLayers">
|
||||||
</b:Button>
|
</b:Button>
|
||||||
<g:ScrollPanel ui:field="overlayLayersPanel"
|
<g:ScrollPanel ui:field="overlayLayersPanel"
|
||||||
addStyleNames="layers-panel" visible="false"></g:ScrollPanel>
|
addStyleNames="layers-panel" visible="false"></g:ScrollPanel>
|
||||||
|
|
|
@ -1,23 +1,34 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.map;
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.map;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.LightOpenLayerOSM;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.LightOpenLayerMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.core.client.Scheduler;
|
import com.google.gwt.core.client.Scheduler;
|
||||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.Random;
|
import com.google.gwt.user.client.Random;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.RadioButton;
|
||||||
|
import com.google.gwt.user.client.ui.SimplePanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
|
@ -45,12 +56,20 @@ public class MapView extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HTMLPanel theMap;
|
HTMLPanel panelBaseLayers;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel theMapPanel;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
DropdownButton linkMap;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HorizontalPanel coordinatePanel;
|
HorizontalPanel coordinatePanel;
|
||||||
|
|
||||||
private LightOpenLayerOSM lightOLSM;
|
private LightOpenLayerMap lightOLSM;
|
||||||
|
|
||||||
|
private HTML attributionDiv = null;
|
||||||
|
|
||||||
private String theMapId = null;
|
private String theMapId = null;
|
||||||
|
|
||||||
|
@ -63,15 +82,18 @@ public class MapView extends Composite {
|
||||||
public MapView(Coordinate centerTo, int zoom, String internalMapWidth, String internalMapHeight) {
|
public MapView(Coordinate centerTo, int zoom, String internalMapWidth, String internalMapHeight) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
theMapId = "map" + Random.nextInt();
|
theMapId = "map" + Random.nextInt();
|
||||||
theMap.getElement().setId(theMapId);
|
theMapPanel.getElement().setId(theMapId);
|
||||||
theMap.setWidth(internalMapWidth);
|
theMapPanel.setWidth(internalMapWidth);
|
||||||
theMap.setHeight(internalMapHeight);
|
theMapPanel.setHeight(internalMapHeight);
|
||||||
|
|
||||||
|
linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
||||||
|
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
lightOLSM = new LightOpenLayerOSM(theMapId);
|
lightOLSM = new LightOpenLayerMap(theMapId);
|
||||||
|
setBaseLayers();
|
||||||
|
|
||||||
// EPSG_3857 LOCATION TO ITALY
|
// EPSG_3857 LOCATION TO ITALY
|
||||||
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
|
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
|
||||||
|
@ -82,13 +104,67 @@ public class MapView extends Composite {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setBaseLayers() {
|
||||||
|
List<BaseMapLayer> listBaseLayers = GeoportalDataViewer.getListBaseMapLayers();
|
||||||
|
|
||||||
|
if(listBaseLayers==null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
String radioId = "base_layer_" + Random.nextInt()+Random.nextInt();
|
||||||
|
|
||||||
|
for (BaseMapLayer baseMapLayer : listBaseLayers) {
|
||||||
|
|
||||||
|
RadioButton radio = new RadioButton(radioId);
|
||||||
|
radio.setText(baseMapLayer.getName());
|
||||||
|
if(i==0) {
|
||||||
|
radio.setValue(true, false);
|
||||||
|
setMapAttribution(baseMapLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
radio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||||
|
lightOLSM.changeBaseMap(baseMapLayer);
|
||||||
|
setMapAttribution(baseMapLayer);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
SimplePanel sp = new SimplePanel(radio);
|
||||||
|
sp.getElement().addClassName("form-inline");
|
||||||
|
sp.getElement().addClassName("map-layers-radio");
|
||||||
|
panelBaseLayers.add(sp);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setMapAttribution(BaseMapLayer baseMapLayer) {
|
||||||
|
|
||||||
|
if(attributionDiv!=null)
|
||||||
|
theMapPanel.remove(attributionDiv);
|
||||||
|
|
||||||
|
String attributionHTML = "<div class='map-internal-credits'><div class='map-internal-credits-container'>"
|
||||||
|
+ baseMapLayer.getAttribution() + "</div></div>";
|
||||||
|
attributionDiv = new HTML();
|
||||||
|
|
||||||
|
// THE OSM Contributors are automatically added by gwt-ol, others ones not.
|
||||||
|
if (!baseMapLayer.getType().equals(BaseMapLayer.OL_BASE_MAP.OSM)) {
|
||||||
|
attributionDiv.setHTML(attributionHTML);
|
||||||
|
theMapPanel.add(attributionDiv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setMapSize() {
|
private void setMapSize() {
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
int width = theMap.getParent().getOffsetWidth();
|
int width = theMapPanel.getParent().getOffsetWidth();
|
||||||
int height = theMap.getParent().getOffsetHeight();
|
int height = theMapPanel.getParent().getOffsetHeight();
|
||||||
if (width == 0)
|
if (width == 0)
|
||||||
width = 300;
|
width = 300;
|
||||||
|
|
||||||
|
@ -96,7 +172,7 @@ public class MapView extends Composite {
|
||||||
height = 300;
|
height = 300;
|
||||||
|
|
||||||
GWT.log("Internal Map w: " + width + ", h: " + height);
|
GWT.log("Internal Map w: " + width + ", h: " + height);
|
||||||
theMap.setSize(width + "px", height + "px");
|
theMapPanel.setSize(width + "px", height + "px");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -169,7 +245,7 @@ public class MapView extends Composite {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LightOpenLayerOSM getLightOLSM() {
|
public LightOpenLayerMap getLightOLSM() {
|
||||||
return lightOLSM;
|
return lightOLSM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,17 @@
|
||||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||||
|
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
<ui:style>
|
<ui:style>
|
||||||
.internalMap {
|
|
||||||
height: 280px;
|
|
||||||
display: inline-block;
|
|
||||||
margin: 0 auto;
|
|
||||||
/*float: right;*/
|
|
||||||
}
|
|
||||||
.map-style {
|
|
||||||
width: 100%;
|
|
||||||
text-align:center;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
</ui:style>
|
</ui:style>
|
||||||
<g:HTMLPanel addStyleNames="{style.map-style}">
|
<g:HTMLPanel addStyleNames="map-style">
|
||||||
<g:HTMLPanel ui:field="theMap"
|
<g:HTMLPanel ui:field="theMapPanel" addStyleNames="internal-map">
|
||||||
addStyleNames="{style.internalMap}">
|
<b:DropdownButton type="LINK" title="Select the Map"
|
||||||
|
addStyleNames="base-internal-layers-maplink" ui:field="linkMap">
|
||||||
|
<g:HTMLPanel ui:field="panelBaseLayers">
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</b:DropdownButton>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
<g:HorizontalPanel ui:field="coordinatePanel"
|
<g:HorizontalPanel ui:field="coordinatePanel"
|
||||||
visible="false"></g:HorizontalPanel>
|
visible="false"></g:HorizontalPanel>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.util;
|
package org.gcube.portlets.user.geoportaldataviewer.client.util;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.Images;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||||
|
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
@ -18,7 +18,7 @@ import com.google.gwt.user.client.ui.Image;
|
||||||
public class LoaderIcon extends HorizontalPanel{
|
public class LoaderIcon extends HorizontalPanel{
|
||||||
|
|
||||||
|
|
||||||
private Image imgLoading = new Image(Images.ICONS.loading());
|
private Image imgLoading = new Image(GNAImages.ICONS.loading());
|
||||||
private HTML txtLoading = new HTML("");
|
private HTML txtLoading = new HTML("");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||||
|
|
||||||
|
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||||
|
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.common.encryption.StringEncrypter;
|
||||||
|
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||||
|
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer.OL_BASE_MAP;
|
||||||
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
|
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class GNABaseMapsResourceReader.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 18, 2021
|
||||||
|
*/
|
||||||
|
public class GNABaseMapsResourceReader {
|
||||||
|
|
||||||
|
private static Logger LOG = LoggerFactory.getLogger(GNABaseMapsResourceReader.class);
|
||||||
|
|
||||||
|
private static final String SE_PROFILE_NAME = "GNABaseMaps";
|
||||||
|
private static final String SE_CATEGORY_NAME = "Application";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the list base maps.
|
||||||
|
*
|
||||||
|
* @return the list base maps
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public static List<BaseMapLayer> getListBaseMaps() throws Exception {
|
||||||
|
|
||||||
|
List<BaseMapLayer> lstBaseMaps = new ArrayList<BaseMapLayer>();
|
||||||
|
|
||||||
|
LOG.info("Searching SE in the scope: " + ScopeProvider.instance.get() + " with profile name: " + SE_PROFILE_NAME
|
||||||
|
+ " and category name: " + SE_CATEGORY_NAME);
|
||||||
|
|
||||||
|
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||||
|
query.addCondition("$resource/Profile/Name/text() eq '" + SE_PROFILE_NAME + "'");
|
||||||
|
query.addCondition("$resource/Profile/Category/text() eq '" + SE_CATEGORY_NAME + "'");
|
||||||
|
|
||||||
|
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||||
|
List<ServiceEndpoint> resources = client.submit(query);
|
||||||
|
|
||||||
|
if (resources.size() > 0)
|
||||||
|
LOG.info("The query returned " + resources.size() + " ServiceEndpoint/s");
|
||||||
|
else
|
||||||
|
throw new RuntimeException("ServiceEndpoint not found. Searching for profile name: " + SE_PROFILE_NAME
|
||||||
|
+ " and category name: " + SE_CATEGORY_NAME + ", in the scope: " + ScopeProvider.instance.get());
|
||||||
|
|
||||||
|
ServiceEndpoint se = resources.get(0);
|
||||||
|
Collection<AccessPoint> theAccessPoints = se.profile().accessPoints().asCollection();
|
||||||
|
for (AccessPoint accessPoint : theAccessPoints) {
|
||||||
|
BaseMapLayer bml = new BaseMapLayer();
|
||||||
|
bml.setName(accessPoint.name());
|
||||||
|
bml.setAttribution(accessPoint.description());
|
||||||
|
String url = accessPoint.address();
|
||||||
|
String apiTokenName = accessPoint.username();
|
||||||
|
String apiTokenPwd = accessPoint.password();
|
||||||
|
LOG.debug("Found API_TOKEN name: " + apiTokenName + ", encrypted token: " + apiTokenPwd);
|
||||||
|
// decrypting the pwd
|
||||||
|
try {
|
||||||
|
if (isValorized(apiTokenPwd)) {
|
||||||
|
apiTokenPwd = StringEncrypter.getEncrypter().decrypt(apiTokenPwd);
|
||||||
|
LOG.debug("Token decrypted is: " + apiTokenPwd.substring(0, apiTokenPwd.length() / 2)
|
||||||
|
+ "_MASKED_TOKEN_");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Error on decrypting the pwd: ", e);
|
||||||
|
}
|
||||||
|
if (isValorized(apiTokenName) && isValorized(apiTokenPwd)) {
|
||||||
|
url = String.format("%s?%s=%s", url, apiTokenName, apiTokenPwd);
|
||||||
|
}
|
||||||
|
bml.setUrl(url);
|
||||||
|
|
||||||
|
// SETTING MAP TYPE
|
||||||
|
String urlLower = bml.getUrl().toLowerCase();
|
||||||
|
if (urlLower.contains("mapbox")) {
|
||||||
|
bml.setType(OL_BASE_MAP.MAPBOX);
|
||||||
|
} else if (urlLower.contains("openstreetmap")) {
|
||||||
|
bml.setType(OL_BASE_MAP.OSM);
|
||||||
|
} else
|
||||||
|
bml.setType(OL_BASE_MAP.OTHER);
|
||||||
|
|
||||||
|
lstBaseMaps.add(bml);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.debug("Read base maps: "+lstBaseMaps);
|
||||||
|
LOG.info("Returning " + lstBaseMaps.size() + " base maps");
|
||||||
|
return lstBaseMaps;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isValorized(String value) {
|
||||||
|
if (value != null && !value.isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -34,6 +34,7 @@ import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.Concessio
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accesspolicy.GeoNACheckAccessPolicy;
|
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accesspolicy.GeoNACheckAccessPolicy;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
@ -321,8 +322,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
if (layerPosizionamento != null) {
|
if (layerPosizionamento != null) {
|
||||||
if (!GeoNACheckAccessPolicy.isAccessible(layerPosizionamento.getPolicy(), userName)) {
|
if (!GeoNACheckAccessPolicy.isAccessible(layerPosizionamento.getPolicy(), userName)) {
|
||||||
concessionDV.setPosizionamentoScavo(null);
|
concessionDV.setPosizionamentoScavo(null);
|
||||||
} else {
|
LOG.info("Posizionamento di Scavo is not accessible by current user: "+userName);
|
||||||
LOG.info("Posizionamento di Scavo is not accessible by current user");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,6 +332,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
for (LayerConcessioneDV layerDV : listLayersDV) {
|
for (LayerConcessioneDV layerDV : listLayersDV) {
|
||||||
if (GeoNACheckAccessPolicy.isAccessible(layerDV.getPolicy(), userName)) {
|
if (GeoNACheckAccessPolicy.isAccessible(layerDV.getPolicy(), userName)) {
|
||||||
accessibleListLayersDV.add(layerDV);
|
accessibleListLayersDV.add(layerDV);
|
||||||
|
}else {
|
||||||
|
LOG.info("(Pianta) Layer "+layerDV.getLayerName()+" is not accessible by current user: "+userName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
concessionDV.setPianteFineScavo(accessibleListLayersDV);
|
concessionDV.setPianteFineScavo(accessibleListLayersDV);
|
||||||
|
@ -341,6 +343,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
if (abstractRS != null) {
|
if (abstractRS != null) {
|
||||||
if (!GeoNACheckAccessPolicy.isAccessible(abstractRS.getPolicy(), userName)) {
|
if (!GeoNACheckAccessPolicy.isAccessible(abstractRS.getPolicy(), userName)) {
|
||||||
concessionDV.setAbstractRelazioneScavo(null);
|
concessionDV.setAbstractRelazioneScavo(null);
|
||||||
|
LOG.info("Abstract relazione is not accessible by current user: "+userName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,6 +351,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
if (relazioneScavo != null) {
|
if (relazioneScavo != null) {
|
||||||
if (!GeoNACheckAccessPolicy.isAccessible(relazioneScavo.getPolicy(), userName)) {
|
if (!GeoNACheckAccessPolicy.isAccessible(relazioneScavo.getPolicy(), userName)) {
|
||||||
concessionDV.setRelazioneScavo(null);
|
concessionDV.setRelazioneScavo(null);
|
||||||
|
LOG.info("Relazione scavo is not accessible by current user: "+userName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,6 +364,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
if (GeoNACheckAccessPolicy.isAccessible(uploadedImageDV.getPolicy(), userName)) {
|
if (GeoNACheckAccessPolicy.isAccessible(uploadedImageDV.getPolicy(), userName)) {
|
||||||
accessibleListImages.add(uploadedImageDV);
|
accessibleListImages.add(uploadedImageDV);
|
||||||
|
}else {
|
||||||
|
LOG.info("Immagine "+uploadedImageDV.getTitolo()+" is not accessible by current user: "+userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -661,4 +667,16 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BaseMapLayer> getListBaseLayers() {
|
||||||
|
LOG.info("getListBaseLayers called");
|
||||||
|
List<BaseMapLayer> listBL = new ArrayList<BaseMapLayer>();
|
||||||
|
//Setting scope in the cuurent thread
|
||||||
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
listBL = SessionUtil.getGNABaseMaps(this.getThreadLocalRequest());
|
||||||
|
LOG.info("getListBaseLayers returning "+listBL.size() +" base maps");
|
||||||
|
return listBL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class IAMClientCredentialsReader.
|
* The Class GNABaseMapsResourceReader.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,12 +3,16 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.GNABaseMapsResourceReader;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.urlshortener.UrlShortener;
|
import org.gcube.portlets.user.urlshortener.UrlShortener;
|
||||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||||
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
||||||
|
@ -34,6 +38,7 @@ public class SessionUtil {
|
||||||
private static Logger LOG = LoggerFactory.getLogger(SessionUtil.class);
|
private static Logger LOG = LoggerFactory.getLogger(SessionUtil.class);
|
||||||
|
|
||||||
private static final String URL_SHORTENER_SERVICE = "URL_SHORTENER_SERVICE";
|
private static final String URL_SHORTENER_SERVICE = "URL_SHORTENER_SERVICE";
|
||||||
|
private static final String LIST_BASE_MAPS_LAYERS = "LIST_BASE_MAPS_LAYERS";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is into portal.
|
* Checks if is into portal.
|
||||||
|
@ -168,4 +173,28 @@ public class SessionUtil {
|
||||||
|
|
||||||
return shortener;
|
return shortener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the GNA base maps.
|
||||||
|
*
|
||||||
|
* @param httpServletRequest the http servlet request
|
||||||
|
* @return the GNA base maps
|
||||||
|
*/
|
||||||
|
public static List<BaseMapLayer> getGNABaseMaps(HttpServletRequest httpServletRequest) {
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
List<BaseMapLayer> lstBML = null;
|
||||||
|
try {
|
||||||
|
lstBML = (List<BaseMapLayer>) session.getAttribute(LIST_BASE_MAPS_LAYERS);
|
||||||
|
|
||||||
|
if (lstBML == null) {
|
||||||
|
GNABaseMapsResourceReader gnaBMRR = new GNABaseMapsResourceReader();
|
||||||
|
lstBML = gnaBMRR.getListBaseMaps();
|
||||||
|
session.setAttribute(LIST_BASE_MAPS_LAYERS, lstBML);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.warn("Error occurred reading the base maps by " + GNABaseMapsResourceReader.class.getSimpleName(), e);
|
||||||
|
}
|
||||||
|
return lstBML;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class GeoNaSpatialQueryResult implements Serializable {
|
||||||
private static final long serialVersionUID = 3513120677727206958L;
|
private static final long serialVersionUID = 3513120677727206958L;
|
||||||
private List<FeatureRow> features;
|
private List<FeatureRow> features;
|
||||||
private LayerObject sourceLayerObject;
|
private LayerObject sourceLayerObject;
|
||||||
// Map with couple (mongoId concessione, list of uploaded Images for the concessione)
|
// Map with couple (mongoId concessione, list of uploaded GNAImages for the concessione)
|
||||||
private Map<String, List<UploadedImageDV>> mapImages = null;
|
private Map<String, List<UploadedImageDV>> mapImages = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
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 name;
|
||||||
|
private String url;
|
||||||
|
private String attribution;
|
||||||
|
private OL_BASE_MAP type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new base map layer.
|
||||||
|
*/
|
||||||
|
public BaseMapLayer() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseMapLayer(String name, String url, String attribution, OL_BASE_MAP type) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.url = url;
|
||||||
|
this.attribution = attribution;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAttribution() {
|
||||||
|
return attribution;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OL_BASE_MAP getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttribution(String attribution) {
|
||||||
|
this.attribution = attribution;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(OL_BASE_MAP type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("BaseMapLayer [name=");
|
||||||
|
builder.append(name);
|
||||||
|
builder.append(", url=");
|
||||||
|
builder.append(url);
|
||||||
|
builder.append(", attribution=");
|
||||||
|
builder.append(attribution);
|
||||||
|
builder.append(", type=");
|
||||||
|
builder.append(type);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -342,7 +342,7 @@ body {
|
||||||
.layers-panel {
|
.layers-panel {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
opacity: 80%;
|
opacity: 90%;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
width: 410px;
|
width: 410px;
|
||||||
}
|
}
|
||||||
|
@ -358,3 +358,96 @@ body {
|
||||||
.range-slider input {
|
.range-slider input {
|
||||||
width: 280px;
|
width: 280px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.map-credits {
|
||||||
|
width: 100%;
|
||||||
|
max-height: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-credits-container {
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
position: absolute;
|
||||||
|
display: block;
|
||||||
|
margin: 0px 0px;
|
||||||
|
padding: 2px 4px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 4px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-internal-credits {
|
||||||
|
width: 100%;
|
||||||
|
max-height: 25px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-internal-credits-container {
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
position: absolute;
|
||||||
|
display: block;
|
||||||
|
padding: 2px 4px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 4px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.map-layers-radio {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-layers-radio input {
|
||||||
|
margin-top: 0 !important;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-layers-radio label {
|
||||||
|
margin-left: 5px;
|
||||||
|
padding-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/************ INTERNAL MAP***************/
|
||||||
|
|
||||||
|
.internal-map {
|
||||||
|
height: 280px;
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 auto;
|
||||||
|
|
||||||
|
/*float: right;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-style {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.base-internal-layers-maplink {
|
||||||
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
left: 45px;
|
||||||
|
top: 40px;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.base-internal-layers-maplink .btn-link {
|
||||||
|
/*border: 1px solid #eee;*/
|
||||||
|
border: 2px solid rgba(255,255,255,.4);
|
||||||
|
/*background-color: #fcfcfc;*/
|
||||||
|
margin: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.base-internal-layers-maplink .btn-link:hover, .inner-toolbar .btn-link:focus {
|
||||||
|
background-color: #f3f3f3 !important;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loader-gna-app {
|
||||||
|
z-index: 50;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- Any title is fine -->
|
<!-- Any title is fine -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<title>Web Application Starter Project</title>
|
<title>GNA Data Viewer Application</title>
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- This script loads your compiled module. -->
|
<!-- This script loads your compiled module. -->
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.GNABaseMapsResourceReader;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class GNABaseMaps {
|
||||||
|
|
||||||
|
private static final String SCOPE = "/gcube/devsec/devVRE";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void readBaseMaps() {
|
||||||
|
System.out.println("called readBaseMaps test");
|
||||||
|
ScopeProvider.instance.set(SCOPE);
|
||||||
|
GNABaseMapsResourceReader gnaBaseMapsR = new GNABaseMapsResourceReader();
|
||||||
|
List<BaseMapLayer> lstBML = null;
|
||||||
|
try {
|
||||||
|
lstBML = gnaBaseMapsR.getListBaseMaps();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Read base map layers: " + lstBML);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue