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

Method setSourceByID

modules/core/ImagerySystem.js:458–475  ·  view source on GitHub ↗

* setSourceByID * Activates the base layer with the given `sourceID` * This function will correctly handle IDs like `EsriWayback_ `. * @param {string} sourceID - The sourceID to activate * @return {ImagerySource?} The `ImagerySource` with the given ID, or `null` if not found

(sourceID)

Source from the content-addressed store, hash-verified

456 * @return {ImagerySource?} The `ImagerySource` with the given ID, or `null` if not found
457 */
458 setSourceByID(sourceID) {
459 if (!this._imageryIndex) return null; // called before init()?
460
461 let date;
462 const match = sourceID.match(/^EsriWayback\_?(.*)$/i); // get start date, if any
463 if (match) {
464 sourceID = 'EsriWayback';
465 date = match[1];
466 }
467
468 const source = this.getSourceByID(sourceID);
469 if (source) {
470 if (date) {
471 source.date = date;
472 }
473 this.baseLayerSource(source);
474 }
475 }
476
477
478 /**

Callers 2

_hashchangeMethod · 0.95
chooseBackgroundFunction · 0.80

Calls 3

getSourceByIDMethod · 0.95
baseLayerSourceMethod · 0.95
matchMethod · 0.80

Tested by

no test coverage detected