repackaged
This commit is contained in:
parent
3f018feb18
commit
3c80de9703
|
@ -1,16 +1,16 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OsmExample;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
||||||
|
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
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.dom.client.Style.Unit;
|
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
import com.google.gwt.event.logical.shared.ResizeHandler;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.ui.RootPanel;
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
import com.google.gwt.user.client.ui.SimplePanel;
|
|
||||||
import com.google.gwt.user.client.ui.TabLayoutPanel;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point classes define <code>onModuleLoad()</code>.
|
* Entry point classes define <code>onModuleLoad()</code>.
|
||||||
|
@ -34,6 +34,10 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
public final static String APP_DIV = "geoportal-data-viewer";
|
public final static String APP_DIV = "geoportal-data-viewer";
|
||||||
|
|
||||||
private boolean initialized = false;
|
private boolean initialized = false;
|
||||||
|
|
||||||
|
private OsmExample osmExample = null;
|
||||||
|
|
||||||
|
private GeonaDataViewMainPanel mainPanel;
|
||||||
/**
|
/**
|
||||||
* This is the entry point method.
|
* This is the entry point method.
|
||||||
*/
|
*/
|
||||||
|
@ -44,7 +48,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
// htmlPanel.setHeight("500px");
|
// htmlPanel.setHeight("500px");
|
||||||
// htmlPanel.getElement().setId("map");
|
// htmlPanel.getElement().setId("map");
|
||||||
//
|
//
|
||||||
GeonaDataViewMainPanel mainPanel = new GeonaDataViewMainPanel();
|
mainPanel = new GeonaDataViewMainPanel();
|
||||||
|
|
||||||
RootPanel.get(APP_DIV).add(mainPanel);
|
RootPanel.get(APP_DIV).add(mainPanel);
|
||||||
|
|
||||||
|
@ -52,29 +56,20 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
new OsmExample(mainPanel.getMapPanel().getElement().getId());
|
osmExample = new OsmExample(mainPanel.getMapPanel().getElement().getId());
|
||||||
//new OsmExample(htmlPanel.getElement().getId());
|
//new OsmExample(htmlPanel.getElement().getId());
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// SimplePanel sp = new SimplePanel() {
|
Window.addResizeHandler(new ResizeHandler() {
|
||||||
//
|
@Override
|
||||||
// @Override
|
public void onResize(ResizeEvent event) {
|
||||||
// public void setVisible(boolean visible) {
|
GWT.log("onWindowResized width: "+event.getWidth()+" height: "+event.getHeight());
|
||||||
// if (visible && !initialized) {
|
mainPanel.setHeight(event.getHeight()-200);
|
||||||
// Scheduler.get().scheduleDeferred(() -> example.getExample().show(example.getExample().toString()));
|
}
|
||||||
// initialized = true;
|
});
|
||||||
// }
|
|
||||||
// super.setVisible(visible);
|
|
||||||
//
|
|
||||||
// if (visible) {
|
|
||||||
// History.newItem(example.name());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
|
|
||||||
import com.google.gwt.dom.client.Document;
|
import com.google.gwt.dom.client.Document;
|
||||||
import com.google.gwt.dom.client.LinkElement;
|
import com.google.gwt.dom.client.LinkElement;
|
|
@ -1,6 +1,9 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
|
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
|
import ol.Extent;
|
||||||
import ol.Map;
|
import ol.Map;
|
||||||
import ol.MapOptions;
|
import ol.MapOptions;
|
||||||
import ol.OLFactory;
|
import ol.OLFactory;
|
||||||
|
@ -69,16 +72,19 @@ public class OsmExample {
|
||||||
|
|
||||||
Projection projection = new Projection(projectionOptions);
|
Projection projection = new Projection(projectionOptions);
|
||||||
viewOptions.setProjection(projection);
|
viewOptions.setProjection(projection);
|
||||||
|
viewOptions.setMaxZoom(19);
|
||||||
|
//viewOptions.setExtent(new Extent(-180, -90, 180, 90));
|
||||||
|
|
||||||
// create a view
|
// create a view
|
||||||
view = new View(viewOptions);
|
view = new View(viewOptions);
|
||||||
|
|
||||||
Coordinate centerCoordinate = OLFactory.createCoordinate(-0.1275, 51.507222);
|
//EPSG_4326_TO_ITALY
|
||||||
|
Coordinate centerCoordinate = OLFactory.createCoordinate(12.45, 42.98);
|
||||||
Coordinate transformedCenterCoordinate = Projection.transform(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
Coordinate transformedCenterCoordinate = Projection.transform(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
||||||
|
|
||||||
Coordinate coordinate = new Coordinate(16, 48);
|
view.setCenter(transformedCenterCoordinate);
|
||||||
view.setCenter(coordinate);
|
view.setZoom(5);
|
||||||
view.setZoom(10);
|
|
||||||
|
|
||||||
// create the map
|
// create the map
|
||||||
MapOptions mapOptions = OLFactory.createOptions();
|
MapOptions mapOptions = OLFactory.createOptions();
|
|
@ -27,6 +27,10 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
htmlPanel.setHeight("600px");
|
htmlPanel.setHeight("600px");
|
||||||
mapPanel.add(htmlPanel);
|
mapPanel.add(htmlPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHeight(int height) {
|
||||||
|
htmlPanel.setHeight(height +"px");
|
||||||
|
}
|
||||||
|
|
||||||
public HTMLPanel getMapPanel() {
|
public HTMLPanel getMapPanel() {
|
||||||
return htmlPanel;
|
return htmlPanel;
|
||||||
|
|
Loading…
Reference in New Issue