| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -67285,9 +67285,23 @@ external_ol_default.a.supermap.Util = core_Util_Util; | |||
| 67285 | 67285 | * @private | |
| 67286 | 67286 | */ | |
| 67287 | 67287 | var MapExtend = function () { | |
| 67288 | + const fun = function (layer, coordinate, resolution, callback, pixel, e) { | ||
| 67289 | + if (layer instanceof external_ol_default.a.layer.Group) { | ||
| 67290 | + layer.getLayers().forEach(function (subLayer) { | ||
| 67291 | + fun(subLayer, coordinate, resolution, callback, pixel, e) | ||
| 67292 | + }); | ||
| 67293 | + } else { | ||
| 67294 | + //当前高效率点图层满足筛选条件/并且可视时,可被选中: | ||
| 67295 | + if (layer.getSource()._forEachFeatureAtCoordinate) { | ||
| 67296 | + layer.getSource()._forEachFeatureAtCoordinate(coordinate, resolution, (feature) => { | ||
| 67297 | + callback(feature, layer) | ||
| 67298 | + }, pixel, e); | ||
| 67299 | + } | ||
| 67300 | + } | ||
| 67301 | + } | ||
| 67288 | 67302 | external_ol_default.a.Map.prototype.forEachFeatureAtPixelDefault = external_ol_default.a.Map.prototype.forEachFeatureAtPixel; | |
| 67289 | 67303 | ||
| 67290 | - external_ol_default.a.Map.prototype.forEachFeatureAtPixel= external_ol_default.a.Map.prototype.Tc = function (pixel, callback, opt_options, e) { | ||
| 67304 | + external_ol_default.a.Map.prototype.forEachFeatureAtPixel = external_ol_default.a.Map.prototype.Tc = function (pixel, callback, opt_options, e) { | ||
| 67291 | 67305 | ||
| 67292 | 67306 | //如果满足高效率图层选取要求优先返回高效率图层选中结果 | |
| 67293 | 67307 | const layerFilter = (opt_options && opt_options.layerFilter) ? opt_options.layerFilter : () => { | |
@@ -67297,13 +67311,13 @@ var MapExtend = function () { | |||
| 67297 | 67311 | const layers = this.getLayers().getArray(); | |
| 67298 | 67312 | const resolution = this.getView().getResolution(); | |
| 67299 | 67313 | const coordinate = this.getCoordinateFromPixel(pixel); | |
| 67314 | + | ||
| 67300 | 67315 | for (let i = 0; i < layers.length; i++) { | |
| 67301 | - //当前高效率点图层满足筛选条件/并且可视时,可被选中: | ||
| 67302 | - if (layers[i].getVisible() && layerFilter.call(null, layers[i]) && layers[i].getSource()._forEachFeatureAtCoordinate) { | ||
| 67303 | - layers[i].getSource()._forEachFeatureAtCoordinate(coordinate, resolution, (feature) => { | ||
| 67304 | - callback(feature, layers[i]) | ||
| 67305 | - }, pixel, e); | ||
| 67316 | + const layer = layers[i]; | ||
| 67317 | + if (layer.getVisible() && layerFilter.call(null, layer)) { | ||
| 67318 | + fun(layer, coordinate, resolution, callback, pixel, e) | ||
| 67306 | 67319 | } | |
| 67320 | + | ||
| 67307 | 67321 | } | |
| 67308 | 67322 | return this.forEachFeatureAtPixelDefault(pixel, callback, opt_options); | |
| 67309 | 67323 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35233,6 +35233,20 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de | |||
| 35233 | 35233 | * @private | |
| 35234 | 35234 | */ | |
| 35235 | 35235 | var MapExtend = exports.MapExtend = function () { | |
| 35236 | + var fun = function fun(layer, coordinate, resolution, callback, pixel, e) { | ||
| 35237 | + if (layer instanceof _openlayers2.default.layer.Group) { | ||
| 35238 | + layer.getLayers().forEach(function (subLayer) { | ||
| 35239 | + fun(subLayer, coordinate, resolution, callback, pixel, e); | ||
| 35240 | + }); | ||
| 35241 | + } else { | ||
| 35242 | + //当前高效率点图层满足筛选条件/并且可视时,可被选中: | ||
| 35243 | + if (layer.getSource()._forEachFeatureAtCoordinate) { | ||
| 35244 | + layer.getSource()._forEachFeatureAtCoordinate(coordinate, resolution, function (feature) { | ||
| 35245 | + callback(feature, layer); | ||
| 35246 | + }, pixel, e); | ||
| 35247 | + } | ||
| 35248 | + } | ||
| 35249 | + }; | ||
| 35236 | 35250 | _openlayers2.default.Map.prototype.forEachFeatureAtPixelDefault = _openlayers2.default.Map.prototype.forEachFeatureAtPixel; | |
| 35237 | 35251 | ||
| 35238 | 35252 | _openlayers2.default.Map.prototype.forEachFeatureAtPixel = _openlayers2.default.Map.prototype.Tc = function (pixel, callback, opt_options, e) { | |
@@ -35246,17 +35260,11 @@ var MapExtend = exports.MapExtend = function () { | |||
| 35246 | 35260 | var resolution = this.getView().getResolution(); | |
| 35247 | 35261 | var coordinate = this.getCoordinateFromPixel(pixel); | |
| 35248 | 35262 | ||
| 35249 | - var _loop = function _loop(i) { | ||
| 35250 | - //当前高效率点图层满足筛选条件/并且可视时,可被选中: | ||
| 35251 | - if (layers[i].getVisible() && layerFilter.call(null, layers[i]) && layers[i].getSource()._forEachFeatureAtCoordinate) { | ||
| 35252 | - layers[i].getSource()._forEachFeatureAtCoordinate(coordinate, resolution, function (feature) { | ||
| 35253 | - callback(feature, layers[i]); | ||
| 35254 | - }, pixel, e); | ||
| 35255 | - } | ||
| 35256 | - }; | ||
| 35257 | - | ||
| 35258 | 35263 | for (var i = 0; i < layers.length; i++) { | |
| 35259 | - _loop(i); | ||
| 35264 | + var layer = layers[i]; | ||
| 35265 | + if (layer.getVisible() && layerFilter.call(null, layer)) { | ||
| 35266 | + fun(layer, coordinate, resolution, callback, pixel, e); | ||
| 35267 | + } | ||
| 35260 | 35268 | } | |
| 35261 | 35269 | return this.forEachFeatureAtPixelDefault(pixel, callback, opt_options); | |
| 35262 | 35270 | }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,9 +9,23 @@ import ol from 'openlayers'; | |||
| 9 | 9 | * @private | |
| 10 | 10 | */ | |
| 11 | 11 | export var MapExtend = function () { | |
| 12 | + const fun = function (layer, coordinate, resolution, callback, pixel, e) { | ||
| 13 | + if (layer instanceof ol.layer.Group) { | ||
| 14 | + layer.getLayers().forEach(function (subLayer) { | ||
| 15 | + fun(subLayer, coordinate, resolution, callback, pixel, e) | ||
| 16 | + }); | ||
| 17 | + } else { | ||
| 18 | + //当前高效率点图层满足筛选条件/并且可视时,可被选中: | ||
| 19 | + if (layer.getSource()._forEachFeatureAtCoordinate) { | ||
| 20 | + layer.getSource()._forEachFeatureAtCoordinate(coordinate, resolution, (feature) => { | ||
| 21 | + callback(feature, layer) | ||
| 22 | + }, pixel, e); | ||
| 23 | + } | ||
| 24 | + } | ||
| 25 | + } | ||
| 12 | 26 | ol.Map.prototype.forEachFeatureAtPixelDefault = ol.Map.prototype.forEachFeatureAtPixel; | |
| 13 | 27 | ||
| 14 | - ol.Map.prototype.forEachFeatureAtPixel= ol.Map.prototype.Tc = function (pixel, callback, opt_options, e) { | ||
| 28 | + ol.Map.prototype.forEachFeatureAtPixel = ol.Map.prototype.Tc = function (pixel, callback, opt_options, e) { | ||
| 15 | 29 | ||
| 16 | 30 | //如果满足高效率图层选取要求优先返回高效率图层选中结果 | |
| 17 | 31 | const layerFilter = (opt_options && opt_options.layerFilter) ? opt_options.layerFilter : () => { | |
@@ -21,13 +35,13 @@ export var MapExtend = function () { | |||
| 21 | 35 | const layers = this.getLayers().getArray(); | |
| 22 | 36 | const resolution = this.getView().getResolution(); | |
| 23 | 37 | const coordinate = this.getCoordinateFromPixel(pixel); | |
| 38 | + | ||
| 24 | 39 | for (let i = 0; i < layers.length; i++) { | |
| 25 | - //当前高效率点图层满足筛选条件/并且可视时,可被选中: | ||
| 26 | - if (layers[i].getVisible() && layerFilter.call(null, layers[i]) && layers[i].getSource()._forEachFeatureAtCoordinate) { | ||
| 27 | - layers[i].getSource()._forEachFeatureAtCoordinate(coordinate, resolution, (feature) => { | ||
| 28 | - callback(feature, layers[i]) | ||
| 29 | - }, pixel, e); | ||
| 40 | + const layer = layers[i]; | ||
| 41 | + if (layer.getVisible() && layerFilter.call(null, layer)) { | ||
| 42 | + fun(layer, coordinate, resolution, callback, pixel, e) | ||
| 30 | 43 | } | |
| 44 | + | ||
| 31 | 45 | } | |
| 32 | 46 | return this.forEachFeatureAtPixelDefault(pixel, callback, opt_options); | |
| 33 | 47 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments