← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1810: (GIS) Legend type, method, classes combo bugs fixed + more comments added.

 

------------------------------------------------------------
revno: 1810
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: gis
timestamp: Wed 2010-04-28 17:18:18 +0200
message:
  (GIS) Legend type, method, classes combo bugs fixed + more comments added.
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/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-04-28 13:57:58 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-04-28 15:18:18 +0000
@@ -1,5 +1,36 @@
 Ext.BLANK_IMAGE_URL = '../resources/ext/resources/images/default/s.gif';
-var MAP,BASECOORDINATE,MAPSOURCE,MAPDATA,URL,MAPVIEW,PARAMETER,ACTIVEPANEL,MASK,LABELS,COLORINTERPOLATION,EXPORTVALUES,BOUNDS = 0;
+
+/* OpenLayers map */
+var MAP;
+/* Center point of the country */
+var BASECOORDINATE;
+/* Geojson, shapefile or database */
+var MAPSOURCE;
+/* A map object */
+var MAPDATA;
+/* Filename or level */
+var URL;
+/* Active mapview object  */
+var MAPVIEW;
+/* Active mapview id parameter from URL */
+var PARAMETER;
+/* Current expanded accordion panel */
+var ACTIVEPANEL;
+/* Mask */
+var MASK;
+/* Boolean  */
+var LABELS;
+/* Legend colors for export  */
+var COLORINTERPOLATION;
+/* Export values  */
+var EXPORTVALUES;
+/* Currently selected vector feature  */
+var FEATURE;
+/* Current legend type and method */
+var LEGEND = new Object();
+LEGEND.type = map_legend_type_automatic;
+LEGEND.method = 1;
+LEGEND.classes = 5;
 
 /* Detect mapview parameter in URL */
 function getUrlParam(strParamName){var output='';var strHref=window.location.href;if(strHref.indexOf('?')>-1){var strQueryString=strHref.substr(strHref.indexOf('?')).toLowerCase();var aQueryString=strQueryString.split('&');for(var iParam=0;iParam<aQueryString.length;iParam++){if(aQueryString[iParam].indexOf(strParamName.toLowerCase()+'=')>-1){var aParam=aQueryString[iParam].split('=');output=aParam[1];break;}}}return unescape(output);}
@@ -24,9 +55,8 @@
 	document.body.oncontextmenu = function(){return false;};
 	/* Activate tooltip */
 	Ext.QuickTips.init();
-    /* OpenLayers map */
+
     MAP = new OpenLayers.Map({controls:[new OpenLayers.Control.Navigation(),new OpenLayers.Control.ArgParser(),new OpenLayers.Control.Attribution()]});
-	/* Loading mask */
 	MASK = new Ext.LoadMask(Ext.getBody(),{msg:'Loading...',msgCls:'x-mask-loading2'});
 	
     if (getUrlParam('view')){PARAMETER=getUrlParam('view');}	
@@ -3032,6 +3062,19 @@
 /* Section: select features */
 var popup;
 
+var featureMenu = new Ext.menu.Menu({});
+featureMenu.add({
+	html: 'Centre',
+	iconCls: 'no-icon',
+	listeners: {
+		'click': {
+			fn: function() {
+				alert(1);
+			}
+		}
+	}
+});
+
 function onHoverSelectChoropleth(feature) {
     if (MAPDATA != null) {
         if (ACTIVEPANEL == thematicMap) {
@@ -3048,6 +3091,8 @@
 }
 
 function onClickSelectChoropleth(feature) {
+	FEATURE = feature;
+
 	var east_panel = Ext.getCmp('east');
 	var x = east_panel.x - 210;
 	var y = east_panel.y + 41;
@@ -3080,13 +3125,16 @@
 		mapping.relation = feature.attributes[MAPDATA.nameColumn];
     }
 	else {
+		featureMenu.showAt([300,200]);
 		// MAP.setCenter(feature.geometry.getBounds().getCenterLonLat(), MAP.getZoom()+1);
-		sc(feature.attributes[MAPDATA.nameColumn], Ext.getCmp('indicator_cb').getRawValue());
+		// sc(feature.attributes[MAPDATA.nameColumn], Ext.getCmp('indicator_cb').getRawValue());
 	}
 }
 
 function onClickUnselectChoropleth(feature) {}
 
+
+
 /* Section: map data */
 function loadMapData(redirect, position) {
     Ext.Ajax.request({

=== 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-04-22 15:11:58 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2010-04-28 15:18:18 +0000
@@ -654,7 +654,7 @@
             mode: 'local',
             emptyText: emptytext,
 			labelSeparator: labelseparator,
-            value: map_legend_type_automatic,
+            value: LEGEND.type,
             triggerAction: 'all',
             width: combo_width,
             store: new Ext.data.SimpleStore({
@@ -667,15 +667,21 @@
             listeners: {
                 'select': {
                     fn: function() {
-                        if (Ext.getCmp('maplegendtype_cb').getValue() == map_legend_type_predefined) {
+                        if (Ext.getCmp('maplegendtype_cb').getValue() == map_legend_type_predefined && Ext.getCmp('maplegendtype_cb').getValue() != LEGEND.type ) {
+							LEGEND.type = map_legend_type_predefined;
 							Ext.getCmp('method').hideField();
 							Ext.getCmp('bounds').hideField();
                             Ext.getCmp('numClasses').hideField();
 							Ext.getCmp('colorA_cf').hideField();
 							Ext.getCmp('colorB_cf').hideField();
 							Ext.getCmp('maplegendset_cb').showField();
+							
+							if (Ext.getCmp('maplegendset_cb').getValue()) {
+								this.classify(false);
+							}
                         }
-                        else if (Ext.getCmp('maplegendtype_cb').getValue() == map_legend_type_automatic) {
+                        else if (Ext.getCmp('maplegendtype_cb').getValue() == map_legend_type_automatic && Ext.getCmp('maplegendtype_cb').getValue() != LEGEND.type) {
+							LEGEND.type = map_legend_type_automatic;
 							Ext.getCmp('method').showField();
 							if (Ext.getCmp('method').getValue() == 0) {
 								Ext.getCmp('bounds').showField();
@@ -731,7 +737,7 @@
             mode: 'local',
             emptyText: emptytext,
 			labelSeparator: labelseparator,
-            value: 1,
+            value: LEGEND.method,
             triggerAction: 'all',
             width: combo_width,
             store: new Ext.data.SimpleStore({
@@ -739,16 +745,19 @@
                 data: [
 					[1, 'Equal intervals'],
 					[2, 'Equal group count'],
-					[0, 'Fixed breaks']]
+					[0, 'Fixed breaks']
+				]
             }),
             listeners: {
                 'select': {
                     fn: function() {
-                        if (Ext.getCmp('method').getValue() == 0) {
+                        if (Ext.getCmp('method').getValue() == 0 && Ext.getCmp('method').getValue() != LEGEND.method) {
+							LEGEND.method = 0;
                             Ext.getCmp('bounds').showField();
                             Ext.getCmp('numClasses').hideField();
                         }
-                        else {
+                        else if (Ext.getCmp('method').getValue() != LEGEND.method) {
+							LEGEND.method = Ext.getCmp('method').getValue();
                             Ext.getCmp('bounds').hideField();
                             Ext.getCmp('numClasses').showField();
                             
@@ -780,7 +789,7 @@
             valueField: 'value',
             displayField: 'value',
             mode: 'local',
-            value: 5,
+            value: LEGEND.classes,
             triggerAction: 'all',
             width: combo_width,
             store: new Ext.data.SimpleStore({
@@ -793,8 +802,11 @@
                         if (Ext.getCmp('mapview_cb').getValue() != '') {
                             Ext.getCmp('mapview_cb').reset();
                         }
-                        
-                        this.classify(false);
+						
+						if (Ext.getCmp('numClasses').getValue() != LEGEND.classes) {
+							LEGEND.classes = Ext.getCmp('numClasses').getValue();
+							this.classify(false);
+						}
                     },
                     scope: this
                 }