continue testing
This commit is contained in:
parent
4a0a4c0c64
commit
44dc4c32ca
28
pom.xml
28
pom.xml
|
@ -55,6 +55,20 @@
|
|||
<!-- <version>3.6.0</version> -->
|
||||
<!-- <type>pom</type> -->
|
||||
<!-- <scope>import</scope> -->
|
||||
<!-- <exclusions> -->
|
||||
<!-- <exclusion> -->
|
||||
<!-- <groupId>com.google.gwt</groupId> -->
|
||||
<!-- <artifactId>gwt-user</artifactId> -->
|
||||
<!-- </exclusion> -->
|
||||
<!-- <exclusion> -->
|
||||
<!-- <groupId>com.google.gwt</groupId> -->
|
||||
<!-- <artifactId>gwt-servlet</artifactId> -->
|
||||
<!-- </exclusion> -->
|
||||
<!-- <exclusion> -->
|
||||
<!-- <groupId>com.google.gwt</groupId> -->
|
||||
<!-- <artifactId>gwt-dev</artifactId> -->
|
||||
<!-- </exclusion> -->
|
||||
<!-- </exclusions> -->
|
||||
<!-- </dependency> -->
|
||||
<!-- </dependencies> -->
|
||||
</dependencyManagement>
|
||||
|
@ -82,6 +96,20 @@
|
|||
<groupId>com.github.tdesjardins</groupId>
|
||||
<artifactId>gwt-ol3</artifactId>
|
||||
<version>8.0.0-gwt2_9</version>
|
||||
<!-- <exclusions> -->
|
||||
<!-- <exclusion> -->
|
||||
<!-- <groupId>com.google.gwt</groupId> -->
|
||||
<!-- <artifactId>gwt-user</artifactId> -->
|
||||
<!-- </exclusion> -->
|
||||
<!-- <exclusion> -->
|
||||
<!-- <groupId>com.google.gwt</groupId> -->
|
||||
<!-- <artifactId>gwt-servlet</artifactId> -->
|
||||
<!-- </exclusion> -->
|
||||
<!-- <exclusion> -->
|
||||
<!-- <groupId>com.google.gwt</groupId> -->
|
||||
<!-- <artifactId>gwt-dev</artifactId> -->
|
||||
<!-- </exclusion> -->
|
||||
<!-- </exclusions> -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.gwtbootstrap</groupId>
|
||||
|
|
|
@ -42,11 +42,6 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
*/
|
||||
public void onModuleLoad() {
|
||||
|
||||
// HTMLPanel htmlPanel = new HTMLPanel("");
|
||||
// htmlPanel.setWidth("500px");
|
||||
// htmlPanel.setHeight("500px");
|
||||
// htmlPanel.getElement().setId("map");
|
||||
//
|
||||
mainPanel = new GeonaDataViewMainPanel();
|
||||
|
||||
RootPanel.get(APP_DIV).add(mainPanel);
|
||||
|
@ -56,7 +51,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
@Override
|
||||
public void execute() {
|
||||
osmExample = new OsmExample(mainPanel.getMapPanel().getElement().getId());
|
||||
//new OsmExample(htmlPanel.getElement().getId());
|
||||
mainPanel.setMap(osmExample);
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -73,7 +68,6 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
Window.alert(result);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,13 +2,24 @@ package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
|||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
|
||||
import ol.Collection;
|
||||
import ol.Coordinate;
|
||||
import ol.Map;
|
||||
import ol.MapBrowserEvent;
|
||||
import ol.MapOptions;
|
||||
import ol.OLFactory;
|
||||
import ol.OLUtil;
|
||||
import ol.Overlay;
|
||||
import ol.OverlayOptions;
|
||||
import ol.View;
|
||||
import ol.ViewOptions;
|
||||
import ol.control.Attribution;
|
||||
import ol.event.EventListener;
|
||||
import ol.interaction.Draw;
|
||||
import ol.interaction.DrawOptions;
|
||||
import ol.interaction.Extent;
|
||||
import ol.interaction.ExtentOptions;
|
||||
import ol.interaction.Interaction;
|
||||
import ol.interaction.KeyboardPan;
|
||||
import ol.interaction.KeyboardZoom;
|
||||
import ol.layer.Image;
|
||||
|
@ -20,6 +31,7 @@ import ol.source.ImageWms;
|
|||
import ol.source.ImageWmsOptions;
|
||||
import ol.source.ImageWmsParams;
|
||||
import ol.source.Osm;
|
||||
import ol.source.Vector;
|
||||
import ol.source.XyzOptions;
|
||||
|
||||
/**
|
||||
|
@ -34,6 +46,8 @@ public class OsmExample {
|
|||
private View view;
|
||||
private ViewOptions viewOptions = OLFactory.createOptions();
|
||||
private ProjectionOptions projectionOptions = OLFactory.createOptions();
|
||||
|
||||
private Draw pointDraw;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see de.desjardins.ol3.demo.client.example.Example#show()
|
||||
|
@ -99,6 +113,17 @@ public class OsmExample {
|
|||
|
||||
Attribution attribution = new Attribution();
|
||||
attribution.setCollapsed(true);
|
||||
|
||||
map.addClickListener(new EventListener<MapBrowserEvent>() {
|
||||
|
||||
@Override
|
||||
public void onEvent(MapBrowserEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
event.getCoordinate();
|
||||
addOverlay();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
map.addControl(attribution);
|
||||
|
||||
|
@ -131,6 +156,67 @@ public class OsmExample {
|
|||
//https://data.d4science.org/gis-viewer-app/?wmsrequest=https://data.d4science.org/gis-viewer-app/?wmsrequest=https%3A%2F%2Fgeona-proto.d4science.org%2Fgeoserver%2Fconcessioni_conf%2Fwms%3Fservice%3DWMS%26version%3D1.1.0%26request%3DGetMap%26layers%3Dconcessioni_conf%3Acentroids_concessioni%26styles%3D%26bbox%3D8.476%2C39.179%2C17.391%2C45.772%26width%3D768%26height%3D567%26srs%3DEPSG%3A4326%26format%3Dapplication%2Fopenlayers&zoom=6¢ermap=12.45%2C42.98https://data.d4science.org/gis-viewer-app/?wmsrequest=https%3A%2F%2Fgeona-proto.d4science.org%2Fgeoserver%2Fconcessioni_conf%2Fwms%3Fservice%3DWMS%26version%3D1.1.0%26request%3DGetMap%26layers%3Dconcessioni_conf%3Acentroids_concessioni%26styles%3D%26bbox%3D8.476%2C39.179%2C17.391%2C45.772%26width%3D768%26height%3D567%26srs%3DEPSG%3A4326%26format%3Dapplication%2Fopenlayers&zoom=6¢ermap=12.45%2C42.98https://data.d4science.org/gis-viewer-app/?wmsrequest=https%3A%2F%2Fgeona-proto.d4science.org%2Fgeoserver%2Fconcessioni_conf%2Fwms%3Fservice%3DWMS%26version%3D1.1.0%26request%3DGetMap%26layers%3Dconcessioni_conf%3Acentroids_concessioni%26styles%3D%26bbox%3D8.476%2C39.179%2C17.391%2C45.772%26width%3D768%26height%3D567%26srs%3DEPSG%3A4326%26format%3Dapplication%2Fopenlayers&zoom=6¢ermap=12.45%2C42.98https://data.d4science.org/gis-viewer-app/?wmsrequest=https%3A%2F%2Fgeona-proto.d4science.org%2Fgeoserver%2Fconcessioni_conf%2Fwms%3Fservice%3DWMS%26version%3D1.1.0%26request%3DGetMap%26layers%3Dconcessioni_conf%3Acentroids_concessioni%26styles%3D%26bbox%3D8.476%2C39.179%2C17.391%2C45.772%26width%3D768%26height%3D567%26srs%3DEPSG%3A4326%26format%3Dapplication%2Fopenlayers&zoom=6¢ermap=12.45%2C42.98https://data.d4science.org/gis-viewer-app/?wmsrequest=https%3A%2F%2Fgeona-proto.d4science.org%2Fgeoserver%2Fconcessioni_conf%2Fwms%3Fservice%3DWMS%26version%3D1.1.0%26request%3DGetMap%26layers%3Dconcessioni_conf%3Acentroids_concessioni%26styles%3D%26bbox%3D8.476%2C39.179%2C17.391%2C45.772%26width%3D768%26height%3D567%26srs%3DEPSG%3A4326%26format%3Dapplication%2Fopenlayers&zoom=6¢ermap=12.45%2C42.98https://data.d4science.org/gis-viewer-app/?wmsrequest=https%3A%2F%2Fgeona-proto.d4science.org%2Fgeoserver%2Fconcessioni_conf%2Fwms%3Fservice%3DWMS%26version%3D1.1.0%26request%3DGetMap%26layers%3Dconcessioni_conf%3Acentroids_concessioni%26styles%3D%26bbox%3D8.476%2C39.179%2C17.391%2C45.772%26width%3D768%26height%3D567%26srs%3DEPSG%3A4326%26format%3Dapplication%2Fopenlayers&zoom=6¢ermap=12.45%2C42.98https://data.d4science.org/gis-viewer-app/?wmsrequest=https%3A%2F%2Fgeona-proto.d4science.org%2Fgeoserver%2Fconcessioni_conf%2Fwms%3Fservice%3DWMS%26version%3D1.1.0%26request%3DGetMap%26layers%3Dconcessioni_conf%3Acentroids_concessioni%26styles%3D%26bbox%3D8.476%2C39.179%2C17.391%2C45.772%26width%3D768%26height%3D567%26srs%3DEPSG%3A4326%26format%3Dapplication%2Fopenlayers&zoom=6¢ermap=12.45%2C42.98https://data.d4science.org/gis-viewer-app/?wmsrequest=https%3A%2F%2Fgeona-proto.d4science.org%2Fgeoserver%2Fconcessioni_conf%2Fwms%3Fservice%3DWMS%26version%3D1.1.0%26request%3DGetMap%26layers%3Dconcessioni_conf%3Acentroids_concessioni%26styles%3D%26bbox%3D8.476%2C39.179%2C17.391%2C45.772%26width%3D768%26height%3D567%26srs%3DEPSG%3A4326%26format%3Dapplication%2Fopenlayers&zoom=6¢ermap=12.45%2C42.98https://data.d4science.org/gis-viewer-app/?wmsrequest=https%3A%2F%2Fgeona-proto.d4science.org%2Fgeoserver%2Fconcessioni_conf%2Fwms%3Fservice%3DWMS%26version%3D1.1.0%26request%3DGetMap%26layers%3Dconcessioni_conf%3Acentroids_concessioni%26styles%3D%26bbox%3D8.476%2C39.179%2C17.391%2C45.772%26width%3D768%26height%3D567%26srs%3DEPSG%3A4326%26format%3Dapplication%2Fopenlayers&zoom=6¢ermap=12.45%2C42.98https://data.d4science.org/gis-viewer-app/?wmsrequest=https%3A%2F%2Fgeona-proto.d4science.org%2Fgeoserver%2Fconcessioni_conf%2Fwms%3Fservice%3DWMS%26version%3D1.1.0%26request%3DGetMap%26layers%3Dconcessioni_conf%3Acentroids_concessioni%26styles%3D%26bbox%3D8.476%2C39.179%2C17.391%2C45.772%26width%3D768%26height%3D567%26srs%3DEPSG%3A4326%26format%3Dapplication%2Fopenlayers&zoom=6¢ermap=12.45%2C42.98https://data.d4science.org/gis-viewer-app/?wmsrequest=https%3A%2F%2Fgeona-proto.d4science.org%2Fgeoserver%2Fconcessioni_conf%2Fwms%3Fservice%3DWMS%26version%3D1.1.0%26request%3DGetMap%26layers%3Dconcessioni_conf%3Acentroids_concessioni%26styles%3D%26bbox%3D8.476%2C39.179%2C17.391%2C45.772%26width%3D768%26height%3D567%26srs%3DEPSG%3A4326%26format%3Dapplication%2Fopenlayers&zoom=6¢ermap=12.45%2C42.98https%3A%2F%2Fgeona-proto.d4science.org%2Fgeoserver%2Fconcessioni_conf%2Fwms%3Fservice%3DWMS%26version%3D1.1.0%26request%3DGetMap%26layers%3Dconcessioni_conf%3Acentroids_concessioni%26styles%3D%26bbox%3D8.476%2C39.179%2C17.391%2C45.772%26width%3D768%26height%3D567%26srs%3DEPSG%3A4326%26format%3Dapplication%2Fopenlayers&zoom=6¢ermap=12.45%2C42.98
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Draw addPointVectorSource() {
|
||||
if(pointDraw==null)
|
||||
initPointInteraction();
|
||||
|
||||
map.addInteraction(pointDraw);
|
||||
return pointDraw;
|
||||
}
|
||||
|
||||
private void initPointInteraction() {
|
||||
Vector vectorSource = new Vector();
|
||||
DrawOptions drawOptions = new DrawOptions();
|
||||
drawOptions.setSource(vectorSource);
|
||||
drawOptions.setType("Point");
|
||||
drawOptions.setMaxPoints(1);
|
||||
drawOptions.setMinPoints(1);
|
||||
drawOptions.setWrapX(false);
|
||||
pointDraw = new Draw(drawOptions);
|
||||
}
|
||||
|
||||
public void removeInteraction(Interaction interaction) {
|
||||
map.removeInteraction(interaction);
|
||||
}
|
||||
|
||||
public void removeInteractions() {
|
||||
Collection<Interaction> interactions = map.getInteractions();
|
||||
if(interactions!=null) {
|
||||
Interaction[] inters = map.getInteractions().getArray();
|
||||
for (int i = 0; i < inters.length; i++) {
|
||||
Interaction inter = inters[i];
|
||||
map.removeInteraction(inter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Extent addExtentInteraction() {
|
||||
ExtentOptions extentOptions = new ExtentOptions();
|
||||
extentOptions.setWrapX(false);
|
||||
//StyleOptions styleOptions = new StyleOptions();
|
||||
//styleOptions.setStroke(stroke);
|
||||
//styleOptions.set
|
||||
//extentOptions.setBoxStyle(new ol.style.Style(styleOptions));
|
||||
Extent extent = new Extent(extentOptions);
|
||||
map.addInteraction(extent);
|
||||
return extent;
|
||||
}
|
||||
|
||||
|
||||
private void addOverlay() {
|
||||
/**
|
||||
* Create an overlay to anchor the popup to the map.
|
||||
*/
|
||||
OverlayOptions overlayOptions = new OverlayOptions();
|
||||
overlayOptions.setAutoPan(true);
|
||||
Overlay overlay = new Overlay(overlayOptions);
|
||||
map.addOverlay(overlay);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class BasePanel extends Composite {
|
||||
|
||||
private static BasePanelUiBinder uiBinder = GWT.create(BasePanelUiBinder.class);
|
||||
|
||||
interface BasePanelUiBinder extends UiBinder<Widget, BasePanel> {
|
||||
}
|
||||
|
||||
public BasePanel() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public BasePanel(String firstName) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
}
|
||||
//package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||
//
|
||||
//import com.google.gwt.core.client.GWT;
|
||||
//import com.google.gwt.uibinder.client.UiBinder;
|
||||
//import com.google.gwt.user.client.ui.Composite;
|
||||
//import com.google.gwt.user.client.ui.Widget;
|
||||
//
|
||||
//public class BasePanel extends Composite {
|
||||
//
|
||||
// private static BasePanelUiBinder uiBinder = GWT.create(BasePanelUiBinder.class);
|
||||
//
|
||||
// interface BasePanelUiBinder extends UiBinder<Widget, BasePanel> {
|
||||
// }
|
||||
//
|
||||
// public BasePanel() {
|
||||
// initWidget(uiBinder.createAndBindUi(this));
|
||||
// }
|
||||
//
|
||||
// public BasePanel(String firstName) {
|
||||
// initWidget(uiBinder.createAndBindUi(this));
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!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"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||
<ui:style>
|
||||
|
@ -8,4 +8,4 @@
|
|||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
</ui:UiBinder> -->
|
|
@ -1,7 +1,12 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OsmExample;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Tab;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
|
@ -18,7 +23,16 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
@UiField
|
||||
Tab mapPanel;
|
||||
|
||||
@UiField
|
||||
Button dataPointSelection;
|
||||
|
||||
@UiField
|
||||
Button dataBoxSelection;
|
||||
|
||||
|
||||
private HTMLPanel htmlPanel;
|
||||
|
||||
private OsmExample map;
|
||||
|
||||
public GeonaDataViewMainPanel() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
@ -26,6 +40,11 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
htmlPanel.getElement().setId("map");
|
||||
htmlPanel.setHeight("600px");
|
||||
mapPanel.add(htmlPanel);
|
||||
|
||||
dataPointSelection.setToggle(true);
|
||||
dataBoxSelection.setToggle(true);
|
||||
|
||||
bindHandlers();
|
||||
}
|
||||
|
||||
public void setHeight(int height) {
|
||||
|
@ -35,5 +54,31 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
public HTMLPanel getMapPanel() {
|
||||
return htmlPanel;
|
||||
}
|
||||
|
||||
public void setMap(OsmExample map) {
|
||||
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();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,13 @@
|
|||
</ui:style>
|
||||
<g:HTMLPanel ui:field="mainHTMLPanel">
|
||||
<b:TabPanel ui:field="mainTabPanel" tabPosition="top">
|
||||
<b:Tab ui:field="mapPanel" active="true">
|
||||
<b:Tab ui:field="mapPanel" active="true" heading="Map">
|
||||
<b:ButtonToolbar>
|
||||
<b:ButtonGroup>
|
||||
<b:Button ui:field="dataPointSelection">Data Point Selection</b:Button>
|
||||
<b:Button ui:field="dataBoxSelection">Data Box Selection</b:Button>
|
||||
</b:ButtonGroup>
|
||||
</b:ButtonToolbar>
|
||||
</b:Tab>
|
||||
</b:TabPanel>
|
||||
</g:HTMLPanel>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ac<%@page contentType="text/html"%>
|
||||
<%@page contentType="text/html"%>
|
||||
<%@page pageEncoding="UTF-8"%>
|
||||
|
||||
<%-- Uncomment below lines to add portlet taglibs to jsp
|
||||
|
@ -8,15 +8,25 @@ ac<%@page contentType="text/html"%>
|
|||
<portlet:defineObjects />
|
||||
--%>
|
||||
|
||||
<script
|
||||
src='<%=request.getContextPath()%>/GeoportalDataViewer/js/jquery-1.10.1.min.js'></script>
|
||||
|
||||
<script
|
||||
src='<%=request.getContextPath()%>/GeoportalDataViewer/js/bootstrap.min.js'></script>
|
||||
|
||||
<link
|
||||
href="//cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.4.3/css/ol.css"
|
||||
rel="stylesheet" type="text/css">
|
||||
|
||||
<script
|
||||
src="//cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.4.3/build/ol.js"
|
||||
type="text/javascript"></script>
|
||||
|
||||
<link rel="stylesheet"
|
||||
href="<%=request.getContextPath()%>/"GeoportalDataViewer.css"
|
||||
href="<%=request.getContextPath()%>/GeoportalDataViewer.css"
|
||||
type="text/css">
|
||||
|
||||
<script type="text/javascript"
|
||||
src="<%=request.getContextPath()%>/GeoportalDataViewer/GeoportalDataViewer.nocache.js"></script>
|
||||
|
||||
<!-- <script type="text/javascript"
|
||||
src='<%=request.getContextPath()%>/js/jquery.autosize.js'></script> -->
|
||||
|
||||
|
||||
<div id="geoportal-data-viewer"></div>
|
|
@ -12,8 +12,8 @@
|
|||
<portlet-mode>VIEW</portlet-mode>
|
||||
</supports>
|
||||
<portlet-info>
|
||||
<title>GeoPortal DataViewerApp Portlet</title>
|
||||
<short-title>GeoPortal DataViewerApp Portlet</short-title>
|
||||
<title>GeoPortal-DataViewerApp-Portlet</title>
|
||||
<short-title>GeoPortal-DataViewerApp-Portlet</short-title>
|
||||
</portlet-info>
|
||||
<portlet-preferences>
|
||||
<preference>
|
||||
|
|
Loading…
Reference in New Issue