[Webflysuesk-commits] r44 - in webflysuesk/branches/openlayers-integration: . webflys/src/main/webapp/pages
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Mar 30 15:12:03 CEST 2009
Author: iweinzierl
Date: 2009-03-30 15:12:02 +0200 (Mon, 30 Mar 2009)
New Revision: 44
Modified:
webflysuesk/branches/openlayers-integration/ChangeLog.txt
webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js
Log:
RGD Feature completed. The user is now able to draw pipes, causeys and rills into the map and save them in the database.
Modified: webflysuesk/branches/openlayers-integration/ChangeLog.txt
===================================================================
--- webflysuesk/branches/openlayers-integration/ChangeLog.txt 2009-03-30 12:58:44 UTC (rev 43)
+++ webflysuesk/branches/openlayers-integration/ChangeLog.txt 2009-03-30 13:12:02 UTC (rev 44)
@@ -1,5 +1,15 @@
2009-03-30 Ingo Weinzierl <ingo.weinzierl at intevation.de>
+ * webflys/src/main/webapp/pages/karte.js: Feature completed. The user is
+ able to draw pipes, causeys and rills into the map. The features, created
+ with these three tools, have information about it's author, the river
+ which they belong to, the type of barrier they are from and some other
+ information.
+ The features won't be stored into the database unless the user clicks the
+ button to save them.
+
+2009-03-30 Ingo Weinzierl <ingo.weinzierl at intevation.de>
+
* webflys/src/main/java/de/intevation/webflys/servlets/GetGewaesser.java,
webflys/src/main/java/de/intevation/webflys/servlets/UserId.java,
webflys/src/main/webapp/WEB-INF/web.xml: New services.
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-30 12:58:44 UTC (rev 43)
+++ webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js 2009-03-30 13:12:02 UTC (rev 44)
@@ -91,7 +91,7 @@
/**
* Method:addRGDFeature
- * Add new control elements to OpenLayers map to draw pipes and dikes.
+ * Add new control elements to OpenLayers map to draw pipes, causeys and dikes.
*/
function addRGDFeature() {
@@ -119,16 +119,48 @@
displayClass: "olControlEditingToolbar"
});
+
// defining a button to create pipes
var pipes = new OpenLayers.Control.DrawFeature(
wfs, OpenLayers.Handler.Path,
{
+ title: "Rohr",
+ handlerOptions: { freehand: false, multi: true },
+ displayClass: "olControlDrawFeaturePath"
+ }
+ );
+ pipes.featureAdded =
+ function(feature) { addAttributesToFeature(feature, 'ROHR', 1); };
+
+
+ // defining a button to create rills
+ var rills= new OpenLayers.Control.DrawFeature(
+ wfs, OpenLayers.Handler.Path,
+ {
+ title: "Graben",
+ handlerOptions: { freehand: false, multi: true },
+ displayClass: "olControlDrawFeaturePath"
+ }
+ );
+ rills.featureAdded =
+ function(feature) { addAttributesToFeature(feature, 'GRABEN', 2); };
+
+
+ // defining a button to create causeys
+ var causeys = new OpenLayers.Control.DrawFeature(
+ wfs, OpenLayers.Handler.Path,
+ {
title: "Damm",
handlerOptions: { freehand: false, multi: true },
displayClass: "olControlDrawFeaturePath"
}
);
+ causeys.featureAdded =
+ function(feature) { addAttributesToFeature(feature, 'DAMM', 3); };
+
+
+
// defining a button to store the changes in the wfs layer into the PostGIS
var save = new OpenLayers.Control.Button({
title: "in PostGIS speichern",
@@ -140,10 +172,89 @@
// adding the control elements to the panel
panel.addControls([
new OpenLayers.Control.Navigation(),
- save, pipes
+ save, pipes, rills, causeys
]);
// add the panel to the map
map.addControl(panel);
}
+
+
+/**
+ * Method: addAttributes
+ * Add different attributes to the feature.
+ *
+ * Parameters:
+ * feature - {OpenLayers.Feature} Last feature which was added.
+ * typeText - {String} Name of the barrier. Should be one of ROHR, GRABEN, DAMM
+ * typeNr - {Integer} Number of the barrier. Should be 1, 2 or 3
+ */
+function addAttributesToFeature(feature, typeText, typeNr) {
+
+ // these attributes shall be static, maybe we should change this later
+ feature.attributes.quellsyste = 'UESK';
+ feature.attributes.objektart = 'M29 RohrGrabenDamm';
+ feature.attributes.typ = typeNr;
+ feature.attributes.typ_text = typeText;
+
+ // add user_id and gewaesser in an own function because the information is
+ // fetched via Ajax request
+ addUserIdToFeature(feature);
+ addGewaesserToFeature(feature);
+}
+
+/**
+ * Method:getGewaesser
+ * Fetch the name of the river from the session via AJAX request.
+ *
+ * Parameters:
+ * feature - {OpenLayers.Feature} Last feature which was added.
+ */
+function addGewaesserToFeature(feature) {
+ var gewaesser = null;
+
+ $j.ajax({
+ type :'GET',
+ url :'http://beige.rgb:8080/webflys/getGewaesser',
+ async : true,
+ dataType: 'xml',
+ error : function(error) {
+ alert('Error loading gewaesser: ' + error);
+ },
+ success : function(xml) {
+ $j(xml).find('gewaesser').each(function() {
+ gewaesser = $j(this).text();
+ feature.attributes.gewaesser = gewaesser;
+ });
+ }
+ });
+}
+
+
+/**
+ * Method:getUserId
+ * Fetch the username from the session via AJAX request.
+ *
+ * Returns:
+ * {String} UserId as String.
+ */
+function addUserIdToFeature(feature) {
+ var uid = null;
+
+ $j.ajax({
+ type : 'GET',
+ url : 'http://beige.rgb:8080/webflys/userId',
+ async : true,
+ dataType: 'xml',
+ error : function(error) {
+ alert('Error loading UserId: ' + error);
+ },
+ success: function(xml) {
+ $j(xml).find('user-name').each(function() {
+ uid = $j(this).text();
+ feature.attributes.user_id = uid;
+ });
+ }
+ });
+}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
More information about the Webflysuesk-commits
mailing list