← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8973: (GIS) Labels fix.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 8973 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-11-12 10:31:38 +0100
message:
  (GIS) Labels fix.
added:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/openlayers-ux/Circle.js
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/index.html
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/ext-ux-custom.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Facility.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Thematic1.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Thematic2.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.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-api/src/main/java/org/hisp/dhis/mapping/MapView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java	2012-11-01 08:22:08 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java	2012-11-10 15:09:47 +0000
@@ -111,6 +111,8 @@
     private Double opacity;
     
     private OrganisationUnitGroupSet organisationUnitGroupSet;
+    
+    private Integer areaRadius;
 
     private transient String parentGraph;
     
@@ -426,6 +428,19 @@
     @JsonProperty
     @JsonView( {DetailedView.class, ExportView.class} )
     @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
+    public Integer getAreaRadius()
+    {
+        return areaRadius;
+    }
+
+    public void setAreaRadius( Integer areaRadius )
+    {
+        this.areaRadius = areaRadius;
+    }
+
+    @JsonProperty
+    @JsonView( {DetailedView.class, ExportView.class} )
+    @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
     public String getParentGraph()
     {
         return parentGraph;
@@ -484,6 +499,7 @@
             radiusHigh = mapView.getRadiusHigh() == null ? radiusHigh : mapView.getRadiusHigh();
             opacity = mapView.getOpacity() == null ? opacity : mapView.getOpacity();
             organisationUnitGroupSet = mapView.getOrganisationUnitGroupSet() == null ? organisationUnitGroupSet : mapView.getOrganisationUnitGroupSet();
+            areaRadius = mapView.getAreaRadius() == null ? areaRadius : mapView.getAreaRadius();
         }
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml	2012-11-01 05:57:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml	2012-11-08 13:21:04 +0000
@@ -61,6 +61,8 @@
 
     <many-to-one name="organisationUnitGroupSet" class="org.hisp.dhis.organisationunit.OrganisationUnitGroupSet" 
         column="orgunitgroupsetid" foreign-key="fk_mapview_orgunitgroupsetid" />
+    
+    <property name="areaRadius" />
 
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/index.html'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/index.html	2012-11-07 11:51:14 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/index.html	2012-11-07 19:33:10 +0000
@@ -36,6 +36,7 @@
     
     <script type="text/javascript" src="scripts/openlayers/OpenLayers.js"></script>
     <script type="text/javascript" src="scripts/openlayers-ux/newSelectFeature.js"></script>
+    <script type="text/javascript" src="scripts/openlayers-ux/Circle.js"></script>
     
     <script type="text/javascript" src="scripts/geoext/script/custom.js"></script>
     

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2012-11-07 11:32:26 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2012-11-12 09:30:15 +0000
@@ -150,6 +150,10 @@
 	openStreetMap: {
 		id: 'openStreetMap',
 		name: 'OpenStreetMap'
+	},
+	circle: {
+		id: 'circle',
+		name: 'Circle'
 	}
 };
 
@@ -301,6 +305,36 @@
 		return layers;
 	};
 	
+	GIS.util.map.getFeaturesByLayers = function(layers) {
+		var a = [];			
+		for (var i = 0; i < layers.length; i++) {
+			a = a.concat(layers[i].features);
+		}
+		return a;
+	};
+	
+	GIS.util.map.getPointsByFeatures = function(features) {
+		var a = [];
+		for (var i = 0; i < features.length; i++) {
+			if (features[i].geometry.CLASS_NAME === GIS.conf.finals.openLayers.point_classname) {
+				a.push(features[i]);
+			}
+		}
+		return a;
+	};
+	
+	GIS.util.map.getLonLatsByPoints = function(points) {
+		var lonLat,
+			point,
+			a = [];
+		for (var i = 0; i < points.length; i++) {
+			point = points[i];
+			lonLat = new OpenLayers.LonLat(point.geometry.x, point.geometry.y);
+			a.push(lonLat);
+		}
+		return a;
+	};
+	
 	GIS.util.map.hasVisibleFeatures = function() {
 		var layers = GIS.util.map.getVisibleVectorLayers(),
 			layer;
@@ -349,7 +383,7 @@
 	};
 	
 	GIS.util.map.addMapControl = function(name, fn) {
-		var panel = new GIS.obj.MapControlPanel(name, fn);		
+		var panel = GIS.obj.MapControlPanel(name, fn);		
 		GIS.map.addControl(panel);
 		panel.div.className += ' ' + name;
 		panel.div.childNodes[0].className += ' ' + name + 'Button';
@@ -908,8 +942,7 @@
 				}
 				this.setOpacity(this.layerOpacity);
 			},
-			hasLabels: false
-			
+			hasLabels: false			
 		});
 		layer.base = base;
 		
@@ -945,7 +978,7 @@
 					base.widget.cmp.labelWindow.show();
 				}
 				else {
-					base.widget.cmp.labelWindow = new GIS.obj.LabelWindow(base);
+					base.widget.cmp.labelWindow = GIS.obj.LabelWindow(base);
 					base.widget.cmp.labelWindow.show();
 				}
 			}
@@ -967,7 +1000,7 @@
 					}
 				
 					base.widget.cmp.filterWindow = base.id === GIS.base.facility.id ?
-						new GIS.obj.FilterFacilityWindow(base) : new GIS.obj.FilterWindow(base);
+						GIS.obj.FilterFacilityWindow(base) : GIS.obj.FilterWindow(base);
 					base.widget.cmp.filterWindow.show();
 				}
 			};
@@ -987,7 +1020,7 @@
 					}
 				}
 			
-				base.widget.cmp.searchWindow = new GIS.obj.SearchWindow(base);
+				base.widget.cmp.searchWindow = GIS.obj.SearchWindow(base);
 				base.widget.cmp.searchWindow.show();
 			}
 		};
@@ -1055,8 +1088,7 @@
 			visibleLayer;
 			
 		visibleLayerId = window.google ? GIS.base.googleStreets.id : GIS.base.openStreetMap.id;
-		
-		for (var i = 0; i < layers.length; i++) {
+		for (var i = 0; i < layers.length; i++) { //todo important
 			layer = layers[i];
 			
 			item = Ext.create('Ext.ux.panel.LayerItemPanel', {
@@ -1613,9 +1645,8 @@
 						}
 						else {
 							layer.hasLabels = true;
-							layer.styleMap = GIS.obj.StyleMap(base, getLabelConfig());
+							layer.styleMap = GIS.obj.StyleMap(base, getLabelConfig());							
 						}
-						
 						base.widget.config.extended.updateLegend = true;
 						base.widget.execute();
 					}
@@ -1755,7 +1786,7 @@
 								success: function(r) {
 									var id = r.getAllResponseHeaders().location.split('/').pop();
 									
-									GIS.map.mapLoader = new GIS.obj.MapLoader(id);
+									GIS.map.mapLoader = GIS.obj.MapLoader(id);
 									
 									GIS.store.maps.loadStore();
 									
@@ -1904,7 +1935,7 @@
 							if (el) {
 								el = el.parent('td');
 								el.addClsOnOver('link');
-								el.dom.setAttribute('onclick', 'GIS.cmp.mapWindow.destroy(); GIS.map.mapLoader = new GIS.obj.MapLoader("' + record.data.id + '"); GIS.map.mapLoader.load();');
+								el.dom.setAttribute('onclick', 'GIS.cmp.mapWindow.destroy(); GIS.map.mapLoader = GIS.obj.MapLoader("' + record.data.id + '"); GIS.map.mapLoader.load();');
 							}
 						};
 						
@@ -2856,10 +2887,6 @@
 			hidden: true,
 			handler: function() {
 				if (legendSetName.getValue() && validateLegends()) {
-					if (legendSetStore.findExact('name', legendSetName.getValue()) !== -1) {
-						alert('Name already in use');
-						return;
-					}
 					var body = getRequestBody(),
 						id = legendPanel.legendSetId;
 					body.id = id;
@@ -3114,6 +3141,54 @@
 		return window;
 	};
 	
+	GIS.obj.CircleLayer = function(features, radius) {
+		var points = GIS.util.map.getPointsByFeatures(features),
+			lonLats = GIS.util.map.getLonLatsByPoints(points),
+			controls = [],
+			control,
+			layer = new OpenLayers.Layer.Vector(),
+			deactivateControls,
+			createCircles,
+			params = {};
+		
+		radius = radius && Ext.isNumber(parseInt(radius)) ? parseInt(radius) : 5;
+			
+		deactivateControls = function() {
+			for (var i = 0; i < controls.length; i++) {
+				controls[i].deactivate();
+			}
+		};
+		
+		createCircles = function() {
+			if (lonLats.length) {
+				for (var i = 0; i < lonLats.length; i++) {
+					control = new OpenLayers.Control.Circle({
+						layer: layer
+					});
+					control.lonLat = lonLats[i];
+					controls.push(control);
+				}
+				
+				GIS.map.addControls(controls);
+					
+				for (var i = 0; i < controls.length; i++) {
+					control = controls[i];
+					control.activate();
+					control.updateCircle(control.lonLat, radius);
+				}
+			}
+			else {
+				alert('No facilities');
+			}
+		};
+		
+		createCircles();
+		
+		layer.deactivateControls = deactivateControls;
+		
+		return layer;
+	};
+	
 	// OpenLayers map
 	
 	GIS.map = new OpenLayers.Map({
@@ -3143,7 +3218,7 @@
 		if (GIS.cmp.measureWindow && GIS.cmp.measureWindow.destroy) {
 			GIS.cmp.measureWindow.destroy();
 		}		
-		GIS.cmp.measureWindow = new GIS.obj.MeasureWindow();
+		GIS.cmp.measureWindow = GIS.obj.MeasureWindow();
 		GIS.cmp.measureWindow.show();
 	});
     
@@ -3202,48 +3277,48 @@
     
     // Base objects
     
-    GIS.base.boundary.layer = new GIS.obj.VectorLayer(GIS.base.boundary);
+    GIS.base.boundary.layer = GIS.obj.VectorLayer(GIS.base.boundary);
     GIS.map.addLayer(GIS.base.boundary.layer);
-	GIS.base.boundary.menu = new GIS.obj.LayerMenu(GIS.base.boundary, 'gis-toolbar-btn-menu-first');	
+	GIS.base.boundary.menu = GIS.obj.LayerMenu(GIS.base.boundary, 'gis-toolbar-btn-menu-first');	
 	GIS.base.boundary.widget = Ext.create('mapfish.widgets.geostat.Boundary', {
         map: GIS.map,
         layer: GIS.base.boundary.layer,
         menu: GIS.base.boundary.menu
     });    
-    GIS.base.boundary.window = new GIS.obj.WidgetWindow(GIS.base.boundary);
+    GIS.base.boundary.window = GIS.obj.WidgetWindow(GIS.base.boundary);
     
-    GIS.base.thematic1.layer = new GIS.obj.VectorLayer(GIS.base.thematic1, {opacity: 0.8});
+    GIS.base.thematic1.layer = GIS.obj.VectorLayer(GIS.base.thematic1, {opacity: 0.8});
     GIS.map.addLayer(GIS.base.thematic1.layer);
-	GIS.base.thematic1.menu = new GIS.obj.LayerMenu(GIS.base.thematic1);	
+	GIS.base.thematic1.menu = GIS.obj.LayerMenu(GIS.base.thematic1);	
 	GIS.base.thematic1.widget = Ext.create('mapfish.widgets.geostat.Thematic1', {
         map: GIS.map,
         layer: GIS.base.thematic1.layer,
         menu: GIS.base.thematic1.menu,
         legendDiv: GIS.base.thematic1.legendDiv
     });
-    GIS.base.thematic1.window = new GIS.obj.WidgetWindow(GIS.base.thematic1);
+    GIS.base.thematic1.window = GIS.obj.WidgetWindow(GIS.base.thematic1);
     
-    GIS.base.thematic2.layer = new GIS.obj.VectorLayer(GIS.base.thematic2, {opacity: 0.8});
+    GIS.base.thematic2.layer = GIS.obj.VectorLayer(GIS.base.thematic2, {opacity: 0.8});
     GIS.map.addLayer(GIS.base.thematic2.layer);
-	GIS.base.thematic2.menu = new GIS.obj.LayerMenu(GIS.base.thematic2);	
+	GIS.base.thematic2.menu = GIS.obj.LayerMenu(GIS.base.thematic2);	
 	GIS.base.thematic2.widget = Ext.create('mapfish.widgets.geostat.Thematic2', {
         map: GIS.map,
         layer: GIS.base.thematic2.layer,
         menu: GIS.base.thematic2.menu,
         legendDiv: GIS.base.thematic2.legendDiv
     });    
-    GIS.base.thematic2.window = new GIS.obj.WidgetWindow(GIS.base.thematic2);
+    GIS.base.thematic2.window = GIS.obj.WidgetWindow(GIS.base.thematic2);
     
-    GIS.base.facility.layer = new GIS.obj.VectorLayer(GIS.base.facility);
+    GIS.base.facility.layer = GIS.obj.VectorLayer(GIS.base.facility);
     GIS.map.addLayer(GIS.base.facility.layer);
-	GIS.base.facility.menu = new GIS.obj.LayerMenu(GIS.base.facility);
+	GIS.base.facility.menu = GIS.obj.LayerMenu(GIS.base.facility);
 	GIS.base.facility.widget = Ext.create('mapfish.widgets.geostat.Facility', {
         map: GIS.map,
         layer: GIS.base.facility.layer,
         menu: GIS.base.facility.menu,
         legendDiv: GIS.base.facility.legendDiv
     });
-    GIS.base.facility.window = new GIS.obj.WidgetWindow(GIS.base.facility);
+    GIS.base.facility.window = GIS.obj.WidgetWindow(GIS.base.facility);
     
 	// User interface
 	
@@ -3261,7 +3336,7 @@
                     {
                         title: 'Layer overview and visibility %', //i18n
                         bodyStyle: 'padding: 6px',
-                        items: new GIS.obj.LayersPanel(),
+                        items: GIS.obj.LayersPanel(),
                         collapsible: true,
                         animCollapse: false
                     },
@@ -3342,12 +3417,12 @@
 						},
 						{
 							iconCls: 'gis-btn-icon-' + GIS.base.thematic2.id,
-							menu: new GIS.obj.LayerMenu(GIS.base.thematic2),
+							menu: GIS.obj.LayerMenu(GIS.base.thematic2),
 							width: 26
 						},
 						{
 							iconCls: 'gis-btn-icon-' + GIS.base.facility.id,
-							menu: new GIS.obj.LayerMenu(GIS.base.facility),
+							menu: GIS.obj.LayerMenu(GIS.base.facility),
 							width: 26
 						},
 						{
@@ -3358,7 +3433,7 @@
 									GIS.cmp.mapWindow.destroy();
 								}
 								
-								GIS.cmp.mapWindow = new GIS.obj.MapWindow();
+								GIS.cmp.mapWindow = GIS.obj.MapWindow();
 								GIS.cmp.mapWindow.show();
 							}
 						},
@@ -3370,7 +3445,7 @@
 									GIS.cmp.legendSetWindow.destroy();
 								}
 								
-								GIS.cmp.legendSetWindow = new GIS.obj.LegendSetWindow();
+								GIS.cmp.legendSetWindow = GIS.obj.LegendSetWindow();
 								GIS.cmp.legendSetWindow.show();
 							}
 						},
@@ -3388,7 +3463,7 @@
 									GIS.cmp.downloadWindow.destroy();
 								}
 								
-								GIS.cmp.downloadWindow = new GIS.obj.DownloadWindow();
+								GIS.cmp.downloadWindow = GIS.obj.DownloadWindow();
 								GIS.cmp.downloadWindow.show();
 							},								
 							xable: function() {
@@ -3414,7 +3489,7 @@
 									GIS.cmp.interpretationWindow.destroy();
 								}
 								
-								GIS.cmp.interpretationWindow = new GIS.obj.InterpretationWindow();
+								GIS.cmp.interpretationWindow = GIS.obj.InterpretationWindow();
 								GIS.cmp.interpretationWindow.show();
 							},
 							listeners: {

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/ext-ux-custom.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/ext-ux-custom.js	2012-11-07 11:32:26 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/ext-ux-custom.js	2012-11-10 15:09:47 +0000
@@ -178,6 +178,97 @@
 	}
 });
 
+/* CheckTextNumber */
+
+Ext.define('Ext.ux.panel.CheckTextNumber', {
+	extend: 'Ext.panel.Panel',
+	alias: 'widget.checktextnumber',
+	layout: 'column',
+	layer: null,
+	checkbox: null,
+	text: null,
+	numberField: null,
+	width: 184,
+	height: 22,
+	value: false,
+	number: 5,
+	getValue: function() {
+		return this.checkbox.getValue();
+	},
+	getNumber: function() {
+		return this.numberField.getValue();
+	},
+	setValue: function(value, number) {
+		if (value) {
+			this.checkbox.setValue(value);
+		}
+		if (number) {
+			this.numberField.setValue(number);
+		}
+	},
+	enable: function() {
+		this.numberField.enable();
+	},
+	disable: function() {
+		this.numberField.disable();
+	},
+	reset: function() {
+		this.checkbox.setValue(false);
+		this.numberField.setValue(this.number);
+		this.numberField.disable();
+	},
+	initComponent: function() {
+		var that = this;
+		
+		this.checkbox = Ext.create('Ext.form.field.Checkbox', {
+			width: 14,
+			checked: this.value,
+			disabled: this.disabled,
+			listeners: {
+				change: function(chb, value) {
+					if (value) {
+						that.enable();
+					}
+					else {
+						that.disable();
+					}
+				}
+			}
+		});
+		
+		this.numberField = Ext.create('Ext.form.field.Number', {
+			cls: 'gis-numberfield',
+			fieldStyle: 'border-top-left-radius: 1px; border-bottom-left-radius: 1px',
+			style: 'padding-bottom: 3px',
+			width: 60,
+			height: 21,
+			minValue: 0,
+			maxValue: 10000,
+			value: this.number,
+			allowBlank: false,
+			disabled: true
+		});
+		
+		this.items = [
+			{
+				width: this.checkbox.width + 6,
+				items: this.checkbox
+			},
+			{
+				width: this.width - this.checkbox.width - 6 - this.numberField.width,
+				html: this.text,
+				bodyStyle: 'padding-top: 4px'
+			},
+			{
+				width: this.numberField.width,
+				items: this.numberField
+			}
+		];
+		
+		this.callParent();
+	}
+});
+
 /* MultiSelect */
 
 Ext.define("Ext.ux.layout.component.form.MultiSelect",{extend:"Ext.layout.component.field.Field",alias:["layout.multiselectfield"],type:"multiselectfield",defaultHeight:200,sizeBodyContents:function(a,b){var c=this;if(!Ext.isNumber(b)){b=c.defaultHeight}c.owner.panel.setSize(a,b)}});

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat.js	2012-10-31 18:29:46 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat.js	2012-11-12 09:30:15 +0000
@@ -72,36 +72,6 @@
         }
     },
 
-    onSuccess2: function(request) {
-        var doc = request.responseXML;
-        if (!doc || !doc.documentElement) {
-            doc = request.responseText;
-        }
-        
-        if (doc.length && G.vars.activeWidget != symbol) {
-            doc = G.util.geoJsonDecode(doc);
-        }
-        var format = this.format || new OpenLayers.Format.GeoJSON();
-        this.layer.removeFeatures(this.layer.features);
-        
-        var geo = format.read(doc);
-		for (var i = 0; i < geo.length; i++) {
-            var c = geo[i].geometry.getCentroid();
-            if (c instanceof Object) {
-                var p = G.util.getTransformedPoint(c);
-                geo[i] = new OpenLayers.Feature.Vector(p, geo[i].attributes);
-            }
-		}
-        this.layer.addFeatures(geo);
-        G.vars.activeWidget.featureStorage = this.layer.features.slice(0);
-        this.requestSuccess(request);
-  
-		if (!G.vars.activeWidget.formValidation.validateForm.call(G.vars.activeWidget)) {
-			G.vars.mask.hide();
-		}
-		G.vars.activeWidget.classify(false, false, true);
-    },
-
     addOptions: function(newOptions) {
         if (newOptions) {
             if (!this.options) {

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Facility.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Facility.js	2012-10-25 12:07:10 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Facility.js	2012-11-10 17:12:37 +0000
@@ -71,6 +71,8 @@
         
         var element = document.createElement("div");
         element.style.height = "14px";
+		element.style.overflow = "hidden";
+		element.title = config.where;
         element.innerHTML = config.where;
         this.legendDiv.appendChild(element);
         

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Thematic1.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Thematic1.js	2012-10-31 18:29:46 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Thematic1.js	2012-11-10 15:52:02 +0000
@@ -156,6 +156,8 @@
 			if (config.hasOwnProperty(key)) {
 				element = document.createElement("div");
 				element.style.height = "14px";
+				element.style.overflow = "hidden";
+				element.title = config[key];
 				element.innerHTML = config[key];
 				this.legendDiv.appendChild(element);
 				

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Thematic2.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Thematic2.js	2012-11-01 09:03:39 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Thematic2.js	2012-11-10 15:52:02 +0000
@@ -156,6 +156,8 @@
 			if (config.hasOwnProperty(key)) {
 				element = document.createElement("div");
 				element.style.height = "14px";
+				element.style.overflow = "hidden";
+				element.title = config[key];
 				element.innerHTML = config[key];
 				this.legendDiv.appendChild(element);
 				

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js	2012-11-06 07:41:32 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js	2012-11-10 15:09:47 +0000
@@ -615,7 +615,7 @@
         this.coreComp.applyClassification(options);
         this.classificationApplied = true;
         
-        this.afterLoad();		
+        this.afterLoad();
 	},
 	
     execute: function(view) {

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js	2012-11-07 11:32:26 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js	2012-11-10 15:09:47 +0000
@@ -231,7 +231,7 @@
 			rootVisible: false,
 			multiSelect: false,
 			width: GIS.conf.layout.widget.item_width,
-			height: 248,
+			height: 210,
 			reset: function() {
 				this.collapseAll();
 				this.expandPath(GIS.init.rootNodes[0].path);
@@ -267,6 +267,22 @@
 				}
 			}
         });
+        
+        this.cmp.areaRadius = Ext.create('Ext.ux.panel.CheckTextNumber', {
+			width: 262,
+			text: 'Show circular area with radius (km):', //i18n
+			listeners: {
+				added: function() {
+					var that = this;
+					this.checkbox.on('change', function() {
+						GIS.base.facility.widget.config.extended.updateLegend = true;
+					});
+					this.numberField.on('change', function() {
+						GIS.base.facility.widget.config.extended.updateLegend = true;
+					});
+				}
+			}
+		});
     },
     
     addItems: function() {
@@ -275,7 +291,6 @@
             {
                 xtype: 'form',
 				cls: 'el-border-0',
-                width: 270,
                 items: [
 					{
 						html: 'Organisation unit group set', //i18n
@@ -288,7 +303,13 @@
 						bodyStyle: 'padding-top: 4px'
 					},
 					this.cmp.level,
-					this.cmp.parent
+					this.cmp.parent,
+					{
+						html: 'Surrounding areas', //i18n
+						cls: 'gis-form-subtitle',
+						bodyStyle: 'padding-top: 4px'
+					},					
+					this.cmp.areaRadius
 				]
             }
         ];
@@ -652,6 +673,8 @@
 		this.cmp.level.clearValue();
 		this.cmp.parent.reset();
 		
+		this.cmp.areaRadius.reset();
+		
 		// Layer options
 		if (this.cmp.searchWindow) {
 			this.cmp.searchWindow.destroy();
@@ -676,6 +699,11 @@
 		this.store.features.loadFeatures();
 		this.layer.item.setValue(false);
 		
+		if (this.layer.circleLayer) {
+			this.layer.circleLayer.deactivateControls();
+			this.layer.circleLayer = null;
+		}		
+		
 		// Legend
 		document.getElementById(this.legendDiv).innerHTML = '';
 	},
@@ -697,6 +725,13 @@
 		});
 		
 		this.cmp.parent.selectPath('/root' + view.parentGraph);
+		
+		if (Ext.isDefined(view.areaRadius)) {
+			this.cmp.areaRadius.setValue(true, view.areaRadius);
+		}
+		else {
+			this.cmp.areaRadius.reset();
+		}
 	},
     	
 	getView: function() {
@@ -721,6 +756,7 @@
 				id: parent[0].raw.id,
 				name: parent[0].raw.text
 			},
+			areaRadius: this.cmp.areaRadius.getValue() ? this.cmp.areaRadius.getNumber() : null,
 			parentLevel: parent[0].raw.level,
 			parentGraph: parent[0].raw.path,
 			opacity: this.layer.item.getOpacity()
@@ -867,14 +903,27 @@
 				options = {
 					indicator: this.tmpView.organisationUnitGroupSet.name
 				};
-
 				this.coreComp.applyClassification(options);
 				this.classificationApplied = true;
 				
+				this.addCircles();
+				
 				this.afterLoad();
 			}
 		});
-	},	
+	},
+	
+	addCircles: function() {
+		var radius = this.tmpView.areaRadius;
+		
+		if (this.layer.circleLayer) {
+			this.layer.circleLayer.deactivateControls();
+			this.layer.circleLayer = null;
+		}
+		if (Ext.isDefined(radius) && radius) {
+			this.layer.circleLayer = new GIS.obj.CircleLayer(this.layer.features, radius);
+		}
+	},		
 	
     execute: function(view) {
 		if (view) {
@@ -894,17 +943,12 @@
 		GIS.mask.msg = GIS.i18n.loading;
 		GIS.mask.show();
 		
-		//if (this.tmpView.extended.updateGui) { // If favorite, wait for groups store callback 
-			//this.setGui();
-		//}
-		//else {
-			if (this.tmpView.extended.updateOrganisationUnit) {
-				this.loadOrganisationUnits();
-			}
-			else {
-				this.loadLegend();
-			}
-		//}
+		if (this.tmpView.extended.updateOrganisationUnit) {
+			this.loadOrganisationUnits();
+		}
+		else {
+			this.loadLegend();
+		}
 	},
 	
 	afterLoad: function() {

=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/openlayers-ux/Circle.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/openlayers-ux/Circle.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/openlayers-ux/Circle.js	2012-11-12 09:30:15 +0000
@@ -0,0 +1,114 @@
+OpenLayers.Control.Circle = OpenLayers.Class(OpenLayers.Control, {	
+    feature: null,
+    layer: null,
+    radius: 5,
+    origin: null,
+    sides: 40,
+    angle: null,
+    snapAngle: null,  
+    dragControl: null,
+    
+    initialize: function(options) {
+        OpenLayers.Control.prototype.initialize.apply(this, arguments);
+    },
+    
+    activate: function() {
+        var activated = OpenLayers.Control.prototype.activate.call(this);
+        if (activated) {
+            var options = {
+                displayInLayerSwitcher: false,
+                calculateInRange: function() { return true; }
+            };
+            //this.layer = new OpenLayers.Layer.Vector(this.CLASS_NAME, options);
+            //this.dragControl = new OpenLayers.Control.DragFeature(this.layer);
+            //this.map.addControl(this.dragControl);
+            //this.dragControl.activate();
+            this.map.addLayer(this.layer);
+        }
+        return activated;
+    },
+    
+    deactivate: function() {
+        var deactivated = OpenLayers.Control.prototype.deactivate.call(this);
+        if (deactivated) {
+            if (this.layer.map != null) {
+                this.layer.destroy(false);
+                if (this.feature) {
+                    this.feature.destroy();
+                }
+            }
+            this.layer = null;
+            this.feature = null;
+
+            //this.dragControl.destroy();
+            //this.dragControl = null;
+        }
+        return deactivated;
+    },
+    
+    createGeometry: function() {
+        this.angle = Math.PI * ((1 / this.sides) - (1 / 2));
+        if(this.snapAngle) {
+            this.angle += this.snapAngle * (Math.PI / 180);
+        }
+        this.feature.geometry = OpenLayers.Geometry.Polygon.createRegularPolygon(
+            this.origin, this.radius, this.sides, this.snapAngle
+        );
+    },
+    
+    modifyGeometry: function() {
+        var angle, dx, dy, point;
+        var ring = this.feature.geometry.components[0];
+        if (ring.components.length != (this.sides + 1)) {
+            this.createGeometry();
+            ring = this.feature.geometry.components[0];
+        }
+        for (var i = 0; i < this.sides; ++i) {
+            point = ring.components[i];
+            angle = this.angle + (i * 2 * Math.PI / this.sides);
+            point.x = this.origin.x + (this.radius * Math.cos(angle));
+            point.y = this.origin.y + (this.radius * Math.sin(angle));
+            point.clearBounds();
+        }
+    },
+    
+    updateCircle: function(origin, radius) {
+        this.origin = new OpenLayers.Geometry.Point(origin.lon, origin.lat);
+        this.radius = radius * 1000; // gives km when projection is 4326
+        if (!this.feature) {
+            this.feature = new OpenLayers.Feature.Vector();
+            this.createGeometry();
+            this.layer.addFeatures([this.feature], {
+				silent: true
+			});
+        }
+        else {
+            this.modifyGeometry();
+        }
+
+        this.layer.drawFeature(this.feature, this.style);
+    },
+
+    CLASS_NAME: "Meteorage.Circle"
+});
+
+//OpenLayers.Geometry.Polygon.prototype.getCentroid = function() {
+    //var centroid = this.components[0].getCentroid();
+    //return centroid;
+//};
+
+//OpenLayers.Geometry.LinearRing.prototype.getCentroid = function() {
+    //if (this.components && (this.components.length > 2)) {
+        //var sumX = 0.0;
+        //var sumY = 0.0;
+        //for (var i = 0; i < this.components.length - 1; i++) {
+            //var b = this.components[i];
+            //var c = this.components[i+1];
+            //sumX += (b.x + c.x) * (b.x * c.y - c.x * b.y);
+            //sumY += (b.y + c.y) * (b.x * c.y - c.x * b.y);
+        //}
+        //var x = sumX / (6 * Math.abs(this.getArea()));
+        //var y = sumY / (6 * Math.abs(this.getArea()));
+    //}
+    //return new OpenLayers.Geometry.Point(x, y);
+//};