added "Extent To" facility

This commit is contained in:
Francesco Mangiacrapa 2021-09-01 16:26:07 +02:00
parent b337955f71
commit 5a84d3a990
8 changed files with 73 additions and 13 deletions

View File

@ -69,9 +69,6 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="geoportal-data-common-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type>
</dependent-module>

View File

@ -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) {

View File

@ -19,4 +19,7 @@ public interface Images extends ClientBundle {
@Source("italy.png")
ImageResource italyIcon();
@Source("world.png")
ImageResource worldIcon();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -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;
/**
@ -62,6 +67,9 @@ public class GeonaDataViewMainPanel extends Composite {
@UiField
Button extentToItaly;
@UiField
Button extentToEarth;
private MapPanel mapPanel;
private OpenLayerOSM map;
@ -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());
}
});

View File

@ -32,6 +32,17 @@
</b:Paragraph>
</g:HTMLPanel>
</b:DropdownButton>
<b:DropdownButton type="LINK" text="Extent to"
icon="TH_LARGE">
<b:Nav>
<b:Button type="LINK" ui:field="extentToItaly"
text="Italy" title="Center to Italy"></b:Button>
</b:Nav>
<b:Nav>
<b:Button type="LINK" ui:field="extentToEarth"
text="Earth" title="Center to Earth"></b:Button>
</b:Nav>
</b:DropdownButton>
<b:DropdownButton type="LINK" text="Query"
visible="false">
<!-- <b:ButtonGroup toggle="checkbox" ui:field="buttonGroup"> -->
@ -42,8 +53,6 @@
Selection</b:NavLink>
<!-- </b:ButtonGroup> -->
</b:DropdownButton>
<b:Button type="LINK" ui:field="extentToItaly"
text="Extent"></b:Button>
<b:Button type="LINK" ui:field="removeQuery"
text="Remove Query" visible="false"></b:Button>
</g:HTMLPanel>

View File

@ -27,7 +27,7 @@ public class ExtentMapUtil {
* Sep 1, 2021
*/
public static enum PLACE {
ITALY
ITALY, EARTH
}
final static Map<PLACE, Location> mapExtent = new HashMap<PLACE, Location>();
@ -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);
mapExtent.put(PLACE.ITALY, location);
// EPSG_4326 EARTH LOCATION
Location earth = new Location(PLACE.EARTH.name(), 0,
0, MAP_PROJECTION.EPSG_4326,
2);
mapExtent.put(PLACE.ITALY, ita);
mapExtent.put(PLACE.EARTH, earth);
}