task_22027 #4

Merged
francesco.mangiacrapa merged 14 commits from task_22027 into master 2021-12-07 09:50:57 +01:00
7 changed files with 42 additions and 37 deletions
Showing only changes of commit 2846ba6e2f - Show all commits

View File

@ -30,7 +30,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.gis.ExtentWrapped;
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.util.LoaderIcon;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
@ -66,7 +66,7 @@ public class GeoportalDataViewer implements EntryPoint {
public final static String APP_DIV = "geoportal-data-viewer";
/** The ol map. */
// private OpenLayerOSM olMap = null;
// private OpenLayerMap olMap = null;
/** The main panel. */
private GeonaDataViewMainPanel mainPanel;
@ -139,6 +139,7 @@ public class GeoportalDataViewer implements EntryPoint {
@Override
public void onSuccess(List<BaseMapLayer> listBaseMapLayers) {
RootPanel.get(APP_DIV).remove(loaderApp);
//now the map is loaded and I'm sure that I can load the GeonaDataViewer Profile
loadGeonaDataViewerProfile();
mainPanel.setBaseLayers(listBaseMapLayers);
@ -146,8 +147,9 @@ public class GeoportalDataViewer implements EntryPoint {
//Passing the first base map layer that will be applied as first base layer
olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),
layerManager.getLayerManagerBus(), firstBaseLayer);
layerManager.setOlMap(olMapMng.getOLOSMMap());
mainPanel.setMap(olMapMng.getOLOSMMap());
OpenLayerMap olMap = olMapMng.getOLMap();
layerManager.setOlMap(olMap);
mainPanel.setMap(olMap);
//mainPanel.setMapAttribution(olMapMng.getOLOSMMap().getMapAttribution());
updateSize();
@ -407,7 +409,7 @@ public class GeoportalDataViewer implements EntryPoint {
DO_LAYER_ACTION doAction = doLayerActionEvent.getDoAction();
GWT.log("event: "+doAction);
GWT.log("layer source: "+doLayerActionEvent.getLayerItem().getName());
OpenLayerOSM olMap = olMapMng.getOLOSMMap();
OpenLayerMap olMap = olMapMng.getOLMap();
switch (doAction) {
case OPACITY:
@ -450,7 +452,7 @@ public class GeoportalDataViewer implements EntryPoint {
String attributionHTML = "<div class='map-credits'><div class='map-credits-container'>"
+ baseLayer.getAttribution() + "</div></div>";
olMapMng.getOLOSMMap().changeBaseMap(baseLayer);
olMapMng.getOLMap().changeBaseMap(baseLayer);
//THE OSM Contributors are automatically added by gwt-ol, other ones not.
if(!baseLayer.getType().equals(BaseMapLayer.OL_BASE_MAP.OSM)) {

View File

@ -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.gis.ExtentWrapped;
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.util.StringUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
@ -81,7 +81,7 @@ import ol.geom.Geometry;
public class LayerManager {
/** The ol map. */
private OpenLayerOSM olMap;
private OpenLayerMap olMap;
private Map<String, LayerObject> mapDetailLayerObjects = new HashMap<String, LayerObject>();
private Map<String, LayerObject> mapBaseLayerObjects = new HashMap<String, LayerObject>();
@ -869,7 +869,7 @@ public class LayerManager {
*
* @param olMap the new ol map
*/
public void setOlMap(OpenLayerOSM olMap) {
public void setOlMap(OpenLayerMap olMap) {
this.olMap = olMap;
}

View File

@ -6,7 +6,7 @@ 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.gis.ExtentWrapped;
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.Location;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
@ -32,7 +32,7 @@ public class OLMapManager {
private String targetId;
private HandlerManager layerManagerBus;
private OpenLayerOSM olMap;
private OpenLayerMap olMap;
private ol.Extent dragStartExtent = null;
private Double zoomStart = null;
private Double zoomEnd = null;
@ -56,11 +56,12 @@ public class OLMapManager {
/**
* Instance OL map.
* @param baseMapLayer
*
* @param baseMapLayer the base map layer
*/
public void instanceOLMap(BaseMapLayer baseMapLayer) {
olMap = new OpenLayerOSM(targetId, layerManagerBus, baseMapLayer) {
olMap = new OpenLayerMap(targetId, layerManagerBus, baseMapLayer) {
@Override
public void clickListener(MapBrowserEvent event) {
@ -140,6 +141,7 @@ public class OLMapManager {
* To data point query.
*
* @param coordinate the coordinate
* @param manualClick the manual click
* @return the geo query
*/
public GeoQuery toDataPointQuery(Coordinate coordinate, boolean manualClick) {
@ -178,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;
}
/**
* Check select query.
*
* @param mapEventType the map event type
*/
private void checkSelectQuery(MapEventType mapEventType) {

View File

@ -52,13 +52,13 @@ import ol.style.Text;
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;
@ -85,7 +85,7 @@ public class LightOpenLayerOSM {
*
* @param divTargetId the div target id
*/
public LightOpenLayerOSM(String divTargetId) {
public LightOpenLayerMap(String divTargetId) {
// create a OSM-layer
XyzOptions osmSourceOptions = OLFactory.createOptions();
@ -265,6 +265,11 @@ public class LightOpenLayerOSM {
return layerNames;
}
/**
* Gets the layer UR ls property.
*
* @return the layer UR ls property
*/
public java.util.Map<String, String> getLayerURLsProperty() {
Collection<Base> layers = map.getLayerGroup().getLayers();

View File

@ -63,13 +63,13 @@ import ol.source.Xyz;
import ol.source.XyzOptions;
/**
* The Class OpenLayerOSM.
* The Class OpenLayerMap.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 27, 2020
*/
public abstract class OpenLayerOSM {
public abstract class OpenLayerMap {
public static final int MAX_ZOOM = 21;
@ -152,7 +152,7 @@ public abstract class OpenLayerOSM {
* @param eventBus the event bus
* @param baseLayer the base layer
*/
public OpenLayerOSM(String divTargetId, HandlerManager eventBus, BaseMapLayer baseLayer) {
public OpenLayerMap(String divTargetId, HandlerManager eventBus, BaseMapLayer baseLayer) {
this.eventBus = eventBus;
for (int i = 0; i < 100; i++) {
@ -407,12 +407,9 @@ public abstract class OpenLayerOSM {
// imageWMSOptions.setRatio(1.5f);
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(imageWMSSource);
// Settings MIN and MAX Resolution
if (layerItem.getMinResolution() != null) {
layerOptions.setMinResolution(layerItem.getMinResolution());
@ -462,12 +459,9 @@ public abstract class OpenLayerOSM {
// imageWMSOptions.setRatio(1.5f);
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(imageWMSSource);
// Settings MIN and MAX Resolution
if (layerItem.getMinResolution() != null) {
layerOptions.setMinResolution(layerItem.getMinResolution());

View File

@ -8,7 +8,7 @@ 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.events.ChangeMapLayerEvent;
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.ui.map.ExtentMapUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
@ -97,7 +97,7 @@ public class GeonaDataViewMainPanel extends Composite {
private MapPanel mapPanel;
private OpenLayerOSM map;
private OpenLayerMap map;
private HandlerManager applicationBus;
@ -190,7 +190,7 @@ public class GeonaDataViewMainPanel extends Composite {
*
* @param map the new map
*/
public void setMap(OpenLayerOSM map) {
public void setMap(OpenLayerMap map) {
this.map = map;
}

View File

@ -4,7 +4,7 @@ import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
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.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.ui.map.ExtentMapUtil.Location;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
@ -50,7 +50,7 @@ public class MapView extends Composite {
@UiField
HorizontalPanel coordinatePanel;
private LightOpenLayerOSM lightOLSM;
private LightOpenLayerMap lightOLSM;
private String theMapId = null;
@ -71,7 +71,7 @@ public class MapView extends Composite {
@Override
public void execute() {
lightOLSM = new LightOpenLayerOSM(theMapId);
lightOLSM = new LightOpenLayerMap(theMapId);
// EPSG_3857 LOCATION TO ITALY
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
@ -169,7 +169,7 @@ public class MapView extends Composite {
}
public LightOpenLayerOSM getLightOLSM() {
public LightOpenLayerMap getLightOLSM() {
return lightOLSM;
}