Added new set of icons
This commit is contained in:
parent
002d6d2301
commit
4ae0c39983
|
@ -99,6 +99,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
private HTML attributionDiv = new HTML();
|
private HTML attributionDiv = new HTML();
|
||||||
|
|
||||||
|
private static List<BaseMapLayer> listBaseMapLayers = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the entry point method.
|
* This is the entry point method.
|
||||||
*/
|
*/
|
||||||
|
@ -137,6 +139,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<BaseMapLayer> listBaseMapLayers) {
|
public void onSuccess(List<BaseMapLayer> listBaseMapLayers) {
|
||||||
RootPanel.get(APP_DIV).remove(loaderApp);
|
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
|
//now the map is loaded and I'm sure that I can load the GeonaDataViewer Profile
|
||||||
loadGeonaDataViewerProfile();
|
loadGeonaDataViewerProfile();
|
||||||
mainPanel.setBaseLayers(listBaseMapLayers);
|
mainPanel.setBaseLayers(listBaseMapLayers);
|
||||||
|
@ -149,7 +152,6 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
layerManager.setOLMap(olMap);
|
layerManager.setOLMap(olMap);
|
||||||
mainPanel.setMap(olMap);
|
mainPanel.setMap(olMap);
|
||||||
|
|
||||||
//mainPanel.setMapAttribution(olMapMng.getOLOSMMap().getMapAttribution());
|
|
||||||
updateSize();
|
updateSize();
|
||||||
ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
||||||
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
||||||
|
@ -176,6 +178,10 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
RootPanel.get(APP_DIV).add(attributionDiv);
|
RootPanel.get(APP_DIV).add(attributionDiv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<BaseMapLayer> getListBaseMapLayers() {
|
||||||
|
return listBaseMapLayers;
|
||||||
|
}
|
||||||
|
|
||||||
private void loadGeonaDataViewerProfile() {
|
private void loadGeonaDataViewerProfile() {
|
||||||
|
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -34,6 +36,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,6 +47,7 @@ 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.Icon;
|
import ol.style.Icon;
|
||||||
import ol.style.IconOptions;
|
import ol.style.IconOptions;
|
||||||
|
@ -78,7 +82,11 @@ public class LightOpenLayerMap {
|
||||||
|
|
||||||
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 map.
|
* Instantiates a new light open layer map.
|
||||||
|
@ -87,15 +95,6 @@ public class LightOpenLayerMap {
|
||||||
*/
|
*/
|
||||||
public LightOpenLayerMap(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 +113,7 @@ public class LightOpenLayerMap {
|
||||||
|
|
||||||
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 +161,72 @@ public class LightOpenLayerMap {
|
||||||
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 +277,8 @@ public class LightOpenLayerMap {
|
||||||
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);
|
||||||
|
|
||||||
|
@ -370,6 +437,8 @@ public class LightOpenLayerMap {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
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;
|
||||||
|
}
|
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: 318 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 |
|
@ -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.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.OpenLayerMap;
|
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 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.Paragraph;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
|
@ -84,7 +86,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
Button extentToEarth;
|
Button extentToEarth;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Button layersDDB;
|
Button linkLayers;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
ScrollPanel overlayLayersPanel;
|
ScrollPanel overlayLayersPanel;
|
||||||
|
@ -95,6 +97,12 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
HTMLPanel panelBaseLayers;
|
HTMLPanel panelBaseLayers;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
DropdownButton linkMap;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
DropdownButton linkPresetLocation;
|
||||||
|
|
||||||
private MapPanel mapPanel;
|
private MapPanel mapPanel;
|
||||||
|
|
||||||
private OpenLayerMap map;
|
private OpenLayerMap map;
|
||||||
|
@ -102,7 +110,6 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
private HandlerManager applicationBus;
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new geona data view main panel.
|
* Instantiates a new geona data view main panel.
|
||||||
*
|
*
|
||||||
|
@ -121,16 +128,20 @@ 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");
|
||||||
|
|
||||||
|
linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
||||||
|
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
||||||
|
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
||||||
|
|
||||||
// layersDDB.setToggle(true);
|
// layersDDB.setToggle(true);
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
|
||||||
|
@ -138,7 +149,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -294,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -314,7 +325,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
|
@ -358,7 +369,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
RadioButton radio = new RadioButton("base-layer");
|
RadioButton radio = new RadioButton("base-layer");
|
||||||
radio.setText(baseMapLayer.getName());
|
radio.setText(baseMapLayer.getName());
|
||||||
if(i==0) {
|
if(i==0) {
|
||||||
radio.setValue(true, true);
|
radio.setValue(true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
radio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
radio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||||
|
|
|
@ -35,12 +35,12 @@
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK" text="Map">
|
<b:DropdownButton type="LINK" title="Select the Map" text="Map" ui:field="linkMap">
|
||||||
<g:HTMLPanel ui:field="panelBaseLayers">
|
<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>
|
||||||
|
@ -62,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,33 @@
|
||||||
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.LightOpenLayerMap;
|
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.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;
|
||||||
|
@ -44,9 +54,15 @@ public class MapView extends Composite {
|
||||||
interface MapViewUiBinder extends UiBinder<Widget, MapView> {
|
interface MapViewUiBinder extends UiBinder<Widget, MapView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel panelBaseLayers;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HTMLPanel theMap;
|
HTMLPanel theMap;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
DropdownButton linkMap;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HorizontalPanel coordinatePanel;
|
HorizontalPanel coordinatePanel;
|
||||||
|
|
||||||
|
@ -67,11 +83,14 @@ public class MapView extends Composite {
|
||||||
theMap.setWidth(internalMapWidth);
|
theMap.setWidth(internalMapWidth);
|
||||||
theMap.setHeight(internalMapHeight);
|
theMap.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 LightOpenLayerMap(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,6 +101,44 @@ public class MapView extends Composite {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
radio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChange(ValueChangeEvent<Boolean> 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() {
|
private void setMapSize() {
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
|
|
|
@ -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="theMap" addStyleNames="internalMap">
|
||||||
addStyleNames="{style.internalMap}">
|
<b:DropdownButton type="LINK" title="Select the Map"
|
||||||
|
addStyleNames="baseLayersMapLink" 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("");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -387,3 +387,41 @@ body {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/************ 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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue