onWorkerComplete_(frameState, err, output, data) {
    if (err || !output) {
      return;
    }

    // do nothing if extent or resolution changed
    const extent = frameState.extent;
    const resolution = frameState.viewState.resolution;
    if (
      resolution !== this.requestedFrameState_.viewState.resolution ||
      !equals(extent, this.requestedFrameState_.extent)
    ) {
      return;
    }

    let context;
    if (this.renderedImageCanvas_) {
      context = this.renderedImageCanvas_.getImage().getContext('2d');
    } else {
      const width = Math.round(getWidth(extent) / resolution);
      const height = Math.round(getHeight(extent) / resolution);
      context = createCanvasContext2D(width, height);
      this.renderedImageCanvas_ = new ImageCanvas(
        extent,
        resolution,
        1,
        context.canvas
      );
    }
    context.putImageData(output, 0, 0);

    this.changed();
    this.renderedRevision_ = this.getRevision();

    this.dispatchEvent(
      new RasterSourceEvent(RasterEventType.AFTEROPERATIONS, frameState, data)
    );
    if (frameState.animate) {
      requestAnimationFrame(this.changed.bind(this));
    }
  }
/**
   * Called when pixel processing is complete.
   * @param {import("../PluggableMap.js").FrameState} frameState The frame state.
   * @param {Error} err Any error during processing.
   * @param {ImageData} output The output image data.
   * @param {Object|Array<Object>} data The user data (or an array if more than one thread).
   * @private
   */
Called when pixel processing is complete.
Called when pixel processing is complete .
onWorkerComplete_(frameState, err, output, data) {
    if (err || !output) {
      return;
    }
    const extent = frameState.extent;
    const resolution = frameState.viewState.resolution;
    if (
      resolution !== this.requestedFrameState_.viewState.resolution ||
      !equals(extent, this.requestedFrameState_.extent)
    ) {
      return;
    }
    let context;
    if (this.renderedImageCanvas_) {
      context = this.renderedImageCanvas_.getImage().getContext('2d');
    } else {
      const width = Math.round(getWidth(extent) / resolution);
      const height = Math.round(getHeight(extent) / resolution);
      context = createCanvasContext2D(width, height);
      this.renderedImageCanvas_ = new ImageCanvas(
        extent,
        resolution,
        1,
        context.canvas
      );
    }
    context.putImageData(output, 0, 0);
    this.changed();
    this.renderedRevision_ = this.getRevision();
    this.dispatchEvent(
      new RasterSourceEvent(RasterEventType.AFTEROPERATIONS, frameState, data)
    );
    if (frameState.animate) {
      requestAnimationFrame(this.changed.bind(this));
    }
  }
onWorkerComplete_ ( frameState , err , output , data ) { if ( err || ! output ) { return ; } const extent = frameState . extent ; const resolution = frameState . viewState . resolution ; if ( resolution !== this . requestedFrameState_ . viewState . resolution || ! equals ( extent , this . requestedFrameState_ . extent ) ) { return ; } let context ; if ( this . renderedImageCanvas_ ) { context = this . renderedImageCanvas_ . getImage ( ) . getContext ( '2d' ) ; } else { const width = Math . round ( getWidth ( extent ) / resolution ) ; const height = Math . round ( getHeight ( extent ) / resolution ) ; context = createCanvasContext2D ( width , height ) ; this . renderedImageCanvas_ = new ImageCanvas ( extent , resolution , 1 , context . canvas ) ; } context . putImageData ( output , 0 , 0 ) ; this . changed ( ) ; this . renderedRevision_ = this . getRevision ( ) ; this . dispatchEvent ( new RasterSourceEvent ( RasterEventType . AFTEROPERATIONS , frameState , data ) ) ; if ( frameState . animate ) { requestAnimationFrame ( this . changed . bind ( this ) ) ; } }
Called when pixel processing is complete.
Called when pixel processing is complete .
// do nothing if extent or resolution changed