[Dive4elements-commits] [PATCH] Hopefully fix for some map resizing issues

Wald Commits scm-commit at wald.intevation.org
Tue Apr 9 15:32:52 CEST 2013


# HG changeset patch
# User Christian Lins <christian.lins at intevation.de>
# Date 1365514366 -7200
# Node ID 4f935415bb205e1d7ec13be113b80628800c9f1d
# Parent  17e2324c760e23a1224c9a627add203dbedbe436
Hopefully fix for some map resizing issues.

diff -r 17e2324c760e -r 4f935415bb20 flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java	Tue Apr 09 15:14:15 2013 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java	Tue Apr 09 15:32:46 2013 +0200
@@ -2,7 +2,6 @@
 
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.rpc.AsyncCallback;
-
 import com.smartgwt.client.types.VerticalAlignment;
 import com.smartgwt.client.util.SC;
 import com.smartgwt.client.widgets.Canvas;
@@ -35,6 +34,7 @@
 
 import org.gwtopenmaps.openlayers.client.Map;
 import org.gwtopenmaps.openlayers.client.control.Attribution;
+import org.gwtopenmaps.openlayers.client.layer.TransitionEffect;
 import org.gwtopenmaps.openlayers.client.layer.WMS;
 import org.gwtopenmaps.openlayers.client.layer.WMSOptions;
 import org.gwtopenmaps.openlayers.client.layer.WMSParams;
@@ -63,7 +63,6 @@
 
     @Override
     public Canvas create(DataList list) {
-        List<Data> data = list.getAll(); // FIXME: data is not used? getAll() side-effects?
         helperContainer.addVisibilityChangedHandler(this);
 
         DataList clone = (DataList) list.clone();
@@ -106,7 +105,7 @@
     protected Canvas createWidget(DataList data) {
         GWT.log("DigitizePanel - createWidget()");
 
-        VLayout layout   = new VLayout();
+        VLayout layout = new VLayout();
         layout.setAlign(VerticalAlignment.TOP);
         layout.setHeight(25);
 
@@ -132,7 +131,7 @@
 
     @Override
     protected Data[] getData() {
-        Data[] total = new Data[1];
+        final Data[] total = new Data[1];
 
         if (floodMap != null) {
             DataItem item = new DefaultDataItem(
@@ -164,6 +163,12 @@
         helperContainer.addParentMovedHandler(new ParentMovedHandler() {
             @Override
             public void onParentMoved(ParentMovedEvent event) {
+                mapPanel.getFloodMap().updateSize();
+            }
+        });
+        helperContainer.addVisibilityChangedHandler(new VisibilityChangedHandler() {
+            @Override
+            public void onVisibilityChanged(VisibilityChangedEvent event) {
                 mapPanel.doLayout(helperContainer.getWidth(), helperContainer.getHeight());
             }
         });
@@ -173,10 +178,10 @@
 
         WMS axis = getLayer(
             mapInfo.getWmsUrl(), mapInfo.getWmsLayers(),
-            mapInfo.getProjection(), false);
+            mapInfo.getProjection(), false, true);
         WMS back = getLayer(
             mapInfo.getBackgroundWmsUrl(), mapInfo.getBackgroundWmsLayers(),
-            mapInfo.getProjection(), false);
+            mapInfo.getProjection(), false, false);
 
         map.addLayer(back);
         map.addLayer(axis);
@@ -188,7 +193,7 @@
                 mapInfo.getWmsUrl().replace("river", "user"),
                 "ms_layer-hws-lines" + artifact.getUuid(),
                 mapInfo.getProjection(),
-                false);
+                false, true);
             map.addLayer(hwsLayer);
         }
         String userRgd = getDataValue("state.winfo.uesk.user-rgd", "uesk.user-rgd");
@@ -198,31 +203,34 @@
                 mapInfo.getWmsUrl().replace("river", "user"),
                 "ms_layer-user-rgd" + artifact.getUuid(),
                 mapInfo.getProjection(),
-                false);
+                false, true);
             map.addLayer(userLayer);
         }
         map.addControl(new Attribution());
         map.zoomToMaxExtent();
+
+        mapPanel.doLayout(helperContainer.getWidth(), helperContainer.getHeight());
     }
 
 
-    protected WMS getLayer(String url, String layers, String proj, boolean x) {
-        WMSParams params = new WMSParams();
+    protected WMS getLayer(String url, String layers, String proj, boolean isBaseLayer, boolean singleTiled) {
+        final WMSParams params = new WMSParams();
         params.setLayers(layers);
         params.setFormat("image/png");
-        params.setIsTransparent(!x);
+        params.setIsTransparent(!isBaseLayer);
 
-        WMSOptions opts = new WMSOptions();
+        final WMSOptions opts = new WMSOptions();
         opts.setProjection(proj);
-        opts.setSingleTile(true);
+        opts.setSingleTile(false); // FIXME: Make working...
+        opts.setTransitionEffect(TransitionEffect.RESIZE);
         opts.setRatio(1);
         opts.setBuffer(0);
         if (layers.equals("OSM-WMS-Dienst")) {
             opts.setAttribution(MSG.attribution());
         }
-        WMS wms = new WMS(layers, url, params, opts);
+        final WMS wms = new WMS(layers, url, params, opts);
         wms.setIsVisible(true);
-        wms.setIsBaseLayer(x);
+        wms.setIsBaseLayer(isBaseLayer);
 
         return wms;
     }
diff -r 17e2324c760e -r 4f935415bb20 flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java	Tue Apr 09 15:14:15 2013 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java	Tue Apr 09 15:32:46 2013 +0200
@@ -303,8 +303,11 @@
         for (final Layer l: layers) {
             l.redraw();
         }
+    }
 
-        getBarrierLayer(); // Raises Z-Index to 1000 again
+
+    public void updateSize() {
+        this.map.updateSize();
     }
 
 
diff -r 17e2324c760e -r 4f935415bb20 flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java	Tue Apr 09 15:14:15 2013 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java	Tue Apr 09 15:32:46 2013 +0200
@@ -3,7 +3,6 @@
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 import com.google.gwt.user.client.ui.AbsolutePanel;
-
 import com.smartgwt.client.util.SC;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.events.ParentMovedEvent;
@@ -57,6 +56,7 @@
 import org.gwtopenmaps.openlayers.client.feature.VectorFeature;
 import org.gwtopenmaps.openlayers.client.format.GeoJSON;
 import org.gwtopenmaps.openlayers.client.layer.Layer;
+import org.gwtopenmaps.openlayers.client.layer.TransitionEffect;
 import org.gwtopenmaps.openlayers.client.layer.Vector;
 import org.gwtopenmaps.openlayers.client.layer.WMS;
 import org.gwtopenmaps.openlayers.client.layer.WMSOptions;
@@ -146,7 +146,7 @@
         rootLayout.setWidth100();
         rootLayout.setMembersMargin(2);
 
-        final HLayout hlayout = new HLayout();
+        HLayout hlayout = new HLayout();
         hlayout.setMembersMargin(0);
 
         this.themePanelCanvas = createThemePanel();
@@ -467,6 +467,8 @@
         opts.setRatio(1);
         if (layers.equals("OSM-WMS-Dienst")) {
             opts.setAttribution(MSG.attribution());
+            opts.setSingleTile(true);
+            opts.setTransitionEffect(TransitionEffect.RESIZE);
         }
         WMS wms = new WMS(layers, url, params, opts);
         wms.setIsVisible(at.getActive() == 1);
@@ -580,7 +582,7 @@
             new DataItem[] {item} );
 
         Config config       = Config.getInstance();
-        final String locale = config.getLocale();
+        String locale = config.getLocale();
 
         feedService.go(locale, getArtifact(), new Data[] { data },
             new AsyncCallback<Artifact>() {


More information about the Dive4elements-commits mailing list