2020-10-23 18:18:06 +02:00
|
|
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
|
|
|
|
2020-10-27 16:04:34 +01:00
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
2020-10-26 17:40:38 +01:00
|
|
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.Button;
|
2020-10-23 18:18:06 +02:00
|
|
|
import com.github.gwtbootstrap.client.ui.Tab;
|
|
|
|
import com.google.gwt.core.client.GWT;
|
2020-10-26 17:40:38 +01:00
|
|
|
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
|
import com.google.gwt.event.dom.client.ClickHandler;
|
2020-10-23 18:18:06 +02:00
|
|
|
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.Widget;
|
|
|
|
|
|
|
|
public class GeonaDataViewMainPanel extends Composite {
|
|
|
|
|
|
|
|
private static GeonaDataViewMainPanelUiBinder uiBinder = GWT.create(GeonaDataViewMainPanelUiBinder.class);
|
|
|
|
|
|
|
|
interface GeonaDataViewMainPanelUiBinder extends UiBinder<Widget, GeonaDataViewMainPanel> {
|
|
|
|
}
|
|
|
|
|
|
|
|
@UiField
|
2020-10-27 10:19:32 +01:00
|
|
|
Tab mapTabPanel;
|
2020-10-23 18:18:06 +02:00
|
|
|
|
2020-10-26 17:40:38 +01:00
|
|
|
@UiField
|
|
|
|
Button dataPointSelection;
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
Button dataBoxSelection;
|
|
|
|
|
2020-10-27 10:19:32 +01:00
|
|
|
private MapPanel mapPanel;
|
2020-10-26 17:40:38 +01:00
|
|
|
|
2020-10-27 16:04:34 +01:00
|
|
|
private OpenLayerOSM map;
|
2020-10-23 18:18:06 +02:00
|
|
|
|
|
|
|
public GeonaDataViewMainPanel() {
|
|
|
|
initWidget(uiBinder.createAndBindUi(this));
|
2020-10-27 10:19:32 +01:00
|
|
|
mapPanel = new MapPanel("600px");
|
|
|
|
mapTabPanel.add(mapPanel);
|
2020-10-26 17:40:38 +01:00
|
|
|
|
|
|
|
dataPointSelection.setToggle(true);
|
|
|
|
dataBoxSelection.setToggle(true);
|
|
|
|
|
|
|
|
bindHandlers();
|
2020-10-23 18:18:06 +02:00
|
|
|
}
|
2020-10-26 11:01:07 +01:00
|
|
|
|
2020-10-27 10:19:32 +01:00
|
|
|
public void setMapHeight(int height) {
|
|
|
|
mapPanel.setHeight(height +"px");
|
2020-10-26 11:01:07 +01:00
|
|
|
}
|
2020-10-23 18:18:06 +02:00
|
|
|
|
2020-10-27 10:19:32 +01:00
|
|
|
public MapPanel getMapPanel() {
|
|
|
|
return mapPanel;
|
2020-10-23 18:18:06 +02:00
|
|
|
}
|
2020-10-26 17:40:38 +01:00
|
|
|
|
2020-10-27 16:04:34 +01:00
|
|
|
public void setMap(OpenLayerOSM map) {
|
2020-10-26 17:40:38 +01:00
|
|
|
this.map = map;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void bindHandlers(){
|
|
|
|
dataPointSelection.addClickHandler(new ClickHandler() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(ClickEvent event) {
|
|
|
|
map.removeInteractions();
|
|
|
|
map.addPointVectorSource();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
dataBoxSelection.addClickHandler(new ClickHandler() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(ClickEvent event) {
|
|
|
|
map.removeInteractions();
|
|
|
|
map.addExtentInteraction();
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
2020-10-23 18:18:06 +02:00
|
|
|
|
|
|
|
}
|