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

iTowns / itowns / 10635241580

30 Aug 2024 03:26PM UTC coverage: 86.966% (-2.8%) from 89.766%
10635241580

push

github

jailln
feat(3dtiles): add new OGC3DTilesLayer using 3d-tiles-renderer-js

Deprecate C3DTilesLayer (replaced by OGC3DTilesLayer).
Add new iGLTFLoader that loads gltf 1.0 and 2.0 files.

2791 of 3694 branches covered (75.55%)

Branch coverage included in aggregate %.

480 of 644 new or added lines in 8 files covered. (74.53%)

2144 existing lines in 111 files now uncovered.

24319 of 27479 relevant lines covered (88.5%)

1024.72 hits per line

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

93.59
/src/Source/EntwinePointTileSource.js
1
import proj4 from 'proj4';
1✔
2
import LASParser from 'Parser/LASParser';
1✔
3
import PotreeBinParser from 'Parser/PotreeBinParser';
1✔
4
import Fetcher from 'Provider/Fetcher';
1✔
5
import Source from 'Source/Source';
1✔
6

1✔
7
/**
1✔
8
 * @classdesc
1✔
9
 * An object defining the source of Entwine Point Tile data. It fetches and
1✔
10
 * parses the main configuration file of Entwine Point Tile format,
1✔
11
 * [`ept.json`](https://entwine.io/entwine-point-tile.html#ept-json).
1✔
12
 *
1✔
13
 * @extends Source
1✔
14
 *
1✔
15
 * @property {boolean} isEntwinePointTileSource - Used to checkout whether this
1✔
16
 * source is a EntwinePointTileSource. Default is true. You should not change
1✔
17
 * this, as it is used internally for optimisation.
1✔
18
 * @property {string} url - The URL of the directory containing the whole
1✔
19
 * Entwine Point Tile structure.
1✔
20
 */
1✔
21
class EntwinePointTileSource extends Source {
1✔
22
    /**
1✔
23
     * @constructor
1✔
24
     *
1✔
25
     * @param {Object} config - The configuration, see {@link Source} for
1✔
26
     * available values.
1✔
27
     * @param {number|string} [config.colorDepth='auto'] - Does the color
1✔
28
     * encoding is known ? Is it `8` or `16` bits ? By default it is to
1✔
29
     * `'auto'`, but it will be more performant if a specific value is set.
1✔
30
     */
1✔
31
    constructor(config) {
1✔
32
        super(config);
1✔
33

1✔
34
        this.isEntwinePointTileSource = true;
1✔
35
        this.colorDepth = config.colorDepth;
1✔
36

1✔
37
        // Necessary because we use the url without the ept.json part as a base
1✔
38
        this.url = this.url.replace('/ept.json', '');
1✔
39

1✔
40
        // https://entwine.io/entwine-point-tile.html#ept-json
1✔
41
        this.whenReady = Fetcher.json(`${this.url}/ept.json`, this.networkOptions).then((metadata) => {
1✔
42
            // Set parser and its configuration from schema
1✔
43
            this.parse = metadata.dataType === 'laszip' ? LASParser.parse : PotreeBinParser.parse;
1!
44
            this.extension = metadata.dataType === 'laszip' ? 'laz' : 'bin';
1!
45

1✔
46
            if (metadata.srs && metadata.srs.authority && metadata.srs.horizontal) {
1✔
47
                this.crs = `${metadata.srs.authority}:${metadata.srs.horizontal}`;
1✔
48
                if (!proj4.defs(this.crs)) {
1!
UNCOV
49
                    proj4.defs(this.crs, metadata.srs.wkt);
×
UNCOV
50
                }
×
51

1✔
52
                if (metadata.srs.vertical && metadata.srs.vertical !== metadata.srs.horizontal) {
1✔
53
                    console.warn('EntwinePointTileSource: Vertical coordinates system code is not yet supported.');
1✔
54
                }
1✔
55
            }
1✔
56

1✔
57
            // NOTE: this spacing is kinda arbitrary here, we take the width and
1✔
58
            // length (height can be ignored), and we divide by the specified
1✔
59
            // span in ept.json. This needs improvements.
1✔
60
            this.spacing = (Math.abs(metadata.boundsConforming[3] - metadata.boundsConforming[0])
1✔
61
                + Math.abs(metadata.boundsConforming[4] - metadata.boundsConforming[1])) / (2 * metadata.span);
1✔
62

1✔
63
            this.boundsConforming = metadata.boundsConforming;
1✔
64
            this.span = metadata.span;
1✔
65

1✔
66
            return this;
1✔
67
        });
1✔
68

1✔
69
        this.fetcher = Fetcher.arrayBuffer;
1✔
70
    }
1✔
71
}
1✔
72

1✔
73
export default EntwinePointTileSource;
1✔
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

© 2025 Coveralls, Inc