← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4400: Zoom to visible extent function improved.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 4400 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-08-20 14:06:26 +0200
message:
  Zoom to visible extent function improved.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.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/javascript/global.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js	2011-08-20 02:34:06 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js	2011-08-20 12:01:15 +0000
@@ -427,11 +427,11 @@
         return layers;
     },
     
-    zoomToVisibleExtent: function(lockPosition) {
-        if (!lockPosition) {
+    zoomToVisibleExtent: function() {
+        if (!G.vars.lockPosition) {
             var bounds = [];
-            var layers = this.getLayersByType(G.conf.map_layer_type_thematic);
             
+            var layers = this.getLayersByType(G.conf.map_layer_type_thematic);            
             for (var i = 0; i < layers.length; i++) {
                 if (layers[i].getDataExtent() && layers[i].visibility) {
                     bounds.push(layers[i].getDataExtent());
@@ -546,6 +546,8 @@
     
     activeWidget: null,
     
+    lockPosition: false,
+    
     relocate: {},
     
     mouseMove: {}

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js	2011-08-20 02:24:53 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js	2011-08-20 12:01:15 +0000
@@ -166,6 +166,8 @@
         this.layer.redraw();
         this.updateLegend();
         this.layer.setVisibility(true);
+        
+        G.util.zoomToVisibleExtent();
     },
 
     showDetails: function(obj) {},

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js	2011-08-20 02:34:06 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js	2011-08-20 12:01:15 +0000
@@ -1073,15 +1073,13 @@
             G.vars.mask.msg = G.i18n.aggregating_map_values;
             G.vars.mask.show();
             
-            G.util.zoomToVisibleExtent(lockPosition);
+            G.vars.lockPosition = lockPosition;
             
             if (this.mapView) {
                 if (this.mapView.longitude && this.mapView.latitude && this.mapView.zoom) {
                     var point = G.util.getTransformedPointByXY(this.mapView.longitude, this.mapView.latitude);
                     G.vars.map.setCenter(new OpenLayers.LonLat(point.x, point.y), this.mapView.zoom);
-                }
-                else {
-                    G.util.zoomToVisibleExtent();
+                    G.vars.lockPosition = true;
                 }
                 this.mapView = false;
             }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2011-08-20 02:34:06 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2011-08-20 12:01:15 +0000
@@ -1689,15 +1689,13 @@
             G.vars.mask.msg = G.i18n.aggregating_map_values;
             G.vars.mask.show();
             
-            G.util.zoomToVisibleExtent(lockPosition);
+            G.vars.lockPosition = lockPosition;
             
             if (this.mapView) {
                 if (this.mapView.longitude && this.mapView.latitude && this.mapView.zoom) {
                     var point = G.util.getTransformedPointByXY(this.mapView.longitude, this.mapView.latitude);
                     G.vars.map.setCenter(new OpenLayers.LonLat(point.x, point.y), this.mapView.zoom);
-                }
-                else {
-                    G.util.zoomToVisibleExtent();
+                    G.vars.lockPosition = true;
                 }
                 this.mapView = false;
             }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js	2011-08-20 02:34:06 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js	2011-08-20 12:01:15 +0000
@@ -1689,15 +1689,13 @@
             G.vars.mask.msg = G.i18n.aggregating_map_values;
             G.vars.mask.show();
             
-            G.util.zoomToVisibleExtent(lockPosition);
+            G.vars.lockPosition = lockPosition;
             
             if (this.mapView) {
                 if (this.mapView.longitude && this.mapView.latitude && this.mapView.zoom) {
                     var point = G.util.getTransformedPointByXY(this.mapView.longitude, this.mapView.latitude);
                     G.vars.map.setCenter(new OpenLayers.LonLat(point.x, point.y), this.mapView.zoom);
-                }
-                else {
-                    G.util.zoomToVisibleExtent();
+                    G.vars.lockPosition = true;
                 }
                 this.mapView = false;
             }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js	2011-08-20 02:34:06 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js	2011-08-20 12:01:15 +0000
@@ -759,7 +759,8 @@
 
     classify: function(exception, lockPosition) {
         if (this.formValidation.validateForm.apply(this, [exception])) {
-            G.util.zoomToVisibleExtent(lockPosition);
+            
+            G.vars.lockPosition = lockPosition;
             
             for (var i = 0; i < this.layer.features.length; i++) {
                 this.layer.features[i].attributes.labelString = this.layer.features[i].attributes.name;