[Mapbender-commits] r8843 - in trunk/mapbender: http/plugins http/widgets lib
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon May 12 04:51:32 PDT 2014
Author: hwbllmnn
Date: 2014-05-12 04:51:32 -0700 (Mon, 12 May 2014)
New Revision: 8843
Modified:
trunk/mapbender/http/plugins/mb_digitize_widget.php
trunk/mapbender/http/widgets/w_digitize.js
trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
Log:
implemented digitizing of points via context menu & new dialog
Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-12 10:16:55 UTC (rev 8842)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-12 11:51:32 UTC (rev 8843)
@@ -137,7 +137,9 @@
button,
that = this,
inProgress = false,
- title = o.title;
+ title = o.title,
+ digitizingFor = '',
+ status = 'none';
var create = function() {
//
@@ -257,6 +259,11 @@
});
menu.children('li:has(.digitize-add)').bind('click', function() {
digitizeDialog.dialog('open');
+ digitizeDialog.find('.digitize-point').bind('click', function() {
+ status = 'new-point';
+ digitizingFor = $link.parent().attr('title');
+ that.activate();
+ });;
menu.menu('destroy').remove();
});
return false;
@@ -270,7 +277,7 @@
if(kml) {
var digit = o.$target.data('mb_digitize');
var pts = digit._digitizePoints;
- kml.addGeometry(pts);
+ kml.addGeometry(pts, digitizingFor);
}
};
@@ -281,11 +288,8 @@
};
this.activate = function () {
- //remove digitized x and y values from print dialog
- $('input[name="digitized_x_values"]').val("");
- $('input[name="digitized_y_values"]').val("");
-
if (o.$target.size() > 0) {
+ o.type = status.match(/new-(.+)/)[1];
o.$target
.mb_digitize(o)
// .bind("mb_digitizepointadded", newPoint)
@@ -295,8 +299,6 @@
if (!inProgress) {
inProgress = true;
}
-
- digitizeDialog.dialog("open");
};
this.destroy = function () {
Modified: trunk/mapbender/http/widgets/w_digitize.js
===================================================================
--- trunk/mapbender/http/widgets/w_digitize.js 2014-05-12 10:16:55 UTC (rev 8842)
+++ trunk/mapbender/http/widgets/w_digitize.js 2014-05-12 11:51:32 UTC (rev 8843)
@@ -14,7 +14,8 @@
pointFillDefault: "#CCF",
pointStrokeDefault: "#FC3",
pointStrokeSnapped: "#F30",
- pointStrokeWidthDefault: 2
+ pointStrokeWidthDefault: 2,
+ type: null
},
_digitizePoints: [],
_map: undefined,
@@ -330,6 +331,14 @@
drawPoints: true
});
}
+
+ if(this.options.type === 'point') {
+ this.element.unbind('click', this._addPoint)
+ .css('cursor', 'auto')
+ .bind('click', $.proxy(this, '_reinitialize'));
+ this._trigger("lastpointadded", e);
+ }
+
return true;
},
_redraw: function () {
@@ -366,17 +375,25 @@
});
}
},
+
_init: function () {
if (this._digitizePoints.closedLine || this._digitizePoints.closedPolygon) {
this._digitizePoints = [];
this._canvas.clear();
}
- this.element
- .bind("click", $.proxy(this, "_addPoint"))
- .bind("mousemove", $.proxy(this, "_digitize"))
- .css("cursor", "crosshair");
+ if(this.options.type === 'point') {
+ this.element
+ .bind("click", $.proxy(this, "_addPoint"))
+ .css("cursor", "crosshair");
+ } else {
+ this.element
+ .bind("click", $.proxy(this, "_addPoint"))
+ .bind("mousemove", $.proxy(this, "_digitize"))
+ .css("cursor", "crosshair");
+ }
},
+
_create: function () {
this._digitizePoints = [];
Modified: trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
===================================================================
--- trunk/mapbender/lib/mb.ui.displayKmlFeatures.js 2014-05-12 10:16:55 UTC (rev 8842)
+++ trunk/mapbender/lib/mb.ui.displayKmlFeatures.js 2014-05-12 11:51:32 UTC (rev 8843)
@@ -234,16 +234,11 @@
this._kmls[url].data.features[idx].display = false;
},
- addGeometry: function(pts) {
+ addGeometry: function(pts, url) {
var $map = $(this.element).mapbender();
var self = this;
var tp = pts.closedPolygon ? geomType.polygon : (pts.closedLine ? geomType.line : geomType.point);
- var itm;
- $.each(this._kmls, function(k, v) {
- if($('li[title="' + k + '"] > button[name="digitize-layer"]').hasClass('active')) {
- itm = v;
- }
- });
+ var itm = this._kmls[url];
for(var i in itm.highlightArray){
itm.highlightArray[i].hide();
More information about the Mapbender_commits
mailing list