How to use the @igo2/utils.SubjectStatus.Done function in @igo2/utils

To help you get started, we’ve selected a few @igo2/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github infra-geo-ouverte / igo2-lib / projects / geo / src / lib / print / shared / print.service.ts View on Github external
positionHComment += 20;
            } else {
              // Don't cut last part
              newContext.fillText(
                comment.substr(positionFirstCutChar),
                width / 2,
                positionHComment
              );
            }
          }
        }
      }
      // Add map to new canvas
      newContext.drawImage(context.canvas, 0, positionHCanvas);

      let status = SubjectStatus.Done;
      try {
        // Save the canvas as file
        if (!doZipFile) {
          this.saveCanvasImageAsFile(newCanvas, 'map', format);
        } else if (format.toLowerCase() === 'tiff') {
          // Add the canvas to zip
          this.generateCanvaFileToZip(
            newCanvas,
            'map' + map.projection.replace(':', '_') + '.' + format
          );
        } else {
          // Add the canvas to zip
          this.generateCanvaFileToZip(newCanvas, 'map' + '.' + format);
        }
      } catch (err) {
        status = SubjectStatus.Error;
github infra-geo-ouverte / igo2-lib / packages / geo / src / lib / map / utils / layer-watcher.ts View on Github external
.subscribe(status => {
        if (status === SubjectStatus.Working) {
          this.loading += 1;
        } else if (status === SubjectStatus.Done) {
          this.loaded += 1;
        }

        if (this.loaded >= this.loading) {
          this.loading = this.loaded = 0;
          this.status = SubjectStatus.Done;
        } else if (this.loading > 0) {
          this.status = SubjectStatus.Working;
        }
      });
github infra-geo-ouverte / igo2-lib / projects / geo / src / lib / map / utils / layer-watcher.ts View on Github external
.subscribe(status => {
        if (status === SubjectStatus.Working) {
          this.loading += 1;
        } else if (status === SubjectStatus.Done) {
          this.loaded += 1;
        }

        if (this.loaded >= this.loading) {
          this.loading = this.loaded = 0;
          this.status = SubjectStatus.Done;
        } else if (this.loading > 0) {
          this.status = SubjectStatus.Working;
        }
      });
github infra-geo-ouverte / igo2-lib / projects / geo / src / lib / print / shared / print.service.ts View on Github external
const mapStatus$$ = map.status$.subscribe((mapStatus: SubjectStatus) => {
        clearTimeout(timeout);

        if (mapStatus !== SubjectStatus.Done) {
          return;
        }

        mapStatus$$.unsubscribe();

        let status = SubjectStatus.Done;
        try {
          this.addCanvas(doc, canvas, size, margins);
        } catch (err) {
          status = SubjectStatus.Error;
          this.messageService.error(
            this.languageService.translate.instant('igo.geo.printForm.corsErrorMessageBody'),
            this.languageService.translate.instant('igo.geo.printForm.corsErrorMessageHeader'),
            'print'
          );
        }
github infra-geo-ouverte / igo2-lib / packages / geo / src / lib / map / utils / layer-watcher.ts View on Github external
unwatchLayer(layer: Layer) {
    layer.status$.next(SubjectStatus.Done);
    const index = this.layers.indexOf(layer);
    if (index >= 0) {
      const status = (layer as any).watcher.status;
      if (
        [SubjectStatus.Working, SubjectStatus.Waiting].indexOf(status) !== -1
      ) {
        this.loaded += 1;
      }
      this.subscriptions[index].unsubscribe();
      this.subscriptions.splice(index, 1);
      this.layers.splice(index, 1);
      (layer as any).watcher.unwatch();
    }
  }
}
github infra-geo-ouverte / igo2-lib / projects / geo / src / lib / layer / utils / image-watcher.ts View on Github external
return;
    }

    const watcherIndex = event.image.__watchers__.indexOf(this.id);
    if (watcherIndex < 0) {
      return;
    }

    event.image.__watchers__.splice(watcherIndex, 1);

    this.loaded += 1;

    const loading = this.loading;
    if (this.loaded >= loading) {
      if (loading === this.loading) {
        this.status = SubjectStatus.Done;
        this.loaded = this.loading = 0;
      }
    }
  }
}
github infra-geo-ouverte / igo2-lib / packages / geo / src / lib / print / shared / print.service.ts View on Github external
(status: SubjectStatus) => {
        if (status === SubjectStatus.Done) {
          if (options.showLegend === true) {
            this.addLegend(doc, map, margins, resolution);
          } else {
            this.saveDoc(doc);
          }
        }

        if (status === SubjectStatus.Done || status === SubjectStatus.Error) {
          this.activityService.unregister(this.activityId);
          status$.next(SubjectStatus.Done);
        }
      }
    );
github infra-geo-ouverte / igo2-lib / projects / geo / src / lib / map / map-browser / map-browser.component.ts View on Github external
private handleStatusChange(status: SubjectStatus) {
    if (status === SubjectStatus.Working && this.activityId === undefined) {
      this.activityId = this.activityService.register();
    } else if (status === SubjectStatus.Done && this.activityId !== undefined) {
      this.activityService.unregister(this.activityId);
      this.activityId = undefined;
    }
  }
}
github infra-geo-ouverte / igo2-lib / projects / geo / src / lib / layer / utils / tile-watcher.ts View on Github external
return;
    }

    const watcherIndex = event.tile.__watchers__.indexOf(this.id);
    if (watcherIndex < 0) {
      return;
    }

    event.tile.__watchers__.splice(watcherIndex, 1);

    this.loaded += 1;

    const loading = this.loading;
    if (this.loaded >= loading) {
      if (loading === this.loading) {
        this.status = SubjectStatus.Done;
        this.loaded = this.loading = 0;
      }
    }
  }
}
github infra-geo-ouverte / igo2-lib / packages / geo / src / lib / print / shared / print.service.ts View on Github external
const mapStatus$$ = map.status$.subscribe((mapStatus: SubjectStatus) => {
        clearTimeout(timeout);

        if (mapStatus !== SubjectStatus.Done) {
          return;
        }

        mapStatus$$.unsubscribe();

        let status = SubjectStatus.Done;
        try {
          this.addCanvas(doc, canvas, margins);
        } catch (err) {
          status = SubjectStatus.Error;
          this.messageService.error(
            this.languageService.translate.instant(
              'igo.geo.printForm.corsErrorMessageBody'
            ),
            this.languageService.translate.instant(
              'igo.geo.printForm.corsErrorMessageHeader'
            ),
            'print'
          );
        }

        this.renderMap(map, mapSize, extent);