diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java index 5281264..bf75a85 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java @@ -98,6 +98,8 @@ public class GeoportalDataViewer implements EntryPoint { private LoaderIcon loaderApp = new LoaderIcon("Loading application...."); private HTML attributionDiv = new HTML(); + + private static List listBaseMapLayers = null; /** * This is the entry point method. @@ -137,6 +139,7 @@ public class GeoportalDataViewer implements EntryPoint { @Override public void onSuccess(List listBaseMapLayers) { RootPanel.get(APP_DIV).remove(loaderApp); + GeoportalDataViewer.listBaseMapLayers = listBaseMapLayers; //now the map is loaded and I'm sure that I can load the GeonaDataViewer Profile loadGeonaDataViewerProfile(); mainPanel.setBaseLayers(listBaseMapLayers); @@ -149,7 +152,6 @@ public class GeoportalDataViewer implements EntryPoint { layerManager.setOLMap(olMap); mainPanel.setMap(olMap); - //mainPanel.setMapAttribution(olMapMng.getOLOSMMap().getMapAttribution()); updateSize(); ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js") .setWindow(ScriptInjector.TOP_WINDOW).inject(); @@ -176,6 +178,10 @@ public class GeoportalDataViewer implements EntryPoint { RootPanel.get(APP_DIV).add(attributionDiv); } + public static List getListBaseMapLayers() { + return listBaseMapLayers; + } + private void loadGeonaDataViewerProfile() { Scheduler.get().scheduleDeferred(new ScheduledCommand() { diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/gis/LightOpenLayerMap.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/gis/LightOpenLayerMap.java index bb61559..5a54555 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/gis/LightOpenLayerMap.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/gis/LightOpenLayerMap.java @@ -5,9 +5,11 @@ import java.util.HashMap; import java.util.List; 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.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.TYPE; @@ -34,6 +36,7 @@ import ol.interaction.KeyboardPan; import ol.interaction.KeyboardZoom; import ol.layer.Base; import ol.layer.Image; +import ol.layer.Layer; import ol.layer.LayerOptions; import ol.layer.Tile; import ol.layer.VectorLayerOptions; @@ -44,6 +47,7 @@ import ol.source.ImageWmsOptions; import ol.source.ImageWmsParams; import ol.source.Osm; import ol.source.Source; +import ol.source.Xyz; import ol.source.XyzOptions; import ol.style.Icon; import ol.style.IconOptions; @@ -78,8 +82,12 @@ public class LightOpenLayerMap { 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 map. * @@ -87,15 +95,6 @@ public class LightOpenLayerMap { */ 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 projectionOptions.setCode(MAP_PROJECTION.EPSG_3857.getName()); projectionOptions.setUnits("m"); @@ -114,7 +113,7 @@ public class LightOpenLayerMap { map = new Map(mapOptions); - map.addLayer(osmLayer); + //map.addLayer(osmLayer); // map.addLayer(tileDebugLayer); Attribution attribution = new Attribution(); @@ -161,6 +160,72 @@ public class LightOpenLayerMap { // add some interactions map.addInteraction(new KeyboardPan()); map.addInteraction(new KeyboardZoom()); + + List 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 +277,8 @@ public class LightOpenLayerMap { layerOptions.setSource(imageWMSSource); ol.layer.Image wmsLayer = new ol.layer.Image(layerOptions); + int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.WMS_DETAIL)+1; + wmsLayer.setZIndex(zIndex); // visibleLayerItems map.addLayer(wmsLayer); @@ -370,6 +437,8 @@ public class LightOpenLayerMap { VectorLayerOptions vectorLayerOptions = new VectorLayerOptions(); vectorLayerOptions.setSource(vector); geometryLayer = new ol.layer.Vector(vectorLayerOptions); + int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR)+1; + geometryLayer.setZIndex(zIndex); map.addLayer(geometryLayer); } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/GNAIcons.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/GNAIcons.java new file mode 100644 index 0000000..32e4c76 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/GNAIcons.java @@ -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; + } + } +} diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/GNAImages.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/GNAImages.java new file mode 100644 index 0000000..e327a65 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/GNAImages.java @@ -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(); + +} diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/Images.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/Images.java deleted file mode 100644 index c097d2a..0000000 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/Images.java +++ /dev/null @@ -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(); -} diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/baseIcons.css b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/baseIcons.css new file mode 100644 index 0000000..8630120 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/baseIcons.css @@ -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; + margin-bottom: 3px; + margin-right: 2px; +} + +@sprite .myBaseIcon_preset_location { + gwt-image: "preset_location"; + display: inline-block; + vertical-align: middle; + margin-bottom: 3px; + margin-right: 2px; +} + +@sprite .myBaseIcon_layers { + gwt-image: "layers"; + display: inline-block; + vertical-align: middle; + margin-bottom: 3px; + margin-right: 2px; +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/home.png b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/home.png new file mode 100644 index 0000000..d19e34d Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/home.png differ diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/layers.png b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/layers.png new file mode 100644 index 0000000..41fc600 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/layers.png differ diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/map.png b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/map.png new file mode 100644 index 0000000..fc9aef5 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/map.png differ diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/new_folder.png b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/new_folder.png new file mode 100644 index 0000000..8727007 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/new_folder.png differ diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/preset_location.png b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/preset_location.png new file mode 100644 index 0000000..18f7663 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/preset_location.png differ diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/vre_folder.png b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/vre_folder.png new file mode 100644 index 0000000..68ae4d3 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/vre_folder.png differ diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.java index 894b783..3a7e45f 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.java @@ -9,12 +9,14 @@ import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerCon 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.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.Location; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer; 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.Paragraph; import com.github.gwtbootstrap.client.ui.constants.IconType; @@ -84,7 +86,7 @@ public class GeonaDataViewMainPanel extends Composite { Button extentToEarth; @UiField - Button layersDDB; + Button linkLayers; @UiField ScrollPanel overlayLayersPanel; @@ -94,6 +96,12 @@ public class GeonaDataViewMainPanel extends Composite { @UiField HTMLPanel panelBaseLayers; + + @UiField + DropdownButton linkMap; + + @UiField + DropdownButton linkPresetLocation; private MapPanel mapPanel; @@ -102,7 +110,6 @@ public class GeonaDataViewMainPanel extends Composite { private HandlerManager applicationBus; - /** * Instantiates a new geona data view main panel. * @@ -121,16 +128,20 @@ public class GeonaDataViewMainPanel extends Composite { dataBoxSelection.setIcon(IconType.BOOKMARK); 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); extentToItaly.getElement().appendChild(italyImg.getElement()); extentToItaly.setWidth("140px"); - Image worldImg = new Image(Images.ICONS.worldIcon()); + Image worldImg = new Image(GNAImages.ICONS.worldIcon()); worldImg.getElement().getStyle().setPaddingLeft(20, Unit.PX); extentToEarth.getElement().appendChild(worldImg.getElement()); extentToEarth.setWidth("140px"); - + + linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get()); + linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get()); + linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get()); + // layersDDB.setToggle(true); bindEvents(); @@ -138,7 +149,7 @@ public class GeonaDataViewMainPanel extends Composite { private void bindEvents() { - layersDDB.addClickHandler(new ClickHandler() { + linkLayers.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -294,7 +305,7 @@ public class GeonaDataViewMainPanel extends Composite { * @return the layers DDB */ public Button getLayersDDB() { - return layersDDB; + return linkLayers; } /** @@ -314,7 +325,7 @@ public class GeonaDataViewMainPanel extends Composite { } private void layersDDBClickEvent() { - layersDDB.fireEvent(new GwtEvent() { + linkLayers.fireEvent(new GwtEvent() { @Override public com.google.gwt.event.shared.GwtEvent.Type getAssociatedType() { return ClickEvent.getType(); @@ -358,7 +369,7 @@ public class GeonaDataViewMainPanel extends Composite { RadioButton radio = new RadioButton("base-layer"); radio.setText(baseMapLayer.getName()); if(i==0) { - radio.setValue(true, true); + radio.setValue(true, false); } radio.addValueChangeHandler(new ValueChangeHandler() { diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.ui.xml index 38a57f5..c996e06 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.ui.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.ui.xml @@ -35,12 +35,12 @@ - + + title="Center Map to Location" text="Preset Location" ui:field="linkPresetLocation"> @@ -62,7 +62,7 @@ - + diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/MapView.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/MapView.java index 61c5958..ced856c 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/MapView.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/MapView.java @@ -1,23 +1,33 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.map; +import java.util.List; + 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.MAP_PROJECTION; import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped; 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.resources.GNAIcons; 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.shared.gis.BaseMapLayer; +import com.github.gwtbootstrap.client.ui.DropdownButton; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; 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.UiField; import com.google.gwt.user.client.Random; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTMLPanel; 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 ol.Coordinate; @@ -44,8 +54,14 @@ public class MapView extends Composite { interface MapViewUiBinder extends UiBinder { } + @UiField + HTMLPanel panelBaseLayers; + @UiField HTMLPanel theMap; + + @UiField + DropdownButton linkMap; @UiField HorizontalPanel coordinatePanel; @@ -66,12 +82,15 @@ public class MapView extends Composite { theMap.getElement().setId(theMapId); theMap.setWidth(internalMapWidth); theMap.setHeight(internalMapHeight); + + linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get()); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { lightOLSM = new LightOpenLayerMap(theMapId); + setBaseLayers(); // EPSG_3857 LOCATION TO ITALY Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY); @@ -81,6 +100,44 @@ public class MapView extends Composite { } }); } + + public void setBaseLayers() { + List 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); + } + + radio.addValueChangeHandler(new ValueChangeHandler() { + + @Override + public void onValueChange(ValueChangeEvent event) { + //applicationBus.fireEvent(new ChangeMapLayerEvent(baseMapLayer)); + lightOLSM.changeBaseMap(baseMapLayer); + + } + }); + + SimplePanel sp = new SimplePanel(radio); + sp.getElement().addClassName("form-inline"); + sp.getElement().addClassName("map-layers-radio"); + panelBaseLayers.add(sp); + i++; + } + + } + private void setMapSize() { Scheduler.get().scheduleDeferred(new ScheduledCommand() { diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/MapView.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/MapView.ui.xml index 27b1dbe..bec7a40 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/MapView.ui.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/MapView.ui.xml @@ -1,23 +1,17 @@ + xmlns:g="urn:import:com.google.gwt.user.client.ui" + xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"> - .internalMap { - height: 280px; - display: inline-block; - margin: 0 auto; - /*float: right;*/ - } - .map-style { - width: 100%; - text-align:center; - margin-top: 10px; - margin-bottom: 20px; - } + - - + + + + + + diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/util/LoaderIcon.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/util/LoaderIcon.java index 4ba03f1..39359b9 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/util/LoaderIcon.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/util/LoaderIcon.java @@ -3,7 +3,7 @@ */ 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.HorizontalPanel; @@ -18,7 +18,7 @@ import com.google.gwt.user.client.ui.Image; 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(""); /** diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/GeoNaSpatialQueryResult.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/GeoNaSpatialQueryResult.java index 6c80e33..d6a315b 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/GeoNaSpatialQueryResult.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/GeoNaSpatialQueryResult.java @@ -24,7 +24,7 @@ public class GeoNaSpatialQueryResult implements Serializable { private static final long serialVersionUID = 3513120677727206958L; private List features; 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> mapImages = null; /** diff --git a/src/main/webapp/GeoportalDataViewer.css b/src/main/webapp/GeoportalDataViewer.css index 2ca51d9..eadce10 100644 --- a/src/main/webapp/GeoportalDataViewer.css +++ b/src/main/webapp/GeoportalDataViewer.css @@ -386,4 +386,42 @@ body { .map-layers-radio label { margin-left: 5px; padding-top: 5px; -} \ No newline at end of file +} + + +/************ INTERNAL MAP***************/ + +.internalMap { + height: 280px; + display: inline-block; + margin: 0 auto; + + /*float: right;*/ +} + +.map-style { + width: 100%; + margin-top: 10px; + margin-bottom: 20px; + text-align: center; +} + +.baseLayersMapLink { + width: 100%; + text-align: left; + left: 40px; + top: 40px; + z-index: 10; +} + +.baseLayersMapLink .btn-link { + border: 1px solid #eee; + background-color: #fcfcfc; + margin: 1px; +} + +.baseLayersMapLink .btn-link:hover, .inner-toolbar .btn-link:focus { + background-color: #f3f3f3 !important; + text-decoration: none; +} + \ No newline at end of file