How to use the @bentley/bentleyjs-core.Id64.forEach function in @bentley/bentleyjs-core

To help you get started, we’ve selected a few @bentley/bentleyjs-core 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 imodeljs / imodeljs / core / frontend / src / SubCategoriesCache.ts View on Github external
private pushNext(categoryIds: Id64Arg, func: QueueFunc): void {
      assert(undefined !== this._current);
      assert(undefined !== this._request);

      if (undefined === this._next) {
        // We have a request currently in process and none pending.
        // We could potentially determine that this request doesn't require any categories that are not already loaded or being loaded by the current request.
        // But we will find that out (synchronously) when current request completes, unless more requests come in. Probably not worth it.
        this._next = new QueueEntry(Id64.toIdSet(categoryIds, true), func);
      } else {
        // We have a request currently in process, and one or more pending. Append this one to the pending.
        this._next.funcs.push(func);
        Id64.forEach(categoryIds, (categoryId) => {
          this._next!.categoryIds.add(categoryId);
        });
      }
    }
  }
github imodeljs / imodeljs / core / frontend / src / SubCategoriesCache.ts View on Github external
public load(categoryIds: Id64Arg): SubCategoriesRequest | undefined {
    let missing: Id64Set | undefined;
    Id64.forEach(categoryIds, (catId) => {
      if (undefined === this._byCategoryId.get(catId)) {
        if (undefined === missing)
          missing = new Set();

        missing.add(catId);
      }
    });

    if (undefined === missing)
      return undefined;

    const request = new SubCategoriesCache.Request(missing, this._imodel);
    const promise = request.dispatch().then((result?: SubCategoriesCache.Result) => {
      if (undefined !== result)
        this.processResults(result, missing!);
github imodeljs / imodeljs / core / frontend / src / CategorySelectorState.ts View on Github external
public addCategories(arg: Id64Arg): void {
    Id64.forEach(arg, (id) => this.categories.add(id));
  }
github imodeljs / imodeljs / core / frontend / src / ModelSelectorState.ts View on Github external
public addModels(arg: Id64Arg): void {
    Id64.forEach(arg, (id) => this.models.add(id));
  }
github imodeljs / imodeljs / presentation / frontend / src / selection / SelectionManager.ts View on Github external
public async remove(transientIds: Id64Arg, persistentIds: Id64Arg, level: number): Promise {
    const keys = await this.manager.scopes.computeSelection(this.imodel, persistentIds, this.scope);
    Id64.forEach(transientIds, (id) => keys.add({ className: TRANSIENT_ELEMENT_CLASSNAME, id }));
    this.manager.removeFromSelection(this.name, this.imodel, keys, level);
  }
  public async replace(transientIds: Id64Arg, persistentIds: Id64Arg, level: number): Promise {
github imodeljs / imodeljs / core / frontend / src / SelectionSet.ts View on Github external
private _add(elem: Id64Arg, sendEvent = true): boolean {
    const oldSize = this.elements.size;
    Id64.forEach(elem, (id) => this.elements.add(id));
    const changed = oldSize !== this.elements.size;
    if (sendEvent && changed)
      this.sendChangedEvent({ type: SelectionSetEventType.Add, set: this, added: elem });

    return changed;
  }
github imodeljs / imodeljs / core / frontend / src / SelectionSet.ts View on Github external
private _remove(elem: Id64Arg, sendEvent = true): boolean {
    const oldSize = this.elements.size;
    Id64.forEach(elem, (id) => this.elements.delete(id));
    const changed = oldSize !== this.elements.size;
    if (sendEvent && changed)
      this.sendChangedEvent({ type: SelectionSetEventType.Remove, set: this, removed: elem });

    return changed;
  }
github imodeljs / imodeljs / core / frontend / src / IModelConnection.ts View on Github external
public filterLoaded(modelIds: Id64Arg): Id64Set | undefined {
      let unloaded: Set | undefined;
      Id64.forEach(modelIds, (id) => {
        if (undefined === this.getLoaded(id)) {
          if (undefined === unloaded)
            unloaded = new Set();

          unloaded.add(id);
        }
      });

      return unloaded;
    }