[Mapbender-commits] r8862 - in trunk/mapbender/http: plugins widgets
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed May 14 02:23:24 PDT 2014
Author: hwbllmnn
Date: 2014-05-14 02:23:24 -0700 (Wed, 14 May 2014)
New Revision: 8862
Modified:
trunk/mapbender/http/plugins/mb_digitize_widget.php
trunk/mapbender/http/widgets/w_digitize.js
Log:
fixed geometry editing for polygons
Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-14 08:45:08 UTC (rev 8861)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-14 09:23:24 UTC (rev 8862)
@@ -409,11 +409,16 @@
var pts = digit._digitizePoints;
if(status === 'edit-point') {
editedFeature.geometry.coordinates = [pts[0].pos.x, pts[0].pos.y];
- } else {
+ } else if(status === 'edit-line') {
editedFeature.geometry.coordinates = [];
$.each(pts, function(_, v) {
editedFeature.geometry.coordinates.push([v.pos.x, v.pos.y]);
});
+ } else if(status === 'edit-polygon') {
+ editedFeature.geometry.coordinates = [[]];
+ $.each(pts, function(_, v) {
+ editedFeature.geometry.coordinates[0].push([v.pos.x, v.pos.y]);
+ });
}
kml.refresh(digitizingFor);
};
Modified: trunk/mapbender/http/widgets/w_digitize.js
===================================================================
--- trunk/mapbender/http/widgets/w_digitize.js 2014-05-14 08:45:08 UTC (rev 8861)
+++ trunk/mapbender/http/widgets/w_digitize.js 2014-05-14 09:23:24 UTC (rev 8862)
@@ -580,9 +580,17 @@
if($.isArray(coords[0])) {
var pts = [];
$.each(coords, function(_, v) {
- var pos = {x: v[0], y: v[1]};
- var mousePos = map.convertRealToPixel(pos);
- pts.push({pos: pos, mousePos: mousePos});
+ if($.isArray(v[0])) {
+ $.each(v, function(_, v2) {
+ var pos = {x: v2[0], y: v2[1]};
+ var mousePos = map.convertRealToPixel(pos);
+ pts.push({pos: pos, mousePos: mousePos});
+ });
+ } else {
+ var pos = {x: v[0], y: v[1]};
+ var mousePos = map.convertRealToPixel(pos);
+ pts.push({pos: pos, mousePos: mousePos});
+ }
});
return pts;
} else {
More information about the Mapbender_commits
mailing list