* 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)
| 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 | /** |
no test coverage detected