• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visgl / loaders.gl / 25070233425

28 Apr 2026 06:20PM UTC coverage: 59.434% (+0.01%) from 59.423%
25070233425

push

github

web-flow
website: Add tabs for navigating between format docs (#3407)

11310 of 20887 branches covered (54.15%)

Branch coverage included in aggregate %.

89 of 136 new or added lines in 13 files covered. (65.44%)

1742 existing lines in 132 files now uncovered.

23500 of 37682 relevant lines covered (62.36%)

16296.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

3.13
/modules/deck-layers/src/data-driven-tile-3d-source-layer.ts
1
// loaders.gl
2
// SPDX-License-Identifier: MIT
3
// Copyright (c) vis.gl contributors
4

5
import {DataDrivenTile3DLayer} from './data-driven-tile-3d-layer';
6
import {Tileset3D, type Tileset3DProps} from '@loaders.gl/tiles';
7
import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';
8
import {createSource} from './tile-3d-source-layer';
9

10
/**
11
 * Internal `DataDrivenTile3DLayer` adapter that constructs source-backed `Tileset3D` instances.
12
 *
13
 * This class is exported for internal repository use and examples, and is not documented
14
 * beyond these TSDoc comments.
15
 */
16
export class SourceDataDrivenTile3DLayer<
17
  DataT = any,
18
  ExtraProps extends Record<string, unknown> = Record<string, unknown>
19
> extends DataDrivenTile3DLayer<DataT, ExtraProps> {
20
  /** deck.gl layer name used for warnings, defaults, and diagnostics. */
UNCOV
21
  static layerName = 'SourceDataDrivenTile3DLayer';
6✔
22

23
  /** Install source-backed loading hooks after the base layer initializes its state. */
24
  initializeState(): void {
25
    super.initializeState();
×
26
    (this as any)._loadTileset = this.loadSourceTileset.bind(this);
×
27
  }
28

29
  /**
30
   * Loads a tileset using explicit source construction.
31
   * @param tilesetUrl Root tileset metadata URL.
32
   */
33
  private async loadSourceTileset(tilesetUrl: string): Promise<void> {
34
    const {loadOptions = {}} = this.props;
×
35

36
    // TODO: deprecate `loader` in v9.0
37
    // @ts-ignore
38
    const loaders = this.props.loader || this.props.loaders;
×
39
    const loader = (Array.isArray(loaders) ? loaders[0] : loaders) as LoaderWithParser;
×
40

41
    const options: {loadOptions: LoaderOptions} & Partial<Tileset3DProps> = {
×
42
      loadOptions: {...loadOptions}
43
    };
44
    let actualTilesetUrl = tilesetUrl;
×
45

46
    if (loader.preload) {
×
47
      const preloadOptions = await loader.preload(tilesetUrl, loadOptions);
×
48
      if (preloadOptions.url) {
×
49
        actualTilesetUrl = preloadOptions.url;
×
50
      }
51

52
      if (preloadOptions.headers) {
×
53
        options.loadOptions.fetch = {
×
54
          ...options.loadOptions.fetch,
55
          headers: preloadOptions.headers
56
        };
57
      }
58
      Object.assign(options, preloadOptions);
×
59
    }
60

61
    const source = createSource(actualTilesetUrl, loader, options.loadOptions);
×
62
    const tileset3d = new Tileset3D(source, {
×
63
      onTileLoad: (this as any)._onTileLoad.bind(this),
64
      onTileUnload: (this as any)._onTileUnload.bind(this),
65
      onTileError: this.props.onTileError,
66
      onTraversalComplete: (this as any)._onTraversalComplete.bind(this),
67
      ...options
68
    });
69

70
    this.setState({
×
71
      tileset3d,
72
      layerMap: {}
73
    });
74

75
    await tileset3d.tilesetInitializationPromise;
×
76
    (this as any)._updateTileset(this.state.activeViewports);
×
77
    this.props.onTilesetLoad?.(tileset3d);
×
78
  }
79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc