← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1913: (GIS) SelectFeature activation/deactivation behaviour improved.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 1913 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-05-27 12:03:09 +0200
message:
  (GIS) SelectFeature activation/deactivation behaviour improved.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-05-26 17:48:44 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-05-27 09:51:44 +0000
@@ -3263,13 +3263,28 @@
 	MAP.setCenter(new OpenLayers.LonLat(BASECOORDINATE.longitude, BASECOORDINATE.latitude), 6);
     
 	MAP.events.on({
-        changelayer: function(e) {
-            if (e.property == 'visibility' && e.layer != choroplethLayer ) {
+        changelayer: function(e) {
+            var isOverlay = false;
+            for (var i = 0; i < mapLayerStore.getTotalCount(); i++) {
+                if (mapLayerStore.getAt(i).data.name == e.layer.name) {
+                    isOverlay = true;
+                }
+            }
+            
+            var activeOverlays = false;
+            if (e.property == 'visibility' && isOverlay ) {
                 if (e.layer.visibility) {
                     selectFeatureChoropleth.deactivate();
                 }
-                else {
-                    selectFeatureChoropleth.activate();
+                else {
+                    for (var i = 0; i < mapLayerStore.getTotalCount(); i++) {
+                        if (MAP.getLayersByName(mapLayerStore.getAt(i).data.name)[0].visibility) {
+                            activeOverlays = true;
+                        }
+                    }
+                    if (!activeOverlays) {
+                        selectFeatureChoropleth.activate();
+                    }
                 }
             }
         }