[Mapbender-commits] r8854 - in trunk/mapbender: http/plugins lib
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue May 13 05:10:33 PDT 2014
Author: hwbllmnn
Date: 2014-05-13 05:10:33 -0700 (Tue, 13 May 2014)
New Revision: 8854
Modified:
trunk/mapbender/http/plugins/mb_digitize_widget.php
trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
Log:
added selecting of features via map click, added removal of selected features via add/edit menu
Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-13 09:38:04 UTC (rev 8853)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-13 12:10:33 UTC (rev 8854)
@@ -314,6 +314,24 @@
digitizingFor = $link.parent().attr('title');
that.activate();
});
+ digitizeDialog.find('.digitize-cursor').bind('click', function() {
+ var kml = $('#mapframe1').data('kml');
+ kml.setQueriedLayer($link.parent().attr('title'));
+ });
+ digitizeDialog.find('.digitize-remove').bind('click', function() {
+ var kml = $('#mapframe1').data('kml');
+ var url = $link.parent().attr('title');
+ var feat = $('li[title="' + url + '"] li.kmltree-selected');
+ var idx = feat.attr('idx');
+ var ids = [];
+ var i = 0;
+ $.each(feat.siblings(), function(k, v) {
+ ids.push($(v).attr('idx'));
+ $(v).attr('idx', i++);
+ });
+ feat.remove();
+ kml.reorderFeatures(url, ids);
+ });
menu.menu('destroy').remove();
});
return false;
Modified: trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
===================================================================
--- trunk/mapbender/lib/mb.ui.displayKmlFeatures.js 2014-05-13 09:38:04 UTC (rev 8853)
+++ trunk/mapbender/lib/mb.ui.displayKmlFeatures.js 2014-05-13 12:10:33 UTC (rev 8854)
@@ -39,6 +39,40 @@
_popup : null,
_create: function(){
var self = this, o = this.options;
+ this.element.bind('click', function(e) {
+ var map = self.element.mapbender();
+ var pos = map.getMousePosition(e);
+ var clickPoint = map.convertPixelToReal(new Point(pos.x,pos.y));
+ var res = map.getScale() / mb_resolution / 100;
+ var itm = self._kmls[self.queriedLayer];
+ if(!itm) return;
+
+ var matched = [];
+ var matchedIds = [];
+
+ $.each(itm.data.features, function(k, v) {
+ if(v.geometry.type.match(/point/i)) {
+ var minx = v.geometry.coordinates[0] - 20 * res;
+ var miny = v.geometry.coordinates[1] - 20 * res;
+ var maxx = minx + 40 * res;
+ var maxy = miny + 40 * res;
+ if(minx < clickPoint.x && maxx > clickPoint.x && miny < clickPoint.y && maxy > clickPoint.y) {
+ matched.push(v);
+ matchedIds.push(k);
+ }
+ } else {
+ var box = itm.geomArray.list[k].getBBox();
+ if(box[0].x < clickPoint.x && box[1].x > clickPoint.x && box[0].y < clickPoint.y && box[1].y > clickPoint.y) {
+ matched.push(v);
+ matchedIds.push(k);
+ }
+ }
+ });
+
+ if(matchedIds.length > 0) {
+ $('li[title="' + self.queriedLayer + '"] li[idx="' + matchedIds[0] + '"]').click();
+ }
+ });
/* this.element.bind('click', function(e){
var map = self.element.mapbender();
var pos = map.getMousePosition(e);
@@ -234,6 +268,10 @@
this._kmls[url].data.features[idx].display = false;
},
+ setQueriedLayer: function(url) {
+ this.queriedLayer = url;
+ },
+
addGeometry: function(pts, url, attributesDialog) {
var $map = $(this.element).mapbender();
var self = this;
More information about the Mapbender_commits
mailing list