diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 70f376c..6ddcc0f 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -69,9 +69,6 @@ - - uses - 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 e2e42de..c7c7ed8 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 @@ -13,6 +13,8 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMap import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler; 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.MapExtentToEvent; +import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEventHandler; @@ -324,6 +326,16 @@ public class GeoportalDataViewer implements EntryPoint { } }); + + applicationBus.addHandler(MapExtentToEvent.TYPE, new MapExtentToEventHandler() { + + @Override + public void onExtentEvent(MapExtentToEvent mapExtentToEvent) { + // TODO Auto-generated method stub + + } + }); + } private void performWFSQueryOnCentroid(RecordDV record) { 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 index 0843c61..c097d2a 100644 --- 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 @@ -10,13 +10,16 @@ public interface Images extends ClientBundle { @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/italy.png b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/italy.png index e68a7a0..9992bc9 100644 Binary files a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/italy.png and b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/italy.png differ diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/world.png b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/world.png new file mode 100644 index 0000000..e3c80f5 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/resources/world.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 f18bad3..4721c13 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 @@ -3,14 +3,18 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui; import org.gcube.application.geoportalcommon.shared.GeoNaItemRef; import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; 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.MapExtentToEvent; import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM; +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; import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.NavLink; import com.github.gwtbootstrap.client.ui.constants.IconType; import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.shared.HandlerManager; @@ -18,6 +22,7 @@ import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTMLPanel; +import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Widget; /** @@ -61,6 +66,9 @@ public class GeonaDataViewMainPanel extends Composite { @UiField Button extentToItaly; + + @UiField + Button extentToEarth; private MapPanel mapPanel; @@ -84,8 +92,18 @@ public class GeonaDataViewMainPanel extends Composite { bindHandlers(); dataPointSelection.setIcon(IconType.SCREENSHOT); dataBoxSelection.setIcon(IconType.BOOKMARK); - removeQuery.setIcon(IconType.REMOVE); + + Image italyImg = new Image(Images.ICONS.italyIcon()); + italyImg.getElement().getStyle().setPaddingLeft(20, Unit.PX); + extentToItaly.getElement().appendChild(italyImg.getElement()); + extentToItaly.setWidth("140px"); + + Image worldImg = new Image(Images.ICONS.worldIcon()); + worldImg.getElement().getStyle().setPaddingLeft(20, Unit.PX); + extentToEarth.getElement().appendChild(worldImg.getElement()); + extentToEarth.setWidth("140px"); + } /** @@ -161,7 +179,22 @@ public class GeonaDataViewMainPanel extends Composite { @Override public void onClick(ClickEvent event) { - applicationBus.fireEvent(new MapExtentToEvent(ExtentMapUtil.getLocation(ExtentMapUtil.PLACE.ITALY))); + Location italyLocation = ExtentMapUtil.getLocation(ExtentMapUtil.PLACE.ITALY); + applicationBus.fireEvent(new MapExtentToEvent(italyLocation)); + map.setCenter(italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857)); + map.setZoom(italyLocation.getZoomLevel()); + + } + }); + + extentToEarth.addClickHandler(new ClickHandler() { + + @Override + public void onClick(ClickEvent event) { + Location earthLocation = ExtentMapUtil.getLocation(ExtentMapUtil.PLACE.EARTH); + applicationBus.fireEvent(new MapExtentToEvent(earthLocation)); + map.setCenter(earthLocation.getCoordinate(MAP_PROJECTION.EPSG_3857)); + map.setZoom(earthLocation.getZoomLevel()); } }); 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 f81d0da..ba74905 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 @@ -32,6 +32,17 @@ + + + + + + + + @@ -42,8 +53,6 @@ Selection - diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/ExtentMapUtil.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/ExtentMapUtil.java index 384ddc6..cfd4f11 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/ExtentMapUtil.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/ExtentMapUtil.java @@ -27,7 +27,7 @@ public class ExtentMapUtil { * Sep 1, 2021 */ public static enum PLACE { - ITALY + ITALY, EARTH } final static Map mapExtent = new HashMap(); @@ -35,11 +35,17 @@ public class ExtentMapUtil { static { // EPSG_4326 ITALY LOCATION - Location location = new Location(PLACE.ITALY.name(), GeoportalDataViewerConstants.ITALY_CENTER_LONG, + Location ita = new Location(PLACE.ITALY.name(), GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT, MAP_PROJECTION.EPSG_4326, GeoportalDataViewerConstants.MAP_ITALY_FIT_ZOOM_ON); + + // EPSG_4326 EARTH LOCATION + Location earth = new Location(PLACE.EARTH.name(), 0, + 0, MAP_PROJECTION.EPSG_4326, + 2); - mapExtent.put(PLACE.ITALY, location); + mapExtent.put(PLACE.ITALY, ita); + mapExtent.put(PLACE.EARTH, earth); }