• 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

94.9
/src/Source/PotreeSource.js
1
import Source from 'Source/Source';
1✔
2
import Fetcher from 'Provider/Fetcher';
1✔
3
import PotreeBinParser from 'Parser/PotreeBinParser';
1✔
4
import PotreeCinParser from 'Parser/PotreeCinParser';
1✔
5

1✔
6
/**
1✔
7
 * @classdesc
1✔
8
 * PotreeSource are object containing informations on how to fetch points cloud resources.
1✔
9
 *
1✔
10
 *
1✔
11
 */
1✔
12

1✔
13
class PotreeSource extends Source {
1✔
14
    /**
1✔
15
     * @param {Object} source - An object that can contain all properties of a
1✔
16
     * PotreeSource
1✔
17
     * @param {string} source.url - folder url.
1✔
18
     * @param {string} source.file - cloud file name.
1✔
19
     *
1✔
20
     * This `cloud` file stores information about the potree cloud in JSON format. the structure is :
1✔
21
     *
1✔
22
     * * __`version`__ - The cloud.js format may change over time. The version number is
1✔
23
     * necessary so that parsers know how to interpret the data.
1✔
24
     * * __`octreeDir`__ - Directory or URL where node data is stored. Usually points to
1✔
25
     * "data".
1✔
26
     * * __`boundingBox`__ - Contains the minimum and maximum of the axis aligned bounding box. This bounding box is cubic and aligned to fit to the octree root.
1✔
27
     * * __`tightBoundingBox`__ - This bounding box thightly fits the point data.
1✔
28
     * * __`pointAttributes`__ - Declares the point data format. May be 'LAS', 'LAZ' or in case if the BINARY format an array of attributes like
1✔
29
     * `['POSITION_CARTESIAN', 'COLOR_PACKED', 'INTENSITY']`
1✔
30
     * * __`POSITION_CARTESIAN`__ - 3 x 32bit signed integers for x/y/z coordinates
1✔
31
     * * __`COLOR_PACKED`__ - 4 x unsigned byte for r,g,b,a colors.
1✔
32
     * * __`spacing`__ - The minimum distance between points at root level.
1✔
33
     * ```
1✔
34
     * {
1✔
35
     *     version: '1.6',
1✔
36
     *     octreeDir: 'data',
1✔
37
     *     boundingBox: {
1✔
38
     *         lx: -4.9854,
1✔
39
     *         ly: 1.0366,
1✔
40
     *         lz: -3.4494,
1✔
41
     *         ux: 0.702300000000001,
1✔
42
     *         uy: 6.7243,
1✔
43
     *         uz: 2.2383
1✔
44
     *     },
1✔
45
     *     tightBoundingBox: {
1✔
46
     *         lx: -4.9854,
1✔
47
     *         ly: 1.0375,
1✔
48
     *         lz: -3.4494,
1✔
49
     *         ux: -0.7889,
1✔
50
     *         uy: 6.7243,
1✔
51
     *         uz: 1.1245
1✔
52
     *     },
1✔
53
     *     pointAttributes: [
1✔
54
     *         'POSITION_CARTESIAN',
1✔
55
     *         'COLOR_PACKED'
1✔
56
     *     ],
1✔
57
     *     spacing: 0.03,
1✔
58
     *     scale: 0.001,
1✔
59
     *     hierarchyStepSize: 5
1✔
60
     * }
1✔
61
     * ```
1✔
62
     *
1✔
63
     * @extends Source
1✔
64
     *
1✔
65
     * @constructor
1✔
66
     */
1✔
67
    constructor(source) {
1✔
68
        if (!source.file) {
5!
UNCOV
69
            throw new Error('New PotreeSource: file is required');
×
UNCOV
70
        }
×
71

5✔
72
        super(source);
5✔
73
        this.file = source.file;
5✔
74
        this.fetcher = Fetcher.arrayBuffer;
5✔
75
        this.extensionOctree = 'hrc';
5✔
76

5✔
77
        // For cloud specification visit:
5✔
78
        // https://github.com/PropellerAero/potree-propeller-private/blob/master/docs/file_format.md#cloudjs
5✔
79
        this.whenReady = (source.cloud ? Promise.resolve(source.cloud) : Fetcher.json(`${this.url}/${this.file}`, this.networkOptions))
5✔
80
            .then((cloud) => {
5✔
81
                this.pointAttributes = cloud.pointAttributes;
5✔
82
                this.baseurl = `${this.url}/${cloud.octreeDir}/r`;
5✔
83
                this.extension = cloud.pointAttributes === 'CIN' ? 'cin' : 'bin';
5!
84
                this.parse = this.extension === 'cin' ? PotreeCinParser.parse : PotreeBinParser.parse;
5!
85

5✔
86
                return cloud;
5✔
87
            });
5✔
88
    }
5✔
89
}
1✔
90

1✔
91
export default PotreeSource;
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

© 2026 Coveralls, Inc