← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1508: (GIS) Fixed overlapping class breaks and reimplemented the "equal group count" classification met...

 

------------------------------------------------------------
revno: 1508
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-02-25 17:35:57 +0100
message:
  (GIS) Fixed overlapping class breaks and reimplemented the "equal group count" classification method.
modified:
  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/resources/mapfish/core/GeoStat.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.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-02-25 13:42:48 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-02-25 16:35:57 +0000
@@ -259,7 +259,7 @@
         checkedCls: 'x-form-radio-checked'
     });
     
-    document.body.oncontextmenu = function() { return false; };
+//    document.body.oncontextmenu = function() { return false; };
 	
 	Ext.QuickTips.init();
     
@@ -3014,7 +3014,7 @@
 function onHoverSelectChoropleth(feature) {
     if (MAPDATA != null) {
         if (ACTIVEPANEL == 'choropleth') {
-			Ext.getCmp('featureinfo_l').setText('<span style="color:black">' + feature.attributes[MAPDATA.nameColumn] + '</span><br><span style="color:#666">' + feature.attributes.value + '</span>', false);
+			Ext.getCmp('featureinfo_l').setText('<span style="color:black">' + feature.attributes[MAPDATA.nameColumn] + '</span><br><span style="color:#555">' + feature.attributes.value + '</span>', false);
         }
         else if (ACTIVEPANEL == 'mapping') {
 			Ext.getCmp('featureinfo_l').setText('<span style="color:black">' + feature.attributes[MAPDATA.nameColumn] + '</span>', false);

=== 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	2009-10-06 12:09:39 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js	2010-02-25 16:35:57 +0000
@@ -371,11 +371,17 @@
 			}
 		}
 		else {
-			return parseFloat(bin.lowerBound).toFixed(1) + ' - ' + parseFloat(bin.upperBound).toFixed(1) + '&nbsp;&nbsp; ( ' + bin.nbVal + ' )';
+            var upper = parseFloat(bin.upperBound);
+            if (binIndex < nbBins-1) {
+                upper -= parseFloat("0.1");
+            }
+            
+			return parseFloat(bin.lowerBound).toFixed(1) + ' - ' + upper.toFixed(1) + '&nbsp;&nbsp; ( ' + bin.nbVal + ' )';
 		}
     },
 
     classifyWithBounds: function(bounds) {
+
         var bins = [];
         var binCount = [];
         var sortedValues = [];
@@ -436,6 +442,11 @@
             }
             bounds.push(values[values.length - 1]);
         }
+        
+        for (var i = 0; i < bounds.length; i++) {
+            bounds[i] = parseFloat(bounds[i]);
+        }
+
         return this.classifyWithBounds(bounds);
     },
 
@@ -461,8 +472,8 @@
      * {<mapfish.GeoStat.Classification>} Classification
      */
     classify: function(method, nbBins, bounds) {
-    
-        if (method == 0) {
+
+        if (method == mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS) {
             var str = Ext.getCmp('bounds').getValue();
             
             for (var i = 0; i < str.length; i++) {
@@ -492,7 +503,7 @@
                 
                 if (bounds[i] < this.minVal || bounds[i] > this.maxVal)
                 {
-                    Ext.messageRed.msg('Fixed bounds', 'Class breaks must be higher than ' + msg_highlight_start + this.minVal + msg_highlight_end + ' and lower than ' + msg_highlight_start + this.maxVal + msg_highlight_end + '.');
+                    Ext.messageRed.msg('Fixed breaks', 'Class breaks must be higher than ' + msg_highlight_start + this.minVal + msg_highlight_end + ' and lower than ' + msg_highlight_start + this.maxVal + msg_highlight_end + '.');
                 }
             }
 			
@@ -505,7 +516,7 @@
             nbBins = this.sturgesRule();
         }
         switch (method) {
-        case mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS:
+        case mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS :
             classification = this.classifyWithBounds(bounds);
             break;
         case mapfish.GeoStat.Distribution.CLASSIFY_BY_EQUAL_INTERVALS :
@@ -515,7 +526,7 @@
             classification = this.classifyByQuantils(nbBins);
             break;
         default:
-            OpenLayers.Console.error("unsupported or invalid classification method");
+            OpenLayers.Console.error("Unsupported or invalid classification method");
         }
         return classification;
     },

=== 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	2010-02-24 14:11:32 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2010-02-25 16:35:57 +0000
@@ -554,8 +554,8 @@
                 fields: ['value', 'text'],
                 data: [
 					[1, 'Equal intervals'],
-					// [2, 'Distributed values'],
-					[0, 'Fixed bounds']]
+					[2, 'Equal group count'],
+					[0, 'Fixed breaks']]
             }),
             listeners: {
                 'select': {
@@ -603,7 +603,7 @@
             width: combo_width,
             store: new Ext.data.SimpleStore({
                 fields: ['value'],
-                data: [[1], [2], [3], [4], [5], [6], [7], [8]]
+                data: [[1], [2], [3], [4], [5], [6], [7]]
             }),
             listeners: {
                 'select': {