diff flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java @ 1317:45b9b1fc26e2

Improved error handling while using the elevation control - Make selected features in the map visible. flys-client/trunk@2956 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 13 Oct 2011 10:22:39 +0000
parents cf0f906921de
children 9981ba2ee13a
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java	Thu Oct 13 09:46:03 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java	Thu Oct 13 10:22:39 2011 +0000
@@ -311,15 +311,13 @@
         // still has no selected features.
         opts.onSelect(new SelectFeature.SelectFeatureListener() {
             public void onFeatureSelected(VectorFeature feature) {
-                Attributes attr = feature.getAttributes();
-                attr.setAttribute(FloodMap.MARK_SELECTED, 1);
+                floodMap.selectFeature(feature);
             }
         });
 
         opts.onUnSelect(new SelectFeature.UnselectFeatureListener() {
             public void onFeatureUnselected(VectorFeature feature) {
-                Attributes attr = feature.getAttributes();
-                attr.setAttribute(FloodMap.MARK_SELECTED, 0);
+                floodMap.disableFeature(feature);
             }
         });
 
@@ -337,6 +335,7 @@
 
             public void disable() {
                 activateSelectFeature(false);
+                floodMap.disableFeatures();
             }
         };
 
@@ -386,10 +385,12 @@
                 VectorFeature feature = null;
 
                 if (features == null || features.length == 0) {
-                    SC.warn("No Feature selected!");
+                    SC.warn(MSG.error_no_feature_selected());
                     return;
                 }
 
+                boolean multipleFeatures = false;
+
                 for (VectorFeature f: features) {
                     Attributes attr = f.getAttributes();
                     if (attr.getAttributeAsInt(FloodMap.MARK_SELECTED) == 1) {
@@ -397,12 +398,21 @@
                             feature = f;
                         }
                         else {
-                            SC.warn("More than 1 Feature selected!");
+                            multipleFeatures = true;
                         }
                     }
                 }
 
+                if (feature == null) {
+                    SC.warn(MSG.error_no_feature_selected());
+                    return;
+                }
+
                 new ElevationWindow(floodMap, feature).show();
+
+                if (multipleFeatures) {
+                    SC.warn(MSG.warning_use_first_feature());
+                }
             }
         });
 

http://dive4elements.wald.intevation.org