load() {
    if (this.state == TileState.IDLE) {
      this.state = TileState.LOADING;
      this.changed();

      let leftToLoad = 0;

      this.sourcesListenerKeys_ = [];
      this.sourceTiles_.forEach(
        function (tile, i, arr) {
          const state = tile.getState();
          if (state == TileState.IDLE || state == TileState.LOADING) {
            leftToLoad++;

            const sourceListenKey = listen(
              tile,
              EventType.CHANGE,
              function (e) {
                const state = tile.getState();
                if (
                  state == TileState.LOADED ||
                  state == TileState.ERROR ||
                  state == TileState.EMPTY
                ) {
                  unlistenByKey(sourceListenKey);
                  leftToLoad--;
                  if (leftToLoad === 0) {
                    this.unlistenSources_();
                    this.reproject_();
                  }
                }
              },
              this
            );
            this.sourcesListenerKeys_.push(sourceListenKey);
          }
        }.bind(this)
      );

      if (leftToLoad === 0) {
        setTimeout(this.reproject_.bind(this), 0);
      } else {
        this.sourceTiles_.forEach(function (tile, i, arr) {
          const state = tile.getState();
          if (state == TileState.IDLE) {
            tile.load();
          }
        });
      }
    }
  }
/**
   * Load not yet loaded URI.
   */
Load not yet loaded URI.
Load not yet loaded URI .
load() {
    if (this.state == TileState.IDLE) {
      this.state = TileState.LOADING;
      this.changed();
      let leftToLoad = 0;
      this.sourcesListenerKeys_ = [];
      this.sourceTiles_.forEach(
        function (tile, i, arr) {
          const state = tile.getState();
          if (state == TileState.IDLE || state == TileState.LOADING) {
            leftToLoad++;
            const sourceListenKey = listen(
              tile,
              EventType.CHANGE,
              function (e) {
                const state = tile.getState();
                if (
                  state == TileState.LOADED ||
                  state == TileState.ERROR ||
                  state == TileState.EMPTY
                ) {
                  unlistenByKey(sourceListenKey);
                  leftToLoad--;
                  if (leftToLoad === 0) {
                    this.unlistenSources_();
                    this.reproject_();
                  }
                }
              },
              this
            );
            this.sourcesListenerKeys_.push(sourceListenKey);
          }
        }.bind(this)
      );
      if (leftToLoad === 0) {
        setTimeout(this.reproject_.bind(this), 0);
      } else {
        this.sourceTiles_.forEach(function (tile, i, arr) {
          const state = tile.getState();
          if (state == TileState.IDLE) {
            tile.load();
          }
        });
      }
    }
  }
load ( ) { if ( this . state == TileState . IDLE ) { this . state = TileState . LOADING ; this . changed ( ) ; let leftToLoad = 0 ; this . sourcesListenerKeys_ = [ ] ; this . sourceTiles_ . forEach ( function ( tile , i , arr ) { const state = tile . getState ( ) ; if ( state == TileState . IDLE || state == TileState . LOADING ) { leftToLoad ++ ; const sourceListenKey = listen ( tile , EventType . CHANGE , function ( e ) { const state = tile . getState ( ) ; if ( state == TileState . LOADED || state == TileState . ERROR || state == TileState . EMPTY ) { unlistenByKey ( sourceListenKey ) ; leftToLoad -- ; if ( leftToLoad === 0 ) { this . unlistenSources_ ( ) ; this . reproject_ ( ) ; } } } , this ) ; this . sourcesListenerKeys_ . push ( sourceListenKey ) ; } } . bind ( this ) ) ; if ( leftToLoad === 0 ) { setTimeout ( this . reproject_ . bind ( this ) , 0 ) ; } else { this . sourceTiles_ . forEach ( function ( tile , i , arr ) { const state = tile . getState ( ) ; if ( state == TileState . IDLE ) { tile . load ( ) ; } } ) ; } } }
Load not yet loaded URI.
Load not yet loaded URI .