diff --git a/.classpath b/.classpath index 573f832..d64a991 100644 --- a/.classpath +++ b/.classpath @@ -14,9 +14,9 @@ - + - + @@ -25,9 +25,9 @@ - + - + diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index a11eb3f..308dde3 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -3,7 +3,7 @@ - + uses diff --git a/pom.xml b/pom.xml index 11f9b3b..64f8f3e 100644 --- a/pom.xml +++ b/pom.xml @@ -135,6 +135,8 @@ GisViewerApp.html ${webappDirectory} + + @@ -153,8 +155,8 @@ ${webappDirectory} - - + + lib diff --git a/src/main/java/org/gcube/portlets/user/gisviewerapp/client/ApplicationController.java b/src/main/java/org/gcube/portlets/user/gisviewerapp/client/ApplicationController.java index 976dcfb..d1ac322 100644 --- a/src/main/java/org/gcube/portlets/user/gisviewerapp/client/ApplicationController.java +++ b/src/main/java/org/gcube/portlets/user/gisviewerapp/client/ApplicationController.java @@ -96,8 +96,10 @@ public class ApplicationController implements WmsDialogHandler{ @Override protected void onExpand() { super.onExpand(); + if (gisViewerPanel!=null) gisViewerPanel.updateOpenLayersSize(); + // resizeBar.show(); } @@ -134,9 +136,7 @@ public class ApplicationController implements WmsDialogHandler{ // ConstantGisViewerApp.logger.log(Level.INFO, "Replacing all "+replacement); // wmsRequest = wmsRequest.replaceAll(replacement, wmsRequest); // } - - - + try { wmsRequestConverter.parseRequest(wmsRequest,null); wmsRequestConverter.addRequestToGisViewer(); @@ -185,12 +185,31 @@ public class ApplicationController implements WmsDialogHandler{ public GisViewerPanel getGisViewerPanel() { return gisViewerPanel; } + + /** + * Sets the new position. + * + * @param scrollTop the scroll top + * @param left the left + * @param height the height + */ + public void setWMSBalloonPosition(int scrollTop, int left, int height){ +// GWT.log("height: "+height +" scrollTop: "+scrollTop); + scrollTop= scrollTop>0?scrollTop:1; + height = height>0?height:1; + int newPosition = scrollTop+height; +// GWT.log("new position: "+newPosition); + baloonWMS.setVisible(false); + baloonWMS.show(); + baloonWMS.setPopupPosition(left>0?left:1, newPosition-35); + baloonWMS.setVisible(true); + } /** - * + * @return the baloonWMS */ - public void moveWMSBalloon() { - baloonWMS.showRelativeTo(lcWMS); + public BaloonPanel getBaloonWMS() { + return baloonWMS; } /* (non-Javadoc) diff --git a/src/main/java/org/gcube/portlets/user/gisviewerapp/client/GisViewerApp.java b/src/main/java/org/gcube/portlets/user/gisviewerapp/client/GisViewerApp.java index a0c76f0..a7b431e 100644 --- a/src/main/java/org/gcube/portlets/user/gisviewerapp/client/GisViewerApp.java +++ b/src/main/java/org/gcube/portlets/user/gisviewerapp/client/GisViewerApp.java @@ -39,16 +39,19 @@ public class GisViewerApp implements EntryPoint { options.setDisplayInLayerSwitcher(true); options.setIsBaseLayer(true); + String name = "MapBox"; String url = "https://b.tiles.mapbox.com/v4/examples.map-2k9d7u0c/${z}/${x}/${y}.png?access_token=pk.eyJ1IjoidHJpc3RlbiIsImEiOiJiUzBYOEJzIn0.VyXs9qNWgTfABLzSI3YcrQ"; XYZ layer = new XYZ(name, url, options); - - MapWidget widget = appController.getGisViewerPanel().getOpenLayersMap().getMapWidget(); - widget.getMap().addLayer(layer); - */ - - /* - OSMOptions options = new OSMOptions(); + + MapWidget mapWidget = appController.getGisViewerPanel().getOpenLayersMap().getMapWidget(); + LonLat lonLat = new LonLat(6.95, 50.94); + lonLat.transform("EPSG:4326", "EPSG:900913"); + mapWidget.getMap().addLayer(layer); + mapWidget.getMap().setCenter(lonLat);*/ + + + /* OSMOptions options = new OSMOptions(); options.setNumZoomLevels(Constants.numZoomLevels); options.setProjection(Constants.defaultProjection); options.crossOriginFix(); @@ -64,7 +67,23 @@ public class GisViewerApp implements EntryPoint { OSM osm3 = new OSM("OSM Humaritarian","http://b.tile.openstreetmap.fr/hot/${z}/${x}/${y}.png", options); osm3.setIsBaseLayer(true); - mapWdg.getMap().addLayer(osm3); + mapWdg.getMap().addLayer(osm3);*/ + + /* + OSM osmMapnik = OSM.Mapnik("Mapnik"); + OSM osmCycle = OSM.CycleMap("CycleMap"); + + osmMapnik.setIsBaseLayer(true); + osmCycle.setIsBaseLayer(true); + + MapWidget mapWidget = appController.getGisViewerPanel().getOpenLayersMap().getMapWidget(); + + mapWidget.getMap().addLayer(osmMapnik); + mapWidget.getMap().addLayer(osmCycle); + + LonLat lonLat = new LonLat(6.95, 50.94); + lonLat.transform("EPSG:4326", mapWidget.getMap().getProjection()); //transform lonlat (provided in EPSG:4326) to OSM coordinate system (the map projection) + mapWidget.getMap().setCenter(lonLat, Constants.numZoomLevels); */ appController.getGisViewerPanel().showIntro(); @@ -76,24 +95,24 @@ public class GisViewerApp implements EntryPoint { public void updateSize(){ RootPanel workspace = RootPanel.get(GISVIEWERAPPDIV); - int topBorder = workspace.getAbsoluteTop(); - int leftBorder = workspace.getAbsoluteLeft(); - int footer = 2; //footer is bottombar + sponsor - int rootHeight = (Window.getClientHeight() - topBorder - 4 - footer);// - ((footer == null)?0:(footer.getOffsetHeight()-15)); - -// if (rootHeight < 550) -// rootHeight = 550; - int rootWidth = Window.getClientWidth() - 2* leftBorder; //- rightScrollBar; System.out.println("New workspace dimension Height: "+rootHeight+" Width: "+rootWidth); appController.getMainPanel().setHeight(rootHeight); appController.getMainPanel().setWidth(rootWidth); - appController.moveWMSBalloon(); + + appController.getBaloonWMS().hide(); + int scroll = Window.getScrollTop(); + int left = Window.getScrollLeft(); + int height = Window.getClientHeight(); +// GWT.log("onResize height: "+Window.getClientHeight()); + appController.setWMSBalloonPosition(scroll, left, height); + +// appController.getGisViewerPanel().getOpenLayersMap().centerMapCurrentZoom(); } }