← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2012: Fixed bug: With predefined legend some value combinations could cause a crash.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2012 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-11-08 19:20:30 +0100
message:
  Fixed bug: With predefined legend some value combinations could cause a crash.
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/core/GeoStat/Choropleth.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.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	2010-11-05 12:43:26 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js	2010-11-08 18:16:24 +0000
@@ -308,9 +308,8 @@
 	
     classify: function(method, nbBins, bounds) {
         var mlt = GLOBALS.vars.activePanel.isPolygon() ?
-            choropleth.legend.type : GLOBALS.vars.activePanel.isPoint() ?
-                proportionalSymbol.legend.type : GLOBALS.vars.activePanel.isAssignment() ?
-                    GLOBALS.conf.map_legend_type_automatic : GLOBALS.conf.map_legend_type_automatic;
+            choropleth.legend.value : GLOBALS.vars.activePanel.isPoint() ?
+                proportionalSymbol.legend.value : GLOBALS.conf.map_legend_type_automatic;
     
 		if (mlt == GLOBALS.conf.map_legend_type_automatic) {
 			if (method == mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS) {

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js	2010-11-05 13:16:45 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js	2010-11-08 18:16:24 +0000
@@ -54,8 +54,7 @@
         var initialColors = this.colors;
         var numColors = this.classification.bins.length;
 		var mapLegendType = GLOBALS.vars.activePanel.isAssignment() ?
-            GLOBALS.conf.map_legend_type_automatic : GLOBALS.vars.activePanel.isPolygon() ?
-                Ext.getCmp('maplegendtype_cb').getValue() : Ext.getCmp('maplegendtype_cb2').getValue();
+            GLOBALS.conf.map_legend_type_automatic : Ext.getCmp('maplegendtype_cb').getValue();
         
         if (mapLegendType == GLOBALS.conf.map_legend_type_automatic) {
 			this.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors);

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js	2010-10-29 14:27:36 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js	2010-11-08 18:16:24 +0000
@@ -61,19 +61,18 @@
     createColorInterpolation: function() {
         var initialColors = this.colors;
         var numColors = this.classification.bins.length;
-		var mapLegendType = GLOBALS.vars.activePanel.isAssignment() ?
-            GLOBALS.conf.map_legend_type_automatic : Ext.getCmp('maplegendtype_cb2').getValue();
+		var mapLegendType = Ext.getCmp('maplegendtype_cb2').getValue();        
 		
 		if (mapLegendType == GLOBALS.conf.map_legend_type_automatic) {
-			this.colorInterpolation = proportionalSymbol.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors);
+			this.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors);
 			for (var i = 0; i < proportionalSymbol.imageLegend.length && i < this.colorInterpolation.length; i++) {
 				proportionalSymbol.imageLegend[i].color = this.colorInterpolation[i].toHexString();
 			}
 		}
 		else if (mapLegendType == GLOBALS.conf.map_legend_type_predefined) {
 			this.colorInterpolation = proportionalSymbol.colorInterpolation;
-			for (var i = 0; i < proportionalSymbol.imageLegend.length && i < proportionalSymbol.colorInterpolation.length; i++) {
-				proportionalSymbol.imageLegend[i].color = proportionalSymbol.colorInterpolation[i].toHexString();
+			for (var i = 0; i < proportionalSymbol.imageLegend.length && i < this.colorInterpolation.length; i++) {
+				proportionalSymbol.imageLegend[i].color = this.colorInterpolation[i].toHexString();
 			}
 		}
     },
@@ -82,8 +81,8 @@
         var values = [];
 
         for (var i = 0; i < this.layer.features.length; i++) {
-           // values.push(this.layer.features[i].attributes[this.colorIndicator]);
-           values.push(this.layer.features[i].attributes.value);
+            // values.push(this.layer.features[i].attributes[this.colorIndicator]);
+            values.push(this.layer.features[i].attributes.value);
         }
         
         var distOptions = {
@@ -116,9 +115,9 @@
         // this.extendStyle(null,
             // {'pointRadius': '${calculateRadius}'},
             // {'calculateRadius': calculateRadius}
-        // );
+        // );   
     
-        var boundsArray = this.classification.getBoundsArray();         
+        var boundsArray = this.classification.getBoundsArray();        
         var rules = new Array(boundsArray.length-1);
         for (var i = 0; i < boundsArray.length-1; i++) {
             var rule = new OpenLayers.Rule({

=== 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	2010-11-08 17:27:58 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js	2010-11-08 18:16:24 +0000
@@ -1465,7 +1465,7 @@
                     (this.organisationUnitSelectionType.isLevel() ? 'getDataMapValuesByParent' : 'getDataMapValuesByLevel');
             
             var params = {
-                id: this.valueType == GLOBALS.conf.map_value_type_indicator ? Ext.getCmp('indicator_cb2').getValue() : Ext.getCmp('dataelement_cb2').getValue(),
+                id: this.valueType.isIndicator ? Ext.getCmp('indicator_cb2').getValue() : Ext.getCmp('dataelement_cb2').getValue(),
                 periodId: GLOBALS.vars.mapDateType.isFixed() ? Ext.getCmp('period_cb2').getValue() : null,
                 startDate: GLOBALS.vars.mapDateType.isStartEnd() ? new Date(Ext.getCmp('startdate_df2').getValue()).format('Y-m-d') : null,
                 endDate: GLOBALS.vars.mapDateType.isStartEnd() ? new Date(Ext.getCmp('enddate_df2').getValue()).format('Y-m-d') : null,