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

iTowns / itowns / 11176800049

04 Oct 2024 08:40AM UTC coverage: 86.957% (+0.01%) from 86.944%
11176800049

Pull #2272

github

web-flow
Merge 403f304ec into c862ca737
Pull Request #2272: PointCloudData reprojection into view CRS ('a la volee')

2835 of 3760 branches covered (75.4%)

Branch coverage included in aggregate %.

540 of 685 new or added lines in 18 files covered. (78.83%)

6 existing lines in 2 files now uncovered.

24906 of 28142 relevant lines covered (88.5%)

1213.09 hits per line

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

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

2✔
31
        this.isEntwinePointTileSource = true;
2✔
32
        this.colorDepth = config.colorDepth;
2✔
33

2✔
34
        // Necessary because we use the url without the ept.json part as a base
2✔
35
        this.url = this.url.replace('/ept.json', '');
2✔
36

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

2✔
43
            if (metadata.srs) {
2✔
44
                if (metadata.srs.authority && metadata.srs.horizontal) {
2✔
45
                    this.crs = `${metadata.srs.authority}:${metadata.srs.horizontal}`;
1✔
46
                    if (!proj4.defs(this.crs)) {
1!
NEW
47
                        proj4.defs(this.crs, metadata.srs.wkt);
×
NEW
48
                    }
×
49
                } else if (metadata.srs.wkt) {
1✔
50
                    proj4.defs('unknown', metadata.srs.wkt);
1✔
51
                    this.crs = proj4.defs('unknown').name;
1✔
52
                    proj4.defs(this.crs, proj4.defs('unknown'));
1✔
53
                }
1✔
54
                if (metadata.srs.vertical && metadata.srs.vertical !== metadata.srs.horizontal) {
2✔
55
                    console.warn('EntwinePointTileSource: Vertical coordinates system code is not yet supported.');
1✔
56
                }
1✔
57
            }
2✔
58

2✔
59
            this.boundsConforming = metadata.boundsConforming;
2✔
60
            this.bounds = metadata.bounds;
2✔
61
            this.span = metadata.span;
2✔
62

2✔
63
            return this;
2✔
64
        });
2✔
65

2✔
66
        this.fetcher = Fetcher.arrayBuffer;
2✔
67
    }
2✔
68
}
1✔
69

1✔
70
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