diff gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/MapOutputTab.java @ 9561:5397555d74c9

MapOutputTab fix
author gernotbelger
date Thu, 25 Oct 2018 17:00:58 +0200
parents 992c188b7330
children
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/MapOutputTab.java	Thu Oct 25 09:38:11 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/MapOutputTab.java	Thu Oct 25 17:00:58 2018 +0200
@@ -97,6 +97,8 @@
     protected AbsolutePanel absPan = new AbsolutePanel();
     protected FloodMap floodMap;
 
+    private boolean cancel = false;
+
     private final java.util.Map<String, String> wmsUrls = new HashMap<String, String>();
 
     public MapOutputTab(final String title, final Collection collection, final OutputMode mode, final CollectionView collectionView) {
@@ -114,26 +116,37 @@
             public void onSuccess(final MapConfig c) {
                 GWT.log("MAP SUCCESS!");
 
-                final Bounds max = boundsFromString(c.getMaxExtent());
-                Bounds initial = boundsFromString(c.getInitialExtent());
-
-                if (initial == null) {
-                    GWT.log("Warning: No initial extent set.");
-                    initial = max;
-                }
+                if (!MapOutputTab.this.cancel) {
+                    final Bounds max = boundsFromString(c.getMaxExtent());
+                    Bounds initial = boundsFromString(c.getInitialExtent());
 
-                setFloodmap(new FloodMap(c.getSrid(), max, 640, 480));
+                    if (initial == null) {
+                        GWT.log("Warning: No initial extent set.");
+                        initial = max;
+                    }
 
-                initLayout();
-                initBarriers();
+                    setFloodmap(new FloodMap(c.getSrid(), max, 640, 480));
 
-                GWT.log("MAX EXTENT: " + max);
-                GWT.log("ZOOM TO: " + initial);
-                getMap().zoomToExtent(initial);
+                    initLayout();
+
+                    initBarriers();
+
+                    GWT.log("MAX EXTENT: " + max);
+                    GWT.log("ZOOM TO: " + initial);
+                    getMap().zoomToExtent(initial);
+                }
             }
         });
     }
 
+    public void cancelMapService() {
+
+        this.cancel = true;
+
+        // if (this.floodMap != null)
+        // this.floodMap.destroy();
+    }
+
     protected void initLayout() {
         this.rootLayout.setHeight100();
         this.rootLayout.setWidth100();

http://dive4elements.wald.intevation.org