← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 586: (GIS) Map toolbar added containing zoom buttons and exit button (redirects back to DHIS2) with ic...

 

------------------------------------------------------------
revno: 586
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Sat 2009-09-05 15:02:31 +0700
message:
  (GIS) Map toolbar added containing zoom buttons and exit button (redirects back to DHIS2) with icons. Default PanZoom control removed. The mapCenter function now pans smoothly if target area is within existing extent.
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/zoom_in.png
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/zoom_min.png
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/zoom_out.png
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/mapping/index.html
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/mapping/script/index.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/resources/mapfish/widgets/geostat/Mapping.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.
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/zoom_in.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/zoom_in.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/zoom_in.png	2009-09-05 08:02:31 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/zoom_min.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/zoom_min.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/zoom_min.png	2009-09-05 08:02:31 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/zoom_out.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/zoom_out.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/zoom_out.png	2009-09-05 08:02:31 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/mapping/index.html'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/mapping/index.html	2009-09-04 19:06:19 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/mapping/index.html	2009-09-05 08:02:31 +0000
@@ -50,7 +50,6 @@
         .row-assigned {background-color: #72FF63;}
         .row-not-assigned {background-color: #FFFFFF;}
         .icon-exit {background-image: url(../images/exit.png);}
-        .text-title {font-weight: bold;}
     </style>
 </head>
 

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/mapping/script/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/mapping/script/index.js	2009-09-04 19:06:19 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/mapping/script/index.js	2009-09-05 08:02:31 +0000
@@ -151,8 +151,14 @@
     });
 
     myMap: null;
-    map = new OpenLayers.Map($('olmap'));
-    this.myMap = map;
+	map = new OpenLayers.Map({
+		controls: [
+			new OpenLayers.Control.Navigation(),
+			new OpenLayers.Control.ArgParser(),
+			new OpenLayers.Control.Attribution(),
+		]
+	});
+	this.myMap = map;
 
     MASK = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
     
@@ -238,10 +244,6 @@
         "http://labs.metacarta.com/wms/vmap0";, 
         {layers: 'basic'}
     );
-                                                         
-    /*var jpl_wms = new OpenLayers.Layer.WMS("Satellite",
-                                           "http://demo.opengeo.org/geoserver/wms";, 
-                                           {layers: 'bluemarble', format: 'image/png'});*/
                                    
     var choroplethLayer = new OpenLayers.Layer.Vector(CHOROPLETH_LAYERNAME, {
         'visibility': false,
@@ -1874,6 +1876,19 @@
                 }
             }
         }
+    });	
+    
+	map.events.on({
+        changelayer: function(e) {
+            if (e.property == 'visibility' && e.layer != choroplethLayer) {
+                if (e.layer.visibility) {
+                    selectFeatureChoropleth.deactivate();
+                }
+                else {
+                    selectFeatureChoropleth.activate();
+                }
+            }
+        }
     });
     
     mapping.hide();
@@ -1902,20 +1917,56 @@
             children: layerTreeConfig
         }
     });
+	
+	var zoomInButton = new Ext.Button({
+		text: 'Zoom In',
+		cls: 'x-btn-text-icon',
+		icon: '../images/zoom_in.png',
+		handler:function() {
+			this.map.zoomIn();
+		},
+		scope:this,
+	});
+	
+	var zoomOutButton = new Ext.Button({
+		text: 'Zoom Out',
+		cls: 'x-btn-text-icon',
+		icon: '../images/zoom_out.png',
+		handler:function() {
+			this.map.zoomOut();
+		},
+		scope:this,
+	});
+	
+	var zoomMaxExtentButton = new Ext.Button({
+		text: 'Max extent',
+		cls: 'x-btn-text-icon',
+		icon: '../images/zoom_min.png',
+		handler:function() {
+			this.map.zoomToMaxExtent();
+		},
+		scope:this,
+	});
+	
+	var exitButton = new Ext.Button({
+		text: 'Exit GIS',
+		cls: 'x-btn-text-icon',
+		icon: '../images/exit.png',
+		handler: function() {
+			window.location.href = '../../dhis-web-portal/redirect.action'
+		}
+	});
 
-    
-    map.events.on({
-        changelayer: function(e) {
-            if (e.property == 'visibility' && e.layer != choroplethLayer) {
-                if (e.layer.visibility) {
-                    selectFeatureChoropleth.deactivate();
-                }
-                else {
-                    selectFeatureChoropleth.activate();
-                }
-            }
-        }
-    });
+	var mapToolbar = new Ext.Toolbar({
+		id: 'map_tb',
+		items: [
+			zoomInButton, '-',
+			zoomOutButton, '-',
+			zoomMaxExtentButton,
+			'->',
+			exitButton
+		]
+	});
     
     viewport = new Ext.Viewport({
         id: 'viewport',
@@ -1933,9 +1984,8 @@
             {
                 region: 'east',
                 id: 'east',
-                title: '',
+                collapsible: true,
                 width: 200,
-                collapsible: true,
                 margins: '0 5 0 5',
                 defaults: {
                     border: true,
@@ -1969,6 +2019,7 @@
                 region: 'west',
                 id: 'west',
                 split: true,
+				title: 'Map panels',
                 collapsible: true,
                 width: west_width,
                 minSize: 175,
@@ -1994,10 +2045,11 @@
                 region: 'center',
                 id: 'center',
                 height: 1000,
-                width: 1000,
+                width: 800,
                 map: map,
                 title: '',
-                zoom: 3
+                zoom: 3,
+				tbar: mapToolbar
             }
         ]
     });
@@ -2016,7 +2068,7 @@
     }));
     
     map.addControl(new OpenLayers.Control.ZoomBox());
-    
+	
     Ext.get('loading').fadeOut({remove: true});
 });
 
@@ -2025,7 +2077,7 @@
 function onHoverSelectChoropleth(feature) {
     var east_panel = Ext.getCmp('east');
     var x = east_panel.x - 210;
-    var y = east_panel.y + 15;
+    var y = east_panel.y + 41;
     style = '<p style="margin-top: 5px; padding-left:5px;">';
     space = '&nbsp;&nbsp;';
     bs = '<b>';
@@ -2146,7 +2198,7 @@
                 MAPDATA.zoom = parseFloat(MAPDATA.zoom);
             }
             
-            map.setCenter(new OpenLayers.LonLat(MAPDATA.longitude, MAPDATA.latitude), MAPDATA.zoom);
+            map.panTo(new OpenLayers.LonLat(MAPDATA.longitude, MAPDATA.latitude), MAPDATA.zoom);
 
             if (redirect == 'choropleth') {
                 getChoroplethData(); }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/resources/mapfish/widgets/geostat/Mapping.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/resources/mapfish/widgets/geostat/Mapping.js	2009-09-01 09:29:11 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/resources/mapfish/widgets/geostat/Mapping.js	2009-09-05 08:02:31 +0000
@@ -175,10 +175,10 @@
                 var cls = ''; 
                 switch (row.data.featureId) {
                     case '': 
-                        cls = 'not-assigned-row';
+                        cls = 'row-not-assigned';
                         break;
                     default:
-                        cls = 'assigned-row';
+                        cls = 'row-assigned';
                 }
                 
                 return cls;