=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/labels.png' Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/labels.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/labels.png 2010-02-16 17:59:00 +0000 differ === 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 2009-12-02 14:46:45 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css 2010-02-16 17:59:00 +0000 @@ -18,6 +18,10 @@ background-image:url(../../../images/zoom_world.png); } +.x-btn .icon-labels { + background-image:url(../../../images/labels.png); +} + .x-mask-loading2 div { padding:2px 11px 3px 32px; background:#fbfbfb url('../../../images/loader.gif') no-repeat 5px 2px; === 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-11 14:57:03 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-02-16 17:59:00 +0000 @@ -14,6 +14,7 @@ var MAP_SOURCE_TYPE_GEOJSON = 'geojson'; var MAP_SOURCE_TYPE_SHAPEFILE = 'shapefile'; var MASK; +var LABELS; function getUrlParam(strParamName) { var output = ''; @@ -53,6 +54,63 @@ } } +function toggleFeatureLabels(classify) { + var layer = MAP.getLayersByName('Thematic map')[0]; + + function activateLabels() { + layer.styleMap = new OpenLayers.StyleMap({ + 'default': new OpenLayers.Style( + OpenLayers.Util.applyDefaults( + {'fillOpacity': 1, 'strokeColor': '#222222', 'strokeWidth': 1, 'label': '${' + MAPDATA.nameColumn + '}', 'fontFamily': 'tahoma' }, + OpenLayers.Feature.Vector.style['default'] + ) + ), + 'select': new OpenLayers.Style( + {'strokeColor': '#000000', 'strokeWidth': 2, 'cursor': 'pointer'} + ) + }); + layer.refresh(); + LABELS = true; + } + + function deactivateLabels() { + layer.styleMap = new OpenLayers.StyleMap({ + 'default': new OpenLayers.Style( + OpenLayers.Util.applyDefaults( + {'fillOpacity': 1, 'strokeColor': '#222222', 'strokeWidth': 1 }, + OpenLayers.Feature.Vector.style['default'] + ) + ), + 'select': new OpenLayers.Style( + {'strokeColor': '#000000', 'strokeWidth': 2, 'cursor': 'pointer'} + ) + }); + layer.refresh(); + LABELS = false; + } + + if (classify) { + if (LABELS) { + deactivateLabels(); + } + else { + activateLabels(); + } + + if (ACTIVEPANEL == 'choropleth') { + choropleth.classify(true); + } + else if (ACTIVEPANEL == 'mapping') { + mapping.classify(true); + } + } + else { + if (LABELS) { + activateLabels(); + } + } +} + Ext.onReady( function() { Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); @@ -2472,7 +2530,7 @@ 'styleMap': new OpenLayers.StyleMap({ 'default': new OpenLayers.Style( OpenLayers.Util.applyDefaults( - {'fillOpacity': 1, 'strokeColor': '#222222', 'strokeWidth': 1}, + {'fillOpacity': 1, 'strokeColor': '#222222', 'strokeWidth': 1 }, OpenLayers.Feature.Vector.style['default'] ) ), @@ -2641,6 +2699,14 @@ }, scope: this }); + + var labelsButton = new Ext.Button({ + iconCls: 'icon-labels', + tooltip: 'Toggle feature labels on/off', + handler: function() { + toggleFeatureLabels(true); + } + }); var favoritesButton = new Ext.Button({ cls: 'x-btn-text-icon', @@ -2702,11 +2768,12 @@ items: [ ' ',' ',' ', mapLabel, - ' ',' ',' ',' ', + ' ',' ',' ',' ',' ', zoomInButton, zoomOutButton, ' ', zoomMaxExtentButton, + labelsButton, ' ','-', favoritesButton, '-', @@ -2757,7 +2824,7 @@ }, { xtype: 'panel', - title: 'Feature data', + title: 'Feature data', height: 65, anchor: '100%', bodyStyle: 'padding-left: 4px;', @@ -2956,6 +3023,8 @@ } MAP.setCenter(new OpenLayers.LonLat(MAPDATA.longitude, MAPDATA.latitude)); + + toggleFeatureLabels(false); if (redirect == 'choropleth') { getChoroplethData(); } === 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 2009-10-02 13:47:51 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2010-02-16 17:59:00 +0000 @@ -118,7 +118,7 @@ * APIProperty: loadMask * An Ext.LoadMask config or true to mask the widget while loading (defaults to false). */ - loadMask : false, + loadMask: false, /** * APIProperty: labelGenerator @@ -138,8 +138,8 @@ * Inits the component */ - newUrl : false, - + newUrl: false, + initComponent : function() { mapViewStore = new Ext.data.JsonStore({ === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js 2010-02-11 11:44:33 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js 2010-02-16 17:59:00 +0000 @@ -145,7 +145,7 @@ newUrl: false, relation: false, - + initComponent : function() { mapStore = new Ext.data.JsonStore({