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

iTowns / itowns / 10902507646

17 Sep 2024 11:56AM UTC coverage: 86.931% (-0.03%) from 86.964%
10902507646

push

github

Desplandis
release v2.44.2

2791 of 3694 branches covered (75.55%)

Branch coverage included in aggregate %.

24241 of 27402 relevant lines covered (88.46%)

1027.5 hits per line

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

94.62
/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
 * PotreeSource are object containing informations on how to fetch points cloud resources.
1✔
8
 */
1✔
9

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

5✔
67
        super(source);
5✔
68
        this.file = source.file;
5✔
69
        this.fetcher = Fetcher.arrayBuffer;
5✔
70
        this.extensionOctree = 'hrc';
5✔
71

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

5✔
81
                return cloud;
5✔
82
            });
5✔
83
    }
5✔
84
}
1✔
85

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