Added set zoom and set longlat as init parameter and method
This commit is contained in:
parent
fae2a93858
commit
d7a74c9e07
|
@ -91,7 +91,8 @@ public class Constants {
|
|||
public static final int geoWindowMinHeight=300;
|
||||
public static final String geoWindowTitle="GIS Viewer "+ VERSION;
|
||||
public static final boolean geoWindowShadow = false;
|
||||
public static final boolean geoWindowDataPanelOpenedAtStart = true;
|
||||
public static final boolean geoWindowDataPanelOpenedAtStart = false;
|
||||
public static final boolean geoWindowLayerPanelOpenedAtStart = false;
|
||||
public static String defaultProjection = "EPSG:4326";
|
||||
|
||||
public static final String hcafLegendWidth = "400px";
|
||||
|
|
|
@ -53,14 +53,20 @@ public class GisViewerLayout extends LayoutContainer {
|
|||
private DataPanelHandler handler;
|
||||
private boolean openDataPanel;
|
||||
protected boolean started=false;
|
||||
private boolean openLayerPanel;
|
||||
|
||||
// private boolean isOpenDataPanel = false;
|
||||
|
||||
public GisViewerLayout(boolean openDataPanel, DataPanelHandler dataPanelHandler) {
|
||||
/**
|
||||
* Instantiates a new gis viewer layout.
|
||||
*
|
||||
* @param openDataPanel the open data panel
|
||||
* @param openLayerPanel the open layer panel
|
||||
* @param dataPanelHandler the data panel handler
|
||||
*/
|
||||
public GisViewerLayout(final boolean openDataPanel, final boolean openLayerPanel, DataPanelHandler dataPanelHandler) {
|
||||
super();
|
||||
|
||||
this.openDataPanel = openDataPanel;
|
||||
// this.isOpenDataPanel = openDataPanel;
|
||||
this.openLayerPanel = openLayerPanel;
|
||||
|
||||
this.handler = dataPanelHandler;
|
||||
|
||||
|
@ -127,7 +133,10 @@ public class GisViewerLayout extends LayoutContainer {
|
|||
|
||||
@Override
|
||||
public void execute() {
|
||||
westPanel.collapse(); //I'm closing the panel as default
|
||||
if(openLayerPanel)
|
||||
westPanel.expand();
|
||||
else
|
||||
westPanel.collapse();//I'm closing the panel
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -142,6 +151,18 @@ public class GisViewerLayout extends LayoutContainer {
|
|||
southPanel.setBodyStyle(Constants.panelsBodyStyle);
|
||||
southPanel.setScrollMode(Scroll.AUTO);
|
||||
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
if(openDataPanel)
|
||||
southPanel.expand();
|
||||
else
|
||||
southPanel.collapse();//I'm closing the panel
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
centerPanel = new ContentPanel(){
|
||||
protected void onResize(int width, int height) {
|
||||
super.onResize(width, height);
|
||||
|
|
|
@ -158,11 +158,15 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
|
|||
INSTANCE = this;
|
||||
// create an empty layers panel
|
||||
layersPanel = new LayersPanel(this);
|
||||
createOpenLayersMap();
|
||||
|
||||
//TEMPORARY SOLUTION. MUST BECOME INIT PARAMETERS
|
||||
LonLat centerMapTo = null; //new LonLat(12.45, 42.98);
|
||||
Integer initZoomTo = null;
|
||||
createOpenLayersMap(centerMapTo, initZoomTo);
|
||||
|
||||
// initialize the layout
|
||||
this.setLayout(new FitLayout());
|
||||
mainPanel = new GisViewerLayout(parameters.isOpenDataPanelAtStart(), this) {
|
||||
mainPanel = new GisViewerLayout(parameters.isOpenDataPanelAtStart(), parameters.isOpenLayerPanelAtStart(), this) {
|
||||
/* (non-Javadoc)
|
||||
* @see com.extjs.gxt.ui.client.widget.LayoutContainer#onRender(com.google.gwt.user.client.Element, int)
|
||||
*/
|
||||
|
@ -353,10 +357,7 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
|
|||
/**
|
||||
* Creates the open layers map.
|
||||
*/
|
||||
private void createOpenLayersMap() { // TODO update for pluggable layers
|
||||
|
||||
final LonLat centerMapTo = null;
|
||||
final Integer initZoomTo = null;
|
||||
private void createOpenLayersMap(final LonLat centerMapTo, final Integer initZoomTo) { // TODO update for pluggable layers
|
||||
|
||||
GisViewer.service.getBaseLayersToGisViewer(new AsyncCallback<List<? extends GisViewerBaseLayerInterface>>() {
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.gcube.portlets.user.gisviewer.client;
|
||||
|
||||
import org.gwtopenmaps.openlayers.client.LonLat;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class GisViewerParameters.
|
||||
*
|
||||
|
@ -13,6 +15,9 @@ public class GisViewerParameters {
|
|||
private GisViewerSaveHandler gisViewerSaveHandler = null;
|
||||
private DataPanelOpenListener dataPanelOpenHandler = null;
|
||||
private boolean openDataPanelAtStart = Constants.geoWindowDataPanelOpenedAtStart;
|
||||
private boolean openLayerPanelAtStart = Constants.geoWindowLayerPanelOpenedAtStart;
|
||||
private LonLat centerMapTo = null; //new LonLat(12.45, 42.98);
|
||||
private Integer initZoomTo = null;
|
||||
|
||||
/**
|
||||
* Instantiates a new gis viewer parameters.
|
||||
|
@ -31,6 +36,50 @@ public class GisViewerParameters {
|
|||
this.gisViewerSaveHandler = gisViewerSaveHandler;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new gis viewer parameters.
|
||||
*
|
||||
* @param projection the projection
|
||||
* @param gisViewerSaveHandler the gis viewer save handler
|
||||
* @param dataPanelOpenHandler the data panel open handler
|
||||
* @param openDataPanelAtStart the open data panel at start
|
||||
* @param openLayerPanelAtStart the open layer panel at start
|
||||
* @param centerMapTo the center map to
|
||||
* @param initZoomTo the init zoom to
|
||||
*/
|
||||
public GisViewerParameters(String projection, GisViewerSaveHandler gisViewerSaveHandler,
|
||||
DataPanelOpenListener dataPanelOpenHandler, boolean openDataPanelAtStart, boolean openLayerPanelAtStart,
|
||||
LonLat centerMapTo, Integer initZoomTo) {
|
||||
super();
|
||||
this.projection = projection;
|
||||
this.gisViewerSaveHandler = gisViewerSaveHandler;
|
||||
this.dataPanelOpenHandler = dataPanelOpenHandler;
|
||||
this.openDataPanelAtStart = openDataPanelAtStart;
|
||||
this.openLayerPanelAtStart = openLayerPanelAtStart;
|
||||
this.centerMapTo = centerMapTo;
|
||||
this.initZoomTo = initZoomTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is open layer panel at start.
|
||||
*
|
||||
* @return true, if is open layer panel at start
|
||||
*/
|
||||
public boolean isOpenLayerPanelAtStart() {
|
||||
return openLayerPanelAtStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the open layer panel at start.
|
||||
*
|
||||
* @param openLayerPanelAtStart the new open layer panel at start
|
||||
*/
|
||||
public void setOpenLayerPanelAtStart(boolean openLayerPanelAtStart) {
|
||||
this.openLayerPanelAtStart = openLayerPanelAtStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the projection.
|
||||
*
|
||||
|
@ -102,4 +151,51 @@ public class GisViewerParameters {
|
|||
public DataPanelOpenListener getDataPanelOpenHandler() {
|
||||
return dataPanelOpenHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the center map to.
|
||||
*
|
||||
* @return the center map to
|
||||
*/
|
||||
public LonLat getCenterMapTo() {
|
||||
return centerMapTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the center map to.
|
||||
*
|
||||
* @param centerMapTo the new center map to
|
||||
*/
|
||||
public void setCenterMapTo(LonLat centerMapTo) {
|
||||
this.centerMapTo = centerMapTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the inits the zoom to.
|
||||
*
|
||||
* @return the inits the zoom to
|
||||
*/
|
||||
public Integer getInitZoomTo() {
|
||||
return initZoomTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the inits the zoom to.
|
||||
*
|
||||
* @param initZoomTo the new inits the zoom to
|
||||
*/
|
||||
public void setInitZoomTo(Integer initZoomTo) {
|
||||
this.initZoomTo = initZoomTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the data panel open handler.
|
||||
*
|
||||
* @param dataPanelOpenHandler the new data panel open handler
|
||||
*/
|
||||
public void setDataPanelOpenHandler(DataPanelOpenListener dataPanelOpenHandler) {
|
||||
this.dataPanelOpenHandler = dataPanelOpenHandler;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ import com.google.gwt.user.client.Window;
|
|||
import com.google.gwt.user.client.ui.DockPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class OpenLayersMap.
|
||||
*
|
||||
|
@ -259,7 +260,7 @@ public class OpenLayersMap {
|
|||
|
||||
@Override
|
||||
public void execute() {
|
||||
GWT.log("Centering on Italy");
|
||||
GWT.log("Centering on: "+centerMapTo);
|
||||
//map.setCenter(new LonLat(12.45, 42.98), 6);
|
||||
if(initZoomTo!=null)
|
||||
map.setCenter(centerMapTo,initZoomTo);
|
||||
|
@ -268,8 +269,6 @@ public class OpenLayersMap {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1143,4 +1142,30 @@ public class OpenLayersMap {
|
|||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the zoom level.
|
||||
*
|
||||
* @param zoomLevel the new zoom level
|
||||
*/
|
||||
public void setZoomLevel(int zoomLevel) {
|
||||
GWT.log("setting zoom at: "+zoomLevel);
|
||||
if(zoomLevel>0 && zoomLevel<numZoomLevels+1) {
|
||||
map.zoomTo(zoomLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the center at.
|
||||
*
|
||||
* @param lonLat the new center at
|
||||
*/
|
||||
public void setCenterAt(LonLat lonLat) {
|
||||
GWT.log("setting center at: "+lonLat);
|
||||
if(lonLat!=null) {
|
||||
map.setCenter(lonLat);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue