← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1624: (GIS) Old map views are now loaded with the zoom level and map position stored with the map.

 

------------------------------------------------------------
revno: 1624
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-03-11 16:27:28 +0100
message:
  (GIS) Old map views are now loaded with the zoom level and map position stored with the map.
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-03-11 14:08:07 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-03-11 15:27:28 +0000
@@ -3201,7 +3201,7 @@
         params: { mapLayerPath: URL, format: 'json' },
         success: function( responseObject ) {
 		
-            MAPDATA = Ext.util.JSON.decode(responseObject.responseText).map[0];
+            MAPDATA = Ext.util.JSON.decode(responseObject.responseText).map[0];	
             
             if (MAPSOURCE == map_source_type_database) {
                 MAPDATA.name = Ext.getCmp('map_cb').getRawValue();
@@ -3220,14 +3220,21 @@
             }
 			
 			if (!position) {
-           
 				if (MAPDATA.zoom != MAP.getZoom()) {
 					MAP.zoomTo(MAPDATA.zoom);
 				}
-				
 				MAP.setCenter(new OpenLayers.LonLat(MAPDATA.longitude, MAPDATA.latitude));
 			}
 			
+			if (MAPVIEW.longitude && MAPVIEW.latitude && MAPVIEW.zoom) {
+				MAP.setCenter(new OpenLayers.LonLat(MAPVIEW.longitude, MAPVIEW.latitude), MAPVIEW.zoom);
+			}
+			else {
+				MAP.setCenter(new OpenLayers.LonLat(MAPDATA.longitude, MAPDATA.latitude), MAPDATA.zoom);
+			}
+			
+			MAPVIEW = false;
+			
 			toggleFeatureLabels(false);
 
             if (redirect == thematicMap) {

=== 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-03-10 14:41:28 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2010-03-11 15:27:28 +0000
@@ -247,9 +247,8 @@
                     fn: function() {
                         if (MAPVIEW) {
                             Ext.getCmp('period_cb').setValue(MAPVIEW.periodId);
-                            
                             var mst = MAPVIEW.mapSourceType;
-                            
+
                             Ext.Ajax.request({
                                 url: path + 'setMapSourceTypeUserSetting' + type,
                                 method: 'POST',
@@ -286,7 +285,6 @@
                         if (MAPVIEW) {
                             Ext.getCmp('map_cb').setValue(MAPVIEW.mapSource);
                             choropleth.classify(false, true);
-                            MAPVIEW = false;
                         }
                     }
                 }
@@ -323,10 +321,8 @@
 
                             success: function( responseObject ) {
                                 MAPVIEW = Ext.util.JSON.decode(responseObject.responseText).mapView[0];
-								MAP.setCenter(new OpenLayers.LonLat(MAPVIEW.longitude, MAPVIEW.latitude), MAPVIEW.zoom);
-                                
-                                MAPSOURCE = MAPVIEW.mapSourceType;
-                                
+								MAPSOURCE = MAPVIEW.mapSourceType;
+								
                                 Ext.getCmp('numClasses').setValue(MAPVIEW.classes);
                                 Ext.getCmp('colorA_cf').setValue(MAPVIEW.colorLow);
                                 Ext.getCmp('colorB_cf').setValue(MAPVIEW.colorHigh);