[Mapbender-commits] r8860 - in trunk/mapbender/http: plugins widgets

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed May 14 01:03:26 PDT 2014


Author: hwbllmnn
Date: 2014-05-14 01:03:26 -0700 (Wed, 14 May 2014)
New Revision: 8860

Modified:
   trunk/mapbender/http/plugins/mb_digitize_widget.php
   trunk/mapbender/http/widgets/w_digitize.js
Log:
added deleting of vertices


Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php	2014-05-14 07:46:39 UTC (rev 8859)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php	2014-05-14 08:03:26 UTC (rev 8860)
@@ -405,6 +405,7 @@
     var featureModified = function() {
         var kml = $('#mapframe1').data('kml');
         var digit = o.$target.data('mb_digitize');
+        digit.modeOff();
         var pts = digit._digitizePoints;
         if(status === 'edit-point') {
             editedFeature.geometry.coordinates = [pts[0].pos.x, pts[0].pos.y];

Modified: trunk/mapbender/http/widgets/w_digitize.js
===================================================================
--- trunk/mapbender/http/widgets/w_digitize.js	2014-05-14 07:46:39 UTC (rev 8859)
+++ trunk/mapbender/http/widgets/w_digitize.js	2014-05-14 08:03:26 UTC (rev 8860)
@@ -491,6 +491,26 @@
             .css('cursor', 'crosshair');
     },
 
+    deleteVertex: function(e) {
+        var pt = this.pointFromEvent(e);
+        var self = this;
+        $.each(this._digitizePoints, function(k, v) {
+            if(v && self._isPointSnapped(v.mousePos, pt.mousePos)) {
+                self._digitizePoints.splice(k, 1);
+            }
+        });
+        this._redraw();
+        this._trigger('featuremodified', e);
+        this.element.bind('mousedown', $.proxy(this, 'deleteVertex'));
+    },
+
+    deleteVertexMode: function() {
+        this.element
+            .unbind('mousedown').unbind('mousemove').unbind('mouseup')
+            .bind('mousedown', $.proxy(this, 'deleteVertex'))
+            .css('cursor', 'crosshair');
+    },
+
     moveMode: function() {
         this.element
             .unbind('mousedown').unbind('mousemove').unbind('mouseup')
@@ -500,6 +520,11 @@
             .css("cursor", "crosshair");
     },
 
+    modeOff: function() {
+        this.element
+            .unbind('mousedown').unbind('mousemove').unbind('mouseup');
+    },
+
     coordinatesToDigitizePoints: function(coords) {
         var map = $('#mapframe1').mapbender();
         if($.isArray(coords[0])) {



More information about the Mapbender_commits mailing list