Skip to content

Commit 573d24a

Browse files
committed
【fix】高性能点图层在通过map的forEachFeatureAtPixel getFeaturesAtPixel获取时返回参数缺少layer的bug
1 parent 2046bdf commit 573d24a

File tree

10 files changed

+33
-22
lines changed

10 files changed

+33
-22
lines changed

dist/leaflet/iclient9-leaflet-es6.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86456,7 +86456,7 @@ var DistributedAnalysisView = WidgetsViewBase.extend({
8645686456
* @property {L.GeoJSON} layer - 结果图层。
8645786457
* @property {string} name - 结果图层名称。
8645886458
*/
86459-
this.event.fire('analysissuccessed', {'layer': e.layer, 'name': e.name})
86459+
this._event.fire('analysissuccessed', {'layer': e.layer, 'name': e.name})
8646086460
});
8646186461

8646286462
this.viewModel.on('analysisfailed', (e) => {
@@ -86468,7 +86468,7 @@ var DistributedAnalysisView = WidgetsViewBase.extend({
8646886468
* @description 分析失败后触发。
8646986469
* @property {string} error - 服务器返回错误。
8647086470
*/
86471-
this.event.fire('analysisfailed', {'error': e.error})
86471+
this._event.fire('analysisfailed', {'error': e.error})
8647286472
});
8647386473

8647486474
this.viewModel.analysis(params, this.map);
@@ -86483,7 +86483,7 @@ var DistributedAnalysisView = WidgetsViewBase.extend({
8648386483
* @property {Array.<L.GeoJSON>} layers - 被删除的结果图层。
8648486484
*/
8648586485
this.viewModel.on('layersremoved', (e) => {
86486-
this.event.fire('layersremoved', { 'layers': e.layers });
86486+
this._event.fire('layersremoved', { 'layers': e.layers });
8648786487
});
8648886488
this.viewModel.clearLayers();
8648986489
};

dist/leaflet/iclient9-leaflet-es6.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/leaflet/iclient9-leaflet.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64947,7 +64947,7 @@ var DistributedAnalysisView = exports.DistributedAnalysisView = _WidgetsViewBase
6494764947
* @property {L.GeoJSON} layer - 结果图层。
6494864948
* @property {string} name - 结果图层名称。
6494964949
*/
64950-
_this2.event.fire('analysissuccessed', { 'layer': e.layer, 'name': e.name });
64950+
_this2._event.fire('analysissuccessed', { 'layer': e.layer, 'name': e.name });
6495164951
});
6495264952

6495364953
_this2.viewModel.on('analysisfailed', function (e) {
@@ -64959,7 +64959,7 @@ var DistributedAnalysisView = exports.DistributedAnalysisView = _WidgetsViewBase
6495964959
* @description 分析失败后触发。
6496064960
* @property {string} error - 服务器返回错误。
6496164961
*/
64962-
_this2.event.fire('analysisfailed', { 'error': e.error });
64962+
_this2._event.fire('analysisfailed', { 'error': e.error });
6496364963
});
6496464964

6496564965
_this2.viewModel.analysis(params, _this2.map);
@@ -64974,7 +64974,7 @@ var DistributedAnalysisView = exports.DistributedAnalysisView = _WidgetsViewBase
6497464974
* @property {Array.<L.GeoJSON>} layers - 被删除的结果图层。
6497564975
*/
6497664976
_this2.viewModel.on('layersremoved', function (e) {
64977-
_this2.event.fire('layersremoved', { 'layers': e.layers });
64977+
_this2._event.fire('layersremoved', { 'layers': e.layers });
6497864978
});
6497964979
_this2.viewModel.clearLayers();
6498064980
};

dist/leaflet/iclient9-leaflet.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/openlayers/iclient9-openlayers-es6.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67287,7 +67287,7 @@ external_ol_default.a.supermap.Util = core_Util_Util;
6728767287
var MapExtend = function () {
6728867288
external_ol_default.a.Map.prototype.forEachFeatureAtPixelDefault = external_ol_default.a.Map.prototype.forEachFeatureAtPixel;
6728967289

67290-
external_ol_default.a.Map.prototype.forEachFeatureAtPixel = function (pixel, callback, opt_options,e) {
67290+
external_ol_default.a.Map.prototype.forEachFeatureAtPixel= external_ol_default.a.Map.prototype.Tc = function (pixel, callback, opt_options, e) {
6729167291

6729267292
//如果满足高效率图层选取要求优先返回高效率图层选中结果
6729367293
const layerFilter = (opt_options && opt_options.layerFilter) ? opt_options.layerFilter : () => {
@@ -67300,7 +67300,9 @@ var MapExtend = function () {
6730067300
for (let i = 0; i < layers.length; i++) {
6730167301
//当前高效率点图层满足筛选条件/并且可视时,可被选中:
6730267302
if (layers[i].getVisible() && layerFilter.call(null, layers[i]) && layers[i].getSource()._forEachFeatureAtCoordinate) {
67303-
layers[i].getSource()._forEachFeatureAtCoordinate(coordinate, resolution, callback, pixel,e);
67303+
layers[i].getSource()._forEachFeatureAtCoordinate(coordinate, resolution, (feature) => {
67304+
callback(feature, layers[i])
67305+
}, pixel, e);
6730467306
}
6730567307
}
6730667308
return this.forEachFeatureAtPixelDefault(pixel, callback, opt_options);
@@ -73729,7 +73731,7 @@ class overlay_Graphic_Graphic extends external_ol_default.a.source.ImageCanvas {
7372973731
if (callback) {
7373073732
callback(graphics[i], e);
7373173733
}
73732-
return;
73734+
continue;
7373373735
}
7373473736
if (me.isHighLight) {
7373573737
me._highLightClose();

dist/openlayers/iclient9-openlayers-es6.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/openlayers/iclient9-openlayers.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35235,7 +35235,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
3523535235
var MapExtend = exports.MapExtend = function () {
3523635236
_openlayers2.default.Map.prototype.forEachFeatureAtPixelDefault = _openlayers2.default.Map.prototype.forEachFeatureAtPixel;
3523735237

35238-
_openlayers2.default.Map.prototype.forEachFeatureAtPixel = function (pixel, callback, opt_options, e) {
35238+
_openlayers2.default.Map.prototype.forEachFeatureAtPixel = _openlayers2.default.Map.prototype.Tc = function (pixel, callback, opt_options, e) {
3523935239

3524035240
//如果满足高效率图层选取要求优先返回高效率图层选中结果
3524135241
var layerFilter = opt_options && opt_options.layerFilter ? opt_options.layerFilter : function () {
@@ -35245,11 +35245,18 @@ var MapExtend = exports.MapExtend = function () {
3524535245
var layers = this.getLayers().getArray();
3524635246
var resolution = this.getView().getResolution();
3524735247
var coordinate = this.getCoordinateFromPixel(pixel);
35248-
for (var i = 0; i < layers.length; i++) {
35248+
35249+
var _loop = function _loop(i) {
3524935250
//当前高效率点图层满足筛选条件/并且可视时,可被选中:
3525035251
if (layers[i].getVisible() && layerFilter.call(null, layers[i]) && layers[i].getSource()._forEachFeatureAtCoordinate) {
35251-
layers[i].getSource()._forEachFeatureAtCoordinate(coordinate, resolution, callback, pixel, e);
35252+
layers[i].getSource()._forEachFeatureAtCoordinate(coordinate, resolution, function (feature) {
35253+
callback(feature, layers[i]);
35254+
}, pixel, e);
3525235255
}
35256+
};
35257+
35258+
for (var i = 0; i < layers.length; i++) {
35259+
_loop(i);
3525335260
}
3525435261
return this.forEachFeatureAtPixelDefault(pixel, callback, opt_options);
3525535262
};
@@ -66060,7 +66067,7 @@ var Graphic = exports.Graphic = function (_ol$source$ImageCanva) {
6606066067
if (callback) {
6606166068
callback(graphics[i], e);
6606266069
}
66063-
return;
66070+
continue;
6606466071
}
6606566072
if (me.isHighLight) {
6606666073
me._highLightClose();

dist/openlayers/iclient9-openlayers.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/openlayers/core/MapExtend.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import ol from 'openlayers';
1111
export var MapExtend = function () {
1212
ol.Map.prototype.forEachFeatureAtPixelDefault = ol.Map.prototype.forEachFeatureAtPixel;
1313

14-
ol.Map.prototype.forEachFeatureAtPixel = function (pixel, callback, opt_options,e) {
14+
ol.Map.prototype.forEachFeatureAtPixel= ol.Map.prototype.Tc = function (pixel, callback, opt_options, e) {
1515

1616
//如果满足高效率图层选取要求优先返回高效率图层选中结果
1717
const layerFilter = (opt_options && opt_options.layerFilter) ? opt_options.layerFilter : () => {
@@ -24,7 +24,9 @@ export var MapExtend = function () {
2424
for (let i = 0; i < layers.length; i++) {
2525
//当前高效率点图层满足筛选条件/并且可视时,可被选中:
2626
if (layers[i].getVisible() && layerFilter.call(null, layers[i]) && layers[i].getSource()._forEachFeatureAtCoordinate) {
27-
layers[i].getSource()._forEachFeatureAtCoordinate(coordinate, resolution, callback, pixel,e);
27+
layers[i].getSource()._forEachFeatureAtCoordinate(coordinate, resolution, (feature) => {
28+
callback(feature, layers[i])
29+
}, pixel, e);
2830
}
2931
}
3032
return this.forEachFeatureAtPixelDefault(pixel, callback, opt_options);

src/openlayers/overlay/Graphic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export class Graphic extends ol.source.ImageCanvas {
212212
if (callback) {
213213
callback(graphics[i], e);
214214
}
215-
return;
215+
continue;
216216
}
217217
if (me.isHighLight) {
218218
me._highLightClose();

0 commit comments

Comments
 (0)