← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5706: Misc minor GIS bug fixes.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5706 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-01-11 15:51:00 +0100
message:
  Misc minor GIS bug fixes.
modified:
  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/resources/mapfish/core/GeoStat.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js	2011-12-09 14:32:33 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js	2012-01-11 14:48:47 +0000
@@ -101,7 +101,7 @@
         G.vars.activeWidget.featureStorage = this.layer.features.slice(0);
         this.requestSuccess(request);
         
-        G.vars.activeWidget.classify();
+        G.vars.activeWidget.classify(false, false, true);
     },
 
     onSuccess2: function(request) {
@@ -113,15 +113,17 @@
         if (doc.length && G.vars.activeWidget != symbol) {
             doc = G.util.geoJsonDecode(doc);
         }
-        
         var format = this.format || new OpenLayers.Format.GeoJSON();
         this.layer.removeFeatures(this.layer.features);
         
-		for (var i = 0, a = null, p = null, geo = format.read(doc); i < geo.length; i++) {
-			p = G.util.getTransformedPoint(geo[i].geometry.getCentroid());
-			geo[i] = new OpenLayers.Feature.Vector(p, geo[i].attributes);;
+        var geo = format.read(doc);
+		for (var i = 0; i < geo.length; i++) {
+            var c = geo[i].geometry.getCentroid();
+            if (c instanceof Object) {
+                var p = G.util.getTransformedPoint(c);
+                geo[i] = new OpenLayers.Feature.Vector(p, geo[i].attributes);
+            }
 		}
-		
         this.layer.addFeatures(geo);
         G.vars.activeWidget.featureStorage = this.layer.features.slice(0);
         this.requestSuccess(request);
@@ -129,7 +131,7 @@
 		if (!G.vars.activeWidget.formValidation.validateForm.call(G.vars.activeWidget)) {
 			G.vars.mask.hide();
 		}
-		G.vars.activeWidget.classify();
+		G.vars.activeWidget.classify(false, false, true);
     },
 
     onFailure: function(request) {

=== 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-12-25 16:31:14 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js	2012-01-11 14:42:53 +0000
@@ -1022,10 +1022,10 @@
 	},
     
     loadGeoJson: function() {
-        G.vars.mask.msg = G.i18n.loading_geojson;
+        G.vars.mask.msg = G.i18n.loading;
         G.vars.mask.show();
         G.vars.activeWidget = this;
-        this.updateValues = true;
+        this.updateValues = false;
         
         var url = G.conf.path_mapping + 'getGeoJsonWithValues.action?' + 
             'periodId=' + this.cmp.period.getValue() +
@@ -1035,12 +1035,13 @@
         this.setUrl(url);
     },
 
-    classify: function(exception, lockPosition) {
+    classify: function(exception, lockPosition, loaded) {
         if (this.formValidation.validateForm.apply(this, [exception])) {
-            if (!this.layer.features.length) {
+            if (!this.layer.features.length && !loaded) {
                 this.loadGeoJson();
             }
-            G.vars.mask.msg = G.i18n.aggregating_map_values;
+            
+            G.vars.mask.msg = G.i18n.loading;
             G.vars.mask.show();
             
             G.vars.lockPosition = lockPosition;
@@ -1076,9 +1077,10 @@
                             Ext.message.msg(false, G.i18n.current_selection_no_data);
                             G.vars.mask.hide();
                             return;
-                        }
+                        }                            
                         
                         for (var i = 0; i < this.layer.features.length; i++) {
+                            this.layer.features[i].attributes.value = 0;
                             for (var j = 0; j < mapvalues.length; j++) {
                                 if (this.layer.features[i].attributes.id == mapvalues[j].oi) {
                                     this.layer.features[i].attributes.value = parseFloat(mapvalues[j].v);

=== 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-12-25 16:31:14 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2012-01-11 14:42:53 +0000
@@ -1665,9 +1665,9 @@
         this.setUrl(url);
     },
 
-    classify: function(exception, lockPosition) {
+    classify: function(exception, lockPosition, loaded) {
         if (this.formValidation.validateForm.apply(this, [exception])) {
-            if (!this.layer.features.length) {
+            if (!this.layer.features.length && !loaded) {
                 this.loadGeoJson();
             }
             
@@ -1710,6 +1710,7 @@
                         }
                         
                         for (var i = 0; i < this.layer.features.length; i++) {
+                            this.layer.features[i].attributes.value = 0;
                             for (var j = 0; j < mapvalues.length; j++) {
                                 if (this.layer.features[i].attributes.id == mapvalues[j].oi) {
                                     this.layer.features[i].attributes.value = parseFloat(mapvalues[j].v);

=== 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-12-25 16:31:14 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js	2012-01-11 14:42:53 +0000
@@ -1665,9 +1665,9 @@
         this.setUrl(url);
     },
 
-    classify: function(exception, lockPosition) {
+    classify: function(exception, lockPosition, loaded) {
         if (this.formValidation.validateForm.apply(this, [exception])) {
-            if (!this.layer.features.length) {
+            if (!this.layer.features.length && !loaded) {
                 this.loadGeoJson();
             }
             
@@ -1710,6 +1710,7 @@
                         }
                         
                         for (var i = 0; i < this.layer.features.length; i++) {
+                            this.layer.features[i].attributes.value = 0;
                             for (var j = 0; j < mapvalues.length; j++) {
                                 if (this.layer.features[i].attributes.id == mapvalues[j].oi) {
                                     this.layer.features[i].attributes.value = parseFloat(mapvalues[j].v);

=== 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-12-25 16:31:14 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js	2012-01-11 14:42:53 +0000
@@ -804,9 +804,9 @@
         );
     },
 
-    classify: function(exception, lockPosition) {
+    classify: function(exception, lockPosition, loaded) {
         if (this.formValidation.validateForm.apply(this, [exception])) {
-            if (!this.layer.features.length) {
+            if (!this.layer.features.length && !loaded) {
                 this.loadGeoJson();
             }