← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1978: (GIS) MapView now supports all legend types.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 1978 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-08-26 22:14:50 +0530
message:
  (GIS) MapView now supports all legend types.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
  dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
  dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml
  dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java
  dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingStoreTest.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapViewAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapViews.vm
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/config.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
  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-api/src/main/java/org/hisp/dhis/mapping/MapView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java	2010-05-31 22:32:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java	2010-08-26 16:20:21 +0000
@@ -78,6 +78,8 @@
 
     private int classes;
 
+    private String bounds;
+
     private String colorLow;
 
     private String colorHigh;
@@ -96,8 +98,8 @@
 
     public MapView( String name, String mapValueType, IndicatorGroup indicatorGroup, Indicator indicator,
         DataElementGroup dataElementGroup, DataElement dataElement, PeriodType periodType, Period period,
-        String mapSourceType, String mapSource, String mapLegendType, int method, int classes, String colorLow,
-        String colorHigh, MapLegendSet mapLegendSet, String longitude, String latitude, int zoom )
+        String mapSourceType, String mapSource, String mapLegendType, int method, int classes, String bounds,
+        String colorLow, String colorHigh, MapLegendSet mapLegendSet, String longitude, String latitude, int zoom )
     {
         this.name = name;
         this.mapValueType = mapValueType;
@@ -112,6 +114,7 @@
         this.mapLegendType = mapLegendType;
         this.method = method;
         this.classes = classes;
+        this.bounds = bounds;
         this.colorLow = colorLow;
         this.colorHigh = colorHigh;
         this.mapLegendSet = mapLegendSet;
@@ -298,6 +301,16 @@
         this.classes = classes;
     }
 
+    public String getBounds()
+    {
+        return bounds;
+    }
+
+    public void setBounds( String bounds )
+    {
+        this.bounds = bounds;
+    }
+
     public String getColorLow()
     {
         return colorLow;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java	2010-07-10 15:37:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java	2010-08-26 16:20:21 +0000
@@ -381,14 +381,14 @@
 
     int addMapView( String name, String mapValueType, int indicatorGroupId, int indicatorId, int dataElementGroupId,
         int dataElementId, String periodTypeName, int periodId, String mapSourceType, String mapSource,
-        String mapLegendType, int method, int classes, String colorLow, String colorHigh, int mapLegendSetId,
+        String mapLegendType, int method, int classes, String bounds, String colorLow, String colorHigh, int mapLegendSetId,
         String longitude, String latitude, int zoom );
 
     void updateMapView( MapView mapView );
 
     void addOrUpdateMapView( String name, String mapValueType, int indicatorGroupId, int indicatorId,
         int dataElementGroupId, int dataElementId, String periodTypeName, int periodId, String mapSource,
-        String mapLegendType, int method, int classes, String colorLow, String colorHigh, int mapLegendSetId,
+        String mapLegendType, int method, int classes, String bounds, String colorLow, String colorHigh, int mapLegendSetId,
         String longitude, String latitude, int zoom );
 
     void deleteMapView( MapView view );

=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2010-08-26 06:44:24 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2010-08-26 16:20:21 +0000
@@ -735,7 +735,7 @@
 
     public int addMapView( String name, String mapValueType, int indicatorGroupId, int indicatorId,
         int dataElementGroupId, int dataElementId, String periodTypeName, int periodId, String mapSourceType,
-        String mapSource, String mapLegendType, int method, int classes, String colorLow, String colorHigh,
+        String mapSource, String mapLegendType, int method, int classes, String bounds, String colorLow, String colorHigh,
         int mapLegendSetId, String longitude, String latitude, int zoom )
     {
         MapView mapView = new MapView();
@@ -772,6 +772,7 @@
         mapView.setMapLegendType( mapLegendType );
         mapView.setMethod( method );
         mapView.setClasses( classes );
+        mapView.setBounds( bounds );
         mapView.setColorLow( colorLow );
         mapView.setColorHigh( colorHigh );
         mapView.setMapLegendSet( mapLegendSet );
@@ -789,7 +790,7 @@
 
     public void addOrUpdateMapView( String name, String mapValueType, int indicatorGroupId, int indicatorId,
         int dataElementGroupId, int dataElementId, String periodTypeName, int periodId, String mapSource,
-        String mapLegendType, int method, int classes, String colorLow, String colorHigh, int mapLegendSetId,
+        String mapLegendType, int method, int classes, String bounds, String colorLow, String colorHigh, int mapLegendSetId,
         String longitude, String latitude, int zoom )
     {
         IndicatorGroup indicatorGroup = null;
@@ -838,6 +839,7 @@
             mapView.setMapLegendType( mapLegendType );
             mapView.setMethod( method );
             mapView.setClasses( classes );
+            mapView.setBounds( bounds );
             mapView.setColorLow( colorLow );
             mapView.setColorHigh( colorHigh );
             mapView.setMapLegendSet( mapLegendSet );
@@ -850,7 +852,7 @@
         else
         {
             mapView = new MapView( name, mapValueType, indicatorGroup, indicator, dataElementGroup, dataElement,
-                periodType, period, mapSourceType, mapSource, mapLegendType, method, classes, colorLow, colorHigh,
+                periodType, period, mapSourceType, mapSource, mapLegendType, method, classes, bounds, colorLow, colorHigh,
                 mapLegendSet, longitude, latitude, zoom );
 
             addMapView( mapView );

=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml	2010-05-31 22:32:45 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml	2010-08-26 16:20:21 +0000
@@ -43,6 +43,8 @@
 		
 		<property name="classes"/>
 		
+		<property name="bounds"/>
+		
 		<property name="colorLow"/>
 			
 		<property name="colorHigh"/>

=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java	2010-07-10 15:37:10 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java	2010-08-26 16:20:21 +0000
@@ -219,7 +219,7 @@
         mappingService.addMap( mapA );
 
         MapView mapView = new MapView( "MapViewA", "indicator", indicatorGroup, indicator, new DataElementGroup(), new DataElement(), periodType, period,
-            MapView.MAP_SOURCE_TYPE_SHAPEFILE, "sl_districts", MapLegendSet.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "A",
+            MapView.MAP_SOURCE_TYPE_SHAPEFILE, "sl_districts", MapLegendSet.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A",
             "B", mapLegendSet, "1", "1", 1 );
 
         int idA = mappingService.addMapView( mapView );

=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingStoreTest.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingStoreTest.java	2010-05-31 22:32:45 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingStoreTest.java	2010-08-26 16:20:21 +0000
@@ -162,7 +162,7 @@
 
         MapView mapView = new MapView( "MapViewA", MapView.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator,
             new DataElementGroup(), new DataElement(), periodType, period, MapView.MAP_SOURCE_TYPE_SHAPEFILE,
-            "sl_districts", MapLegendSet.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "A", "B", mapLegendSet, "1", "1", 1 );
+            "sl_districts", MapLegendSet.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, "1", "1", 1 );
 
         int idA = mappingStore.addMapView( mapView );
 

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapViewAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapViewAction.java	2010-05-31 22:32:45 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapViewAction.java	2010-08-26 16:20:21 +0000
@@ -136,6 +136,13 @@
     {
         this.classes = classes;
     }
+    
+    private String bounds;
+    
+    public void setBounds( String bounds )
+    {
+        this.bounds = bounds;
+    }
 
     private String colorLow;
 
@@ -187,7 +194,7 @@
         throws Exception
     {
         mappingService.addOrUpdateMapView( name, mapValueType, indicatorGroupId, indicatorId, dataElementGroupId,
-            dataElementId, periodTypeId, periodId, mapSource, mapLegendType, method, classes, colorLow, colorHigh,
+            dataElementId, periodTypeId, periodId, mapSource, mapLegendType, method, classes, bounds, colorLow, colorHigh,
             mapLegendSetId, longitude, latitude, zoom );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm	2010-06-03 13:57:09 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm	2010-08-26 16:20:21 +0000
@@ -14,6 +14,7 @@
     "mapLegendType": "$!encoder.jsEncode( ${object.mapLegendType} )",
     "method": "$!{object.method}",
     "classes": "$!{object.classes}",
+    "bounds": "$!{object.bounds}",
     "colorLow": "$!encoder.jsEncode( ${object.colorLow} )",
     "colorHigh": "$!encoder.jsEncode( ${object.colorHigh} )",
     "mapLegendSetId": "$!{object.mapLegendSet.id}",

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapViews.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapViews.vm	2010-06-03 13:57:09 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapViews.vm	2010-08-26 16:20:21 +0000
@@ -16,6 +16,7 @@
     "mapLegendType": "$!encoder.jsEncode( ${mapView.mapLegendType} )",
     "method": "$!{mapView.method}",
     "classes": "$!{mapView.classes}",
+    "bounds": "$!{mapView.bounds}",
     "colorLow": "$!encoder.jsEncode( ${mapView.colorLow} )",
     "colorHigh": "$!encoder.jsEncode( ${mapView.colorHigh} )",
     "mapLegendSetId": "$!{mapView.mapLegendSet.id}",

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/config.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/config.js	2010-08-20 10:00:28 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/config.js	2010-08-26 16:20:21 +0000
@@ -1,7 +1,3 @@
-//  Country dependent variables
-
-    FACILITY_LEVEL = 4;
-
 //  MapFish print module
 
     var layerOverrides = {"World": {overview: true}, Countries: {format: 'image/svg+xml'}};
@@ -64,4 +60,10 @@
     map_layer_type_baselayer = 'baselayer';
     map_layer_type_overlay = 'overlay';
 	map_value_type_indicator = 'indicator';
-	map_value_type_dataelement = 'dataelement';
\ No newline at end of file
+	map_value_type_dataelement = 'dataelement';
+    
+//  MapFish
+
+    classify_with_bounds = 1;
+    classify_by_equal_intervals = 2;
+    classify_by_quantils = 3;
\ No newline at end of file

=== 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-08-26 05:47:58 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-08-26 16:20:21 +0000
@@ -41,7 +41,7 @@
 LEGEND[thematicMap] = new Object();
 LEGEND[thematicMap2] = new Object();
 LEGEND[thematicMap].type = LEGEND[thematicMap2].type = map_legend_type_automatic;
-LEGEND[thematicMap].method = LEGEND[thematicMap2].method = 1;
+LEGEND[thematicMap].method = LEGEND[thematicMap2].method = 2;
 LEGEND[thematicMap].classes = LEGEND[thematicMap2].classes = 5;
 /* Current map value types */
 VALUETYPE = new Object();
@@ -56,6 +56,8 @@
 function validateInput(name){return (name.length<=25);}
 /* Decide multiselect height based on screen resolution */
 function getMultiSelectHeight(){var h=screen.height;if(h<=800){return 220;}else if(h<=1050){return 310;}else if(h<=1200){return 470;}else{return 900;}}
+/* Make map view numbers numeric */
+function getNumericMapView(mapView){mapView.id=parseFloat(mapView.id);mapView.indicatorGroupId=parseFloat(mapView.indicatorGroupId);mapView.indicatorId=parseFloat(mapView.indicatorId);mapView.periodId=parseFloat(mapView.periodId);mapView.method=parseFloat(mapView.method);mapView.classes=parseFloat(mapView.classes);mapView.mapLegendSetId=parseFloat(mapView.mapLegendSetId);mapView.longitude=parseFloat(mapView.longitude);mapView.latitude=parseFloat(mapView.latitude);mapView.zoom=parseFloat(mapView.zoom);return mapView;}
 /* Toggle feature labels */
 function getActivatedOpenLayersStyleMap(nameColumn) {
     return new OpenLayers.StyleMap({'default':new OpenLayers.Style(OpenLayers.Util.applyDefaults({'fillOpacity':1,'strokeColor':'#222222','strokeWidth':1,'label':'${' + nameColumn + '}','fontFamily':'arial,lucida sans unicode','fontWeight':'bold','fontSize':14},OpenLayers.Feature.Vector.style['default'])), 'select':new OpenLayers.Style({'strokeColor':'#000000','strokeWidth':2,'cursor':'pointer'})});
@@ -265,7 +267,9 @@
 					var p = Ext.getCmp('period_cb').getValue();
 					var ms = MAPSOURCE == map_source_type_database ? Ext.getCmp('map_tf').value : Ext.getCmp('map_cb').getValue();
 					var mlt = Ext.getCmp('maplegendtype_cb').getValue();
+                    var m = Ext.getCmp('method_cb').getValue();
 					var c = Ext.getCmp('numClasses_cb').getValue();
+                    var b = Ext.getCmp('bounds_tf').getValue() || '';
 					var ca = Ext.getCmp('colorA_cf').getValue();
 					var cb = Ext.getCmp('colorB_cf').getValue();
 					var mlsid = Ext.getCmp('maplegendset_cb').getValue() || 0;
@@ -309,7 +313,7 @@
 							Ext.Ajax.request({
 								url: path_mapping + 'addOrUpdateMapView' + type,
 								method: 'POST',
-								params: { name: vn, mapValueType: mvt, indicatorGroupId: ig, indicatorId: ii, dataElementGroupId: deg, dataElementId: de, periodTypeId: pt, periodId: p, mapSource: ms, mapLegendType: mlt, method: 2, classes: c, colorLow: ca, colorHigh: cb, mapLegendSetId: mlsid, longitude: lon, latitude: lat, zoom: zoom },
+								params: { name: vn, mapValueType: mvt, indicatorGroupId: ig, indicatorId: ii, dataElementGroupId: deg, dataElementId: de, periodTypeId: pt, periodId: p, mapSource: ms, mapLegendType: mlt, method: m, classes: c, bounds: b, colorLow: ca, colorHigh: cb, mapLegendSetId: mlsid, longitude: lon, latitude: lat, zoom: zoom },
 								success: function(r) {
 									Ext.message.msg(true, 'The view <span class="x-msg-hl">' + vn + '</span> ' + i18n_was_registered);
 									Ext.getCmp('view_cb').getStore().load();

=== 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-08-03 18:42:13 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js	2010-08-26 16:20:21 +0000
@@ -609,17 +609,17 @@
 /**
  * Constant: mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS
  */
-mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS = 0;
+mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS = 1;
 
 /**
  * Constant: mapfish.GeoStat.Distribution.CLASSIFY_BY_EQUAL_INTERVALS
  */
-mapfish.GeoStat.Distribution.CLASSIFY_BY_EQUAL_INTERVALS = 1;
+mapfish.GeoStat.Distribution.CLASSIFY_BY_EQUAL_INTERVALS = 2;
 
 /**
  * Constant: mapfish.GeoStat.Distribution.CLASSIFY_BY_QUANTILS
  */
-mapfish.GeoStat.Distribution.CLASSIFY_BY_QUANTILS = 2;
+mapfish.GeoStat.Distribution.CLASSIFY_BY_QUANTILS = 3;
 
 /**
  * Bin is category of the Classification.

=== 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-08-26 06:56:52 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js	2010-08-26 16:20:21 +0000
@@ -109,7 +109,8 @@
     createColorInterpolation: function() {
         var initialColors = this.colors;
         var numColors = this.classification.bins.length;
-		var mapLegendType = ACTIVEPANEL == organisationUnitAssignment ? map_legend_type_automatic : Ext.getCmp('maplegendtype_cb').getValue();
+		var mapLegendType = ACTIVEPANEL == organisationUnitAssignment ?
+            map_legend_type_automatic : Ext.getCmp('maplegendtype_cb').getValue();
 		
 		if (mapLegendType == map_legend_type_automatic) {
 			this.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors);

=== 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-08-26 11:01:44 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2010-08-26 16:20:21 +0000
@@ -170,8 +170,8 @@
 			}
 		});
 	},
-	
-    initComponent : function() {
+    
+    initComponent: function() {
     
         mapViewStore = new Ext.data.JsonStore({
             url: path_mapping + 'getAllMapViews' + type,
@@ -189,36 +189,46 @@
                                 params: { id: PARAMETER },
 								success: function(r) {
 									PARAMETER = false;
-                                    MAPVIEW = Ext.util.JSON.decode(r.responseText).mapView[0];
+                                    MAPVIEW = getNumericMapView(Ext.util.JSON.decode(r.responseText).mapView[0]);
                                     MAPSOURCE = MAPVIEW.mapSourceType;
                                     MAP.setCenter(new OpenLayers.LonLat(MAPVIEW.longitude, MAPVIEW.latitude), MAPVIEW.zoom);
                                     
 									Ext.getCmp('mapsource_cb').setValue(MAPSOURCE);
                                     Ext.getCmp('mapview_cb').setValue(MAPVIEW.id);
-									
-									if (MAPVIEW.mapLegendType == map_legend_type_automatic) {
+                                    
+                                    if (MAPVIEW.mapLegendType == map_legend_type_automatic) {
                                         LEGEND[thematicMap].type = map_legend_type_automatic;
-										Ext.getCmp('maplegendtype_cb').setValue(map_legend_type_automatic);
-										Ext.getCmp('numClasses_cb').setValue(MAPVIEW.classes);
-										Ext.getCmp('colorA_cf').setValue(MAPVIEW.colorLow);
-										Ext.getCmp('colorB_cf').setValue(MAPVIEW.colorHigh);
-										
-										Ext.getCmp('method_cb').showField();
-										Ext.getCmp('bounds_tf').hideField();
-										Ext.getCmp('numClasses_cb').showField();
-										Ext.getCmp('colorA_cf').showField();
-										Ext.getCmp('colorB_cf').showField();
-										Ext.getCmp('maplegendset_cb').hideField();
-									}
+                                        Ext.getCmp('maplegendtype_cb').setValue(map_legend_type_automatic);
+                                        Ext.getCmp('maplegendset_cb').hideField();
+                                        Ext.getCmp('method_cb').showField();
+                                        Ext.getCmp('method_cb').setValue(MAPVIEW.method);
+                                        Ext.getCmp('colorA_cf').showField();
+                                        Ext.getCmp('colorA_cf').setValue(MAPVIEW.colorLow);
+                                        Ext.getCmp('colorB_cf').showField();
+                                        Ext.getCmp('colorB_cf').setValue(MAPVIEW.colorHigh);
+                                        
+                                        if (MAPVIEW.method == classify_with_bounds) {
+                                            Ext.getCmp('numClasses_cb').hideField();
+                                            Ext.getCmp('bounds_tf').showField();
+                                            Ext.getCmp('bounds_tf').setValue('80,100');
+                                        }
+                                        else {
+                                            Ext.getCmp('bounds_tf').hideField();
+                                            Ext.getCmp('numClasses_cb').showField();
+                                            Ext.getCmp('numClasses_cb').setValue(MAPVIEW.classes);
+                                        }
+                                    }
 									else if (MAPVIEW.mapLegendType == map_legend_type_predefined) {
                                         LEGEND[thematicMap].type = map_legend_type_predefined;
-										Ext.getCmp('maplegendtype_cb').setValue(map_legend_type_predefined);
-										Ext.getCmp('method_cb').hideField();
-										Ext.getCmp('bounds_tf').hideField();
-										Ext.getCmp('numClasses_cb').hideField();
-										Ext.getCmp('colorA_cf').hideField();
-										Ext.getCmp('colorB_cf').hideField();
-										Ext.getCmp('maplegendset_cb').showField();
+                                        Ext.getCmp('maplegendtype_cb').setValue(map_legend_type_predefined);
+                                        Ext.getCmp('method_cb').hideField();
+                                        Ext.getCmp('bounds_tf').hideField();
+                                        Ext.getCmp('numClasses_cb').hideField();
+                                        Ext.getCmp('colorA_cf').hideField();
+                                        Ext.getCmp('colorB_cf').hideField();
+                                        Ext.getCmp('maplegendset_cb').showField();
+                                        
+                                        Ext.getCmp('maplegendset_cb').setValue(MAPVIEW.mapLegendSetId);
 										
 										predefinedMapLegendSetStore.load();
 									}
@@ -474,7 +484,7 @@
                             method: 'POST',
                             params: { id: mId },
                             success: function(r) {
-                                MAPVIEW = Ext.util.JSON.decode(r.responseText).mapView[0];
+                                MAPVIEW = getNumericMapView(Ext.util.JSON.decode(r.responseText).mapView[0]);
 								MAPSOURCE = MAPVIEW.mapSourceType;
                                 
                                 Ext.getCmp('mapvaluetype_cb').setValue(MAPVIEW.mapValueType);
@@ -501,19 +511,27 @@
                                     dataElementStore.load();
                                 }                                        
 								
-								if (MAPVIEW.mapLegendType == map_legend_type_automatic) {
+                                if (MAPVIEW.mapLegendType == map_legend_type_automatic) {
                                     LEGEND[thematicMap].type = map_legend_type_automatic;
 									Ext.getCmp('maplegendtype_cb').setValue(map_legend_type_automatic);
-									Ext.getCmp('numClasses_cb').setValue(MAPVIEW.classes);
+                                    Ext.getCmp('maplegendset_cb').hideField();
+									Ext.getCmp('method_cb').showField();
+                                    Ext.getCmp('method_cb').setValue(MAPVIEW.method);
+                                    Ext.getCmp('colorA_cf').showField();
 									Ext.getCmp('colorA_cf').setValue(MAPVIEW.colorLow);
+                                    Ext.getCmp('colorB_cf').showField();
 									Ext.getCmp('colorB_cf').setValue(MAPVIEW.colorHigh);
-									
-									Ext.getCmp('method_cb').showField();
-									Ext.getCmp('bounds_tf').hideField();
-									Ext.getCmp('numClasses_cb').showField();
-									Ext.getCmp('colorA_cf').showField();
-									Ext.getCmp('colorB_cf').showField();
-									Ext.getCmp('maplegendset_cb').hideField();
+                                    
+                                    if (MAPVIEW.method == classify_with_bounds) {
+                                        Ext.getCmp('numClasses_cb').hideField();
+                                        Ext.getCmp('bounds_tf').showField();
+                                        Ext.getCmp('bounds_tf').setValue('80,100');
+                                    }
+                                    else {
+                                        Ext.getCmp('bounds_tf').hideField();
+                                        Ext.getCmp('numClasses_cb').showField();
+                                        Ext.getCmp('numClasses_cb').setValue(MAPVIEW.classes);
+                                    }
 								}
 								else if (MAPVIEW.mapLegendType == map_legend_type_predefined) {
                                     LEGEND[thematicMap].type = map_legend_type_predefined;
@@ -1006,7 +1024,7 @@
                         else if (Ext.getCmp('maplegendtype_cb').getValue() == map_legend_type_automatic && Ext.getCmp('maplegendtype_cb').getValue() != LEGEND[thematicMap].type) {
 							LEGEND[thematicMap].type = map_legend_type_automatic;
 							Ext.getCmp('method_cb').showField();
-							if (Ext.getCmp('method_cb').getValue() == 0) {
+							if (Ext.getCmp('method_cb').getValue() == classify_with_bounds) {
 								Ext.getCmp('bounds_tf').showField();
 								Ext.getCmp('numClasses_cb').hideField();
 							}
@@ -1066,16 +1084,16 @@
             store: new Ext.data.SimpleStore({
                 fields: ['value', 'text'],
                 data: [
-					[1, i18n_equal_intervals],
-					[2, i18n_equal_group_count],
-					[0, i18n_fixed_breaks]
+					[2, i18n_equal_intervals],
+					[3, i18n_equal_group_count],
+					[1, i18n_fixed_breaks]
 				]
             }),
             listeners: {
                 'select': {
                     fn: function() {
-                        if (Ext.getCmp('method_cb').getValue() == 0 && Ext.getCmp('method_cb').getValue() != LEGEND[thematicMap].method) {
-							LEGEND[thematicMap].method = 0;
+                        if (Ext.getCmp('method_cb').getValue() == classify_with_bounds && Ext.getCmp('method_cb').getValue() != LEGEND[thematicMap].method) {
+							LEGEND[thematicMap].method = classify_with_bounds;
                             Ext.getCmp('bounds_tf').showField();
                             Ext.getCmp('numClasses_cb').hideField();
                         }