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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Mar 27 16:42:32 CET 2009


Author: iweinzierl
Date: 2009-03-27 16:42:31 +0100 (Fri, 27 Mar 2009)
New Revision: 42

Modified:
   webflysuesk/branches/openlayers-integration/ChangeLog.txt
   webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js
Log:
New control elements for drawing lines.

Modified: webflysuesk/branches/openlayers-integration/ChangeLog.txt
===================================================================
--- webflysuesk/branches/openlayers-integration/ChangeLog.txt	2009-03-26 11:12:11 UTC (rev 41)
+++ webflysuesk/branches/openlayers-integration/ChangeLog.txt	2009-03-27 15:42:31 UTC (rev 42)
@@ -1,3 +1,13 @@
+2009-03-27  Ingo Weinzierl <ingo.weinzierl at intevation.de>
+
+	  New Feature: Now we can draw lines into the map.
+	  TODO: The lines have no attributes objektart, user_id, timestamp or
+	  somethings else but the_geom which we need for WSPLGEN calculation.
+
+	* webflys/src/main/webapp/pages/karte.js: New control elements in OL map to
+	  draw lines, save them via WFS-T into PostGIS database and navigating
+	  around.
+
 2009-03-26  Ingo Weinzierl <ingo.weinzierl at intevation.de>
 
 	* webflys/src/main/webapp/pages/main.jsp,

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:12:11 UTC (rev 41)
+++ webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js	2009-03-27 15:42:31 UTC (rev 42)
@@ -1,5 +1,6 @@
 var map = null;
 var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}});
+var wfs = null;
 
 /**
  * Method: createMapForRiver
@@ -20,7 +21,12 @@
             $j(xml).find('boundingbox').each(function() {
                 var boundingXML = $j(this).text();
                 var bounds = new OpenLayers.Bounds.fromString( boundingXML );
+                
+                // create the map
                 createMap(bounds);
+
+                // add RGD functionality to the map
+                addRGDFeature();
             });
         }
     });
@@ -81,4 +87,63 @@
     // zooming to the maximum extent
     map.zoomToExtent(ext, 'true');
 }
+
+
+/**
+ * Method:addRGDFeature 
+ * Add new control elements to OpenLayers map to draw pipes and dikes.
+ */
+function addRGDFeature() {
+
+    // Save Strategy to store changes in the layer
+    var saveStrategy = new OpenLayers.Strategy.Save();
+
+    // adding a wfs layer to the map, where the RGDs are stored
+    wfs = new OpenLayers.Layer.Vector(
+        "Rohre, Gräben, Dämme",
+        {
+            strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
+            projection: new OpenLayers.Projection("EPSG:4326"),
+            protocol: new OpenLayers.Protocol.WFS({
+                srsName: "EPSG:4326",
+                url: "http://beige.rgb:8080/geoserver/wfs",
+                featureType: "rohre_graben_damm",
+                featureNS: "http://www.openplans.org/topp",
+            })
+        }
+    );
+    map.addLayers([wfs]);
+
+    // creating the tool panel
+    var panel = new OpenLayers.Control.Panel({
+        displayClass: "olControlEditingToolbar" 
+    });
+
+    // defining a button to create pipes
+    var pipes = new OpenLayers.Control.DrawFeature(
+        wfs, OpenLayers.Handler.Path,
+        {
+            title: "Damm",
+            handlerOptions: { freehand: false, multi: true },
+            displayClass: "olControlDrawFeaturePath"
+        }
+    );
+
+    // 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();   
+        },
+    });
+
+    // adding the control elements to the panel
+    panel.addControls([
+        new OpenLayers.Control.Navigation(),
+        save, pipes
+    ]);
+
+    // add the panel to the map
+    map.addControl(panel);
+}
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:



More information about the Webflysuesk-commits mailing list