MCPcopy Create free account
hub / github.com/facebook/Rapid / baseLayerSource

Method baseLayerSource

modules/core/ImagerySystem.js:377–407  ·  view source on GitHub ↗

*

(source)

Source from the content-addressed store, hash-verified

375 *
376 */
377 baseLayerSource(source) {
378 if (!arguments.length) return this._baseLayer;
379
380 // test source against OSM imagery blocklists..
381 const osm = this.context.services.osm;
382 if (!osm) return this;
383
384 const blocklists = osm?.imageryBlocklists ?? [];
385 const template = source.template;
386 let fail = false;
387 let tested = 0;
388 let regex;
389
390 for (regex of blocklists) {
391 fail = regex.test(template);
392 tested++;
393 if (fail) break;
394 }
395
396 // ensure at least one test was run.
397 if (!tested) {
398 regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
399 fail = regex.test(template);
400 }
401
402 this._baseLayer = (!fail ? source : this.getSourceByID('none'));
403
404 this._imageryChanged();
405 this.emit('imagerychange');
406 return this;
407 }
408
409
410 /**

Callers 11

_hashchangeMethod · 0.95
setSourceByIDMethod · 0.95
renderMethod · 0.80
renderMethod · 0.80
_startIntroFunction · 0.80
_finishFunction · 0.80
chooseBackgroundFunction · 0.80
chooseBackgroundFunction · 0.80
stepBackgroundFunction · 0.80
renderMethod · 0.80
updateMetadataMethod · 0.80

Calls 2

getSourceByIDMethod · 0.95
_imageryChangedMethod · 0.95

Tested by

no test coverage detected