[Mapbender-commits] r8876 - trunk/mapbender/lib
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri May 16 05:25:43 PDT 2014
Author: hwbllmnn
Date: 2014-05-16 05:25:43 -0700 (Fri, 16 May 2014)
New Revision: 8876
Modified:
trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
Log:
fixed selection by map click
Modified: trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
===================================================================
--- trunk/mapbender/lib/mb.ui.displayKmlFeatures.js 2014-05-16 11:55:53 UTC (rev 8875)
+++ trunk/mapbender/lib/mb.ui.displayKmlFeatures.js 2014-05-16 12:25:43 UTC (rev 8876)
@@ -54,6 +54,7 @@
var map = self.element.mapbender();
var pos = map.getMousePosition(e);
var clickPoint = map.convertPixelToReal(new Point(pos.x,pos.y));
+ var wgspt = Proj4js.transform(self.targetProj, self.wgs84, {x: clickPoint.x, y: clickPoint.y});
var res = map.getScale() / mb_resolution / 100;
var itm = self._kmls[self.queriedLayer];
if(!itm) return;
@@ -63,8 +64,9 @@
$.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 pt = Proj4js.transform(self.wgs84, self.targetProj, {x: v.geometry.coordinates[0], y: v.geometry.coordinates[1]});
+ var minx = pt.x - 20 * res;
+ var miny = pt.y - 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) {
@@ -72,8 +74,8 @@
matchedIds.push(k);
}
} else {
- var box = this.getBbox(itm.data.features[k]);
- if(box[0] < clickPoint.x && box[2] > clickPoint.x && box[1] < clickPoint.y && box[3] > clickPoint.y) {
+ var box = self.getBbox(itm.data.features[k]);
+ if(box[0] < wgspt.x && box[2] > wgspt.x && box[1] < wgspt.y && box[3] > wgspt.y) {
matched.push(v);
matchedIds.push(k);
}
@@ -253,7 +255,7 @@
});
},
- reload: function() {
+ // reload: function() {
// probably nothing needs to be done when transforming on the fly on the client
// var self = this, o = this.options;
// var epsg = $(self.element).mapbender().epsg;
@@ -284,11 +286,11 @@
// }
// });
// });
- },
+ // },
setOrder: function(order) {
this.kmlOrder = order;
- this.reload();
+ this.render();
},
reorderFeatures: function(url, ids) {
More information about the Mapbender_commits
mailing list