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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Apr 6 17:40:12 CEST 2009


Author: iweinzierl
Date: 2009-04-06 17:40:12 +0200 (Mon, 06 Apr 2009)
New Revision: 49

Modified:
   webflysuesk/branches/openlayers-integration/ChangeLog.txt
   webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js
Log:
Fetching/showing global and older RGDs via WMS (before as vector layer)

Modified: webflysuesk/branches/openlayers-integration/ChangeLog.txt
===================================================================
--- webflysuesk/branches/openlayers-integration/ChangeLog.txt	2009-04-06 12:36:19 UTC (rev 48)
+++ webflysuesk/branches/openlayers-integration/ChangeLog.txt	2009-04-06 15:40:12 UTC (rev 49)
@@ -1,5 +1,12 @@
 2009-04-06  Ingo Weinzierl <ingo.weinzierl at intevation.de>
 
+	* webflys/src/main/webapp/pages/karte.js: Global and old RGDs will be
+	  fetched via WMS for a better performance. New RGDs, drawn by the current 
+	  user, will be stored temporary in a vector layer. After saving these new 
+	  RGDs, the vector layer is cleaned.
+
+2009-04-06  Ingo Weinzierl <ingo.weinzierl at intevation.de>
+
 	* src/main/webapp/pages/main.jsp,
 	  src/main/webapp/pages/karte.js: New panel to show old calculation results
 	  of the current user. To avoid performance problems, the user is able to

Modified: webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js
===================================================================
--- webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js	2009-04-06 12:36:19 UTC (rev 48)
+++ webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js	2009-04-06 15:40:12 UTC (rev 49)
@@ -109,33 +109,34 @@
 
 
 /**
- * Method:addRGDFeature 
+ * Method:addRGDFeature
  * Add new control elements to OpenLayers map to draw pipes, causeys and dikes.
  */
 function addRGDFeature() {
 
-    // Save Strategy to store changes in the layer
-    var saveStrategy = new OpenLayers.Strategy.Save();
+    // vector layer to store new RGDs temporary
+    var storage = new OpenLayers.Layer.Vector("Rohre, Graben, Damm (Vector)");
+    map.addLayers([storage]);
 
-    // adding a wfs layer to the map, where the RGDs are stored
-    wfs = new OpenLayers.Layer.Vector(
-        "Rohre, Gräben, Dämme",
+    // adding a wfs layer, where the RGDs are stored
+    wfs = new OpenLayers.Layer.WFS(
+        "Rohr-Graben-Damm",
+        "http://beige.rgb:8080/geoserver/wfs",
+        { typename: 'topp:rohre_graben_damm' },
         {
-            strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
-            projection: new OpenLayers.Projection("EPSG:31466"),
-            protocol: new OpenLayers.Protocol.WFS({
-                srsName: "EPSG:31466",
-                url: "http://beige.rgb:8080/geoserver/wfs",
-                featureType: "rohre_graben_damm",
-                featureNS: "http://www.openplans.org/topp",
-            })
+            typename:   'rohre_graben_damm',
+            featureNS:  'http://www.openplays.org/topp',
+            extractAttributes: false,
+            commitReport:   function(str) {
+                OpenLayers.Console.log(str);
+                storage.removeFeatures(storage.features);
+            }
         }
     );
-    map.addLayers([wfs]);
 
     // creating the tool panel
     var panel = new OpenLayers.Control.Panel({
-        displayClass: "olControlEditingToolbar" 
+        displayClass: "olControlEditingToolbar"
     });
 
 
@@ -149,7 +150,10 @@
         }
     );
     pipes.featureAdded =
-        function(feature) { addAttributesToFeature(feature, 'ROHR', 1); };
+        function(feature) {
+            addAttributesToFeature(feature, 'ROHR', 1);
+            storage.addFeatures([feature]);
+        };
 
 
     // defining a button to create rills
@@ -162,7 +166,10 @@
         }
     );
     rills.featureAdded =
-        function(feature) { addAttributesToFeature(feature, 'GRABEN', 2); };
+        function(feature) {
+            addAttributesToFeature(feature, 'GRABEN', 2);
+            storage.addFeatures([feature]);
+    };
 
 
     // defining a button to create causeys
@@ -175,15 +182,16 @@
         }
     );
     causeys.featureAdded =
-        function(feature) { addAttributesToFeature(feature, 'DAMM', 3); };
+        function(feature) {
+            addAttributesToFeature(feature, 'DAMM', 3);
+            storage.addFeatures([feature]);
+    };
 
 
     // defining a button to store the changes in the wfs layer into the PostGIS
     var save = new OpenLayers.Control.Button({
-        title: "in PostGIS speichern",
-        trigger: function() {
-            saveStrategy.save();
-        },
+        trigger: OpenLayers.Function.bind(wfs.commit, wfs),
+        displayClass: "olControlSaveFeatures"
     });
 
     // adding the control elements to the panel



More information about the Webflysuesk-commits mailing list