← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2000: (GIS) Fixed bug: Image exported without legend.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2000 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-11-05 13:44:46 +0100
message:
  (GIS) Fixed bug: Image exported without legend.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js
  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/core/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/globals.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js	2010-10-29 14:27:36 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js	2010-11-05 12:43:26 +0000
@@ -245,7 +245,7 @@
     },
 
     getLegendsJSON: function() {
-        var widget = GLOBALS.vars.activePanel == GLOBALS.conf.thematicMap ? choropleth : proportionalSymbol;
+        var widget = GLOBALS.vars.activePanel.isPolygon() ? choropleth : proportionalSymbol;
         var json = '{';
         json += '"legends":';
         json += '[';

=== 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-11-03 14:39:18 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-11-05 12:43:26 +0000
@@ -656,7 +656,7 @@
 				mode: 'local',
 				triggerAction: 'all',
 				value: 1,
-				store: new Ext.data.SimpleStore({
+				store: new Ext.data.ArrayStore({
 					fields: ['id', 'text'],
 					data: [[1, i18n_medium], [2, i18n_large]]
 				})					
@@ -705,7 +705,7 @@
                         var title = Ext.getCmp('exportimagetitle_tf').getValue();
                     	
                         if (!title) {
-                            Ext.message.msg(false, i18n_please_enter_map_title );
+                            Ext.message.msg(false, i18n_please_enter_map_title);
                         }
                         else {
                             var q = Ext.getCmp('exportimagequality_cb').getValue();
@@ -726,7 +726,7 @@
                             document.getElementById('heightField').value = h;  
                             document.getElementById('includeLegendsField').value = includeLegend;  
                             document.getElementById('periodField').value = period;  
-                            document.getElementById('indicatorField').value = vcb; 
+                            document.getElementById('indicatorField').value = vcb;
                             document.getElementById('legendsField').value = GLOBALS.util.getLegendsJSON();
 
                             exportForm.submit();

=== 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-10-29 14:27:36 +0000
+++ 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
@@ -240,7 +240,7 @@
 
         binCount[nbBins - 1] = this.nbVal - mapfish.Util.sum(binCount);
 		
-		var imageLegend = new Array();
+		var imageLegend = [];
         var maxDec = 0;
         
         for (var i = 0; i < bounds.length; i++) {
@@ -254,7 +254,7 @@
             bins[i] = new mapfish.GeoStat.Bin(binCount[i], bounds[i], bounds[i + 1], i == (nbBins - 1));
             var labelGenerator = this.labelGenerator || this.defaultLabelGenerator;
             bins[i].label = labelGenerator(bins[i], i, nbBins, maxDec);
-			imageLegend[i] = new Object();
+			imageLegend[i] = {};
 			imageLegend[i].label = bins[i].label.replace('&nbsp;&nbsp;', ' ');
         }
         

=== 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-10-29 14:27:36 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js	2010-11-05 12:43:26 +0000
@@ -57,16 +57,29 @@
             GLOBALS.conf.map_legend_type_automatic : GLOBALS.vars.activePanel.isPolygon() ?
                 Ext.getCmp('maplegendtype_cb').getValue() : Ext.getCmp('maplegendtype_cb2').getValue();
 		
-		if (mapLegendType == GLOBALS.conf.map_legend_type_automatic) {
-			this.colorInterpolation = choropleth.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors);
+		// if (mapLegendType == GLOBALS.conf.map_legend_type_automatic) {
+			// this.colorInterpolation = choropleth.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors);
+            // for (var i = 0; i < choropleth.imageLegend.length && i < this.colorInterpolation.length; i++) {
+                // choropleth.imageLegend[i].color = this.colorInterpolation[i].toHexString();
+            // }
+		// }
+		// else if (mapLegendType == GLOBALS.conf.map_legend_type_predefined) {
+			// this.colorInterpolation = choropleth.colorInterpolation;
+            // for (var i = 0; i < choropleth.imageLegend.length && i < choropleth.colorInterpolation.length; i++) {
+                // choropleth.imageLegend[i].color = choropleth.colorInterpolation[i].toHexString();
+            // }
+		// }
+        
+        if (mapLegendType == GLOBALS.conf.map_legend_type_automatic) {
+			this.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors);
             for (var i = 0; i < choropleth.imageLegend.length && i < this.colorInterpolation.length; i++) {
                 choropleth.imageLegend[i].color = this.colorInterpolation[i].toHexString();
             }
 		}
 		else if (mapLegendType == GLOBALS.conf.map_legend_type_predefined) {
 			this.colorInterpolation = choropleth.colorInterpolation;
-            for (var i = 0; i < choropleth.imageLegend.length && i < choropleth.colorInterpolation.length; i++) {
-                choropleth.imageLegend[i].color = choropleth.colorInterpolation[i].toHexString();
+            for (var i = 0; i < choropleth.imageLegend.length && i < this.colorInterpolation.length; i++) {
+                choropleth.imageLegend[i].color = this.colorInterpolation[i].toHexString();
             }
 		}
     },