← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4888: (GIS) Predefined legend names included in layer legend panel.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 4888 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-10-10 17:10:00 +0200
message:
  (GIS) Predefined legend names included in layer legend panel.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-0.png
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-1.png
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-2.png
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-3.png
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-4.png
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-5.png
  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/Centroid.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/Point.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


--
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/css/style.css'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css	2011-08-30 14:45:40 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css	2011-10-10 14:37:12 +0000
@@ -553,7 +553,7 @@
     overflow:auto;
 }
 #east {
-    width:200px;
+    width:195px;
 }
 #north {
     padding:2px;

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-0.png'
Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-0.png	2011-07-08 09:25:05 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-0.png	2011-10-10 15:08:48 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-1.png'
Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-1.png	2011-07-13 12:30:32 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-1.png	2011-10-10 15:08:48 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-2.png'
Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-2.png	2011-07-13 12:30:32 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-2.png	2011-10-10 15:08:48 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-3.png'
Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-3.png	2011-07-13 12:30:32 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-3.png	2011-10-10 15:08:48 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-4.png'
Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-4.png	2011-07-13 12:30:32 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-4.png	2011-10-10 15:08:48 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-5.png'
Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-5.png	2011-07-13 12:30:32 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-5.png	2011-10-10 15:08:48 +0000 differ
=== 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-24 11:16:18 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js	2011-10-10 14:37:12 +0000
@@ -199,7 +199,7 @@
     defaultLabelGenerator: function(bin, binIndex, nbBins) {
         lower = parseFloat(bin.lowerBound).toFixed(1);
         upper = parseFloat(bin.upperBound).toFixed(1);
-        return lower + ' - ' + upper + '&nbsp;&nbsp; ( ' + bin.nbVal + ' )';
+        return lower + ' - ' + upper + '&nbsp;&nbsp;' + '(' + bin.nbVal + ')';
     },
 
     classifyWithBounds: function(bounds) {

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Centroid.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Centroid.js	2011-08-19 21:17:43 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Centroid.js	2011-10-10 15:08:48 +0000
@@ -151,13 +151,14 @@
             element.style.backgroundImage = 'url(../resources/ext-ux/iconcombo/' + this.symbolizerInterpolation[i] + '.png)';
             element.style.backgroundRepeat = 'no-repeat';
             element.style.width = "25px";
-            element.style.height = "18px";
+            element.style.height = this.widget.legendNames[i] ? "25px" : "20px";
             element.style.cssFloat = "left";
-            element.style.marginLeft = "3px";
+            element.style.marginRight = "5px";
             this.legendDiv.appendChild(element);
 
             element = document.createElement("div");
-            element.innerHTML = this.classification.bins[i].label;
+            element.style.lineHeight = this.widget.legendNames[i] ? "12px" : "7px";
+            element.innerHTML = '<b style="color:#222">' + this.widget.legendNames[i] + '</b><br/>' + this.classification.bins[i].label;
             this.legendDiv.appendChild(element);
 
             element = document.createElement("div");

=== 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	2011-08-29 15:24:44 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js	2011-10-10 15:08:48 +0000
@@ -157,22 +157,44 @@
         element.style.height = "5px";
         this.legendDiv.appendChild(element);
         
-        for (var i = 0; i < this.classification.bins.length; i++) {
-            var element = document.createElement("div");
-            element.style.backgroundColor = this.colorInterpolation[i].toHexString();
-            element.style.width = "30px";
-            element.style.height = "15px";
-            element.style.cssFloat = "left";
-            element.style.marginRight = "10px";
-            this.legendDiv.appendChild(element);
-
-            element = document.createElement("div");
-            element.innerHTML = this.classification.bins[i].label;
-            this.legendDiv.appendChild(element);
-
-            element = document.createElement("div");
-            element.style.clear = "left";
-            this.legendDiv.appendChild(element);
+        if (G.vars.activeWidget.legend.value == G.conf.map_legendset_type_automatic) {        
+            for (var i = 0; i < this.classification.bins.length; i++) {
+                var element = document.createElement("div");
+                element.style.backgroundColor = this.colorInterpolation[i].toHexString();
+                element.style.width = "30px";
+                element.style.height = "15px";
+                element.style.cssFloat = "left";
+                element.style.marginRight = "8px";
+                this.legendDiv.appendChild(element);
+
+                element = document.createElement("div");
+                element.innerHTML = this.classification.bins[i].label;
+                this.legendDiv.appendChild(element);
+
+                element = document.createElement("div");
+                element.style.clear = "left";
+                this.legendDiv.appendChild(element);
+            }
+        }
+        else if (G.vars.activeWidget.legend.value == G.conf.map_legendset_type_predefined) {        
+            for (var i = 0; i < this.classification.bins.length; i++) {
+                var element = document.createElement("div");
+                element.style.backgroundColor = this.colorInterpolation[i].toHexString();
+                element.style.width = "30px";
+                element.style.height = this.widget.legendNames[i] ? "25px" : "20px";
+                element.style.cssFloat = "left";
+                element.style.marginRight = "8px";
+                this.legendDiv.appendChild(element);
+
+                element = document.createElement("div");
+                element.style.lineHeight = this.widget.legendNames[i] ? "12px" : "7px";
+                element.innerHTML = '<b style="color:#222">' + this.widget.legendNames[i] + '</b><br/>' + this.classification.bins[i].label;
+                this.legendDiv.appendChild(element);
+
+                element = document.createElement("div");
+                element.style.clear = "left";
+                this.legendDiv.appendChild(element);
+            }
         }
     },
 

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.js	2011-08-19 21:17:43 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.js	2011-10-10 15:08:48 +0000
@@ -157,22 +157,44 @@
         element.style.height = "5px";
         this.legendDiv.appendChild(element);
         
-        for (var i = 0; i < this.classification.bins.length; i++) {
-            var element = document.createElement("div");
-            element.style.backgroundColor = this.colorInterpolation[i].toHexString();
-            element.style.width = "30px";
-            element.style.height = "15px";
-            element.style.cssFloat = "left";
-            element.style.marginRight = "10px";
-            this.legendDiv.appendChild(element);
-
-            element = document.createElement("div");
-            element.innerHTML = this.classification.bins[i].label;
-            this.legendDiv.appendChild(element);
-
-            element = document.createElement("div");
-            element.style.clear = "left";
-            this.legendDiv.appendChild(element);
+        if (G.vars.activeWidget.legend.value == G.conf.map_legendset_type_automatic) {        
+            for (var i = 0; i < this.classification.bins.length; i++) {
+                var element = document.createElement("div");
+                element.style.backgroundColor = this.colorInterpolation[i].toHexString();
+                element.style.width = "30px";
+                element.style.height = "15px";
+                element.style.cssFloat = "left";
+                element.style.marginRight = "8px";
+                this.legendDiv.appendChild(element);
+
+                element = document.createElement("div");
+                element.innerHTML = this.classification.bins[i].label;
+                this.legendDiv.appendChild(element);
+
+                element = document.createElement("div");
+                element.style.clear = "left";
+                this.legendDiv.appendChild(element);
+            }
+        }
+        else if (G.vars.activeWidget.legend.value == G.conf.map_legendset_type_predefined) {        
+            for (var i = 0; i < this.classification.bins.length; i++) {
+                var element = document.createElement("div");
+                element.style.backgroundColor = this.colorInterpolation[i].toHexString();
+                element.style.width = "30px";
+                element.style.height = this.widget.legendNames[i] ? "25px" : "20px";
+                element.style.cssFloat = "left";
+                element.style.marginRight = "8px";
+                this.legendDiv.appendChild(element);
+
+                element = document.createElement("div");
+                element.style.lineHeight = this.widget.legendNames[i] ? "12px" : "7px";
+                element.innerHTML = '<b style="color:#222">' + this.widget.legendNames[i] + '</b><br/>' + this.classification.bins[i].label;
+                this.legendDiv.appendChild(element);
+
+                element = document.createElement("div");
+                element.style.clear = "left";
+                this.legendDiv.appendChild(element);
+            }
         }
     },
 

=== 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-31 10:50:52 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js	2011-10-10 15:08:48 +0000
@@ -966,15 +966,18 @@
 				var mapLegends = Ext.util.JSON.decode(r.responseText).mapLegends;
 				this.symbolizerInterpolation = [];
 				this.bounds = [];
+                this.legendNames = [];
 				for (var i = 0; i < mapLegends.length; i++) {
 					if (this.bounds[this.bounds.length-1] != mapLegends[i].startValue) {
 						if (this.bounds.length !== 0) {
 							this.symbolizerInterpolation.push('blank');
+                            this.legendNames.push('');
 						}
 						this.bounds.push(mapLegends[i].startValue);
 					}
 					this.symbolizerInterpolation.push(mapLegends[i].image);
 					this.bounds.push(mapLegends[i].endValue);
+                    this.legendNames.push(mapLegends[i].name);
 				}
                 
                 if (isMapView) {

=== 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-31 10:50:52 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2011-10-10 14:37:12 +0000
@@ -1520,20 +1520,24 @@
 				var mapLegends = Ext.util.JSON.decode(r.responseText).mapLegends;
 				var colors = [];
 				var bounds = [];
+                var legendNames = [];
 				for (var i = 0; i < mapLegends.length; i++) {
 					if (bounds[bounds.length-1] != mapLegends[i].startValue) {
 						if (bounds.length !== 0) {
 							colors.push(new mapfish.ColorRgb(240,240,240));
+                            legendNames.push('');
 						}
 						bounds.push(mapLegends[i].startValue);
 					}
 					colors.push(new mapfish.ColorRgb());
 					colors[colors.length-1].setFromHex(mapLegends[i].color);
+                    legendNames.push(mapLegends[i].name);
 					bounds.push(mapLegends[i].endValue);
 				}              
 
 				this.colorInterpolation = colors;
 				this.bounds = bounds;
+                this.legendNames = legendNames;
                 
                 if (isMapView) {
                     this.setMapViewMap();

=== 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-31 10:50:52 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js	2011-10-10 15:08:48 +0000
@@ -1498,20 +1498,24 @@
 				var mapLegends = Ext.util.JSON.decode(r.responseText).mapLegends;
 				var colors = [];
 				var bounds = [];
+                var legendNames = [];
 				for (var i = 0; i < mapLegends.length; i++) {
 					if (bounds[bounds.length-1] != mapLegends[i].startValue) {
 						if (bounds.length !== 0) {
 							colors.push(new mapfish.ColorRgb(240,240,240));
+                            legendNames.push('');
 						}
 						bounds.push(mapLegends[i].startValue);
 					}
 					colors.push(new mapfish.ColorRgb());
 					colors[colors.length-1].setFromHex(mapLegends[i].color);
+                    legendNames.push(mapLegends[i].name);
 					bounds.push(mapLegends[i].endValue);
 				}              
 
 				this.colorInterpolation = colors;
 				this.bounds = bounds;
+                this.legendNames = legendNames;
                 
                 if (isMapView) {
                     this.setMapViewMap();