[Webflysuesk-commits] r41 - in webflysuesk/branches/openlayers-integration: . webflys/src/main/webapp/pages

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Mar 26 12:12:11 CET 2009


Author: iweinzierl
Date: 2009-03-26 12:12:11 +0100 (Thu, 26 Mar 2009)
New Revision: 41

Modified:
   webflysuesk/branches/openlayers-integration/ChangeLog.txt
   webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js
   webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/main.jsp
Log:
The initial map, created when entering the main page, will now be zoomed to the chosen river.

Modified: webflysuesk/branches/openlayers-integration/ChangeLog.txt
===================================================================
--- webflysuesk/branches/openlayers-integration/ChangeLog.txt	2009-03-26 11:01:47 UTC (rev 40)
+++ webflysuesk/branches/openlayers-integration/ChangeLog.txt	2009-03-26 11:12:11 UTC (rev 41)
@@ -1,4 +1,12 @@
 2009-03-26  Ingo Weinzierl <ingo.weinzierl at intevation.de>
+
+	* webflys/src/main/webapp/pages/main.jsp,
+	  webflys/src/main/webapp/pages/karte.js: The initial map, created when
+	  entering the main page, will now be zoomed to the chosen river. The
+	  maxExtent of the OpenLayers map is still the whole world, so we are able
+	  to navigate to other rivers as well.
+
+2009-03-26  Ingo Weinzierl <ingo.weinzierl at intevation.de>
 	
 	* webflys/src/main/java/de/intevation/webflys/servlets/BoundingBox.java,
 	  webflys/src/main/webapp/WEB-INF/web.xml: New service /bbox available. It

Modified: webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js
===================================================================
--- webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js	2009-03-26 11:01:47 UTC (rev 40)
+++ webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js	2009-03-26 11:12:11 UTC (rev 41)
@@ -2,6 +2,31 @@
 var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}});
 
 /**
+ * Method: createMapForRiver
+ * Fetch the BoundingBox of a river in the ServletContext from Servlet and
+ * create a new map with zoom on this river afterwards.
+ */
+function createMapForRiver() {
+    // fetch the BoundingBox from Servlet via XML HTTP-Request
+    $j.ajax( {
+        url: 'http://beige.rgb:8080/webflys/bbox',
+        type: 'GET',
+        dataType: 'xml',
+        error: function(error) {
+            alert('Error loading boundingbox: ' + error);
+        },
+        // on success create a new map with this BoundingBox
+        success: function( xml ) {
+            $j(xml).find('boundingbox').each(function() {
+                var boundingXML = $j(this).text();
+                var bounds = new OpenLayers.Bounds.fromString( boundingXML );
+                createMap(bounds);
+            });
+        }
+    });
+}
+
+/**
  * Method: createMap
  * Create a new map with a maxExtent. A basic background layer will be added
  * always to the map. Other layers will be fetched from a WMC file, configurable
@@ -23,7 +48,7 @@
     // set map options
     var options = {
         controls: control,
-        maxExtent: ext,
+        maxExtent: new OpenLayers.Bounds(-180,-90,180,90),
         maxResolution: 'auto',
         numZoomLevels: 15,
         projection: 'EPSG:4326',

Modified: webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/main.jsp
===================================================================
--- webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/main.jsp	2009-03-26 11:01:47 UTC (rev 40)
+++ webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/main.jsp	2009-03-26 11:12:11 UTC (rev 41)
@@ -49,7 +49,7 @@
         </script>
     </head>
 
-	<body onLoad="createMap(new OpenLayers.Bounds(-180,-90,180,90))">
+	<body onLoad="createMapForRiver()">
         <div id="wrapper">
             <div id="wsplgen">
             <div id="errormessage">



More information about the Webflysuesk-commits mailing list