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

iTowns / itowns / 14972829038

12 May 2025 12:56PM UTC coverage: 86.594% (-0.5%) from 87.093%
14972829038

Pull #2495

github

web-flow
Merge 84bc0780e into 2fae44bf1
Pull Request #2495: Priority queue

2769 of 3717 branches covered (74.5%)

Branch coverage included in aggregate %.

68 of 216 new or added lines in 4 files covered. (31.48%)

70 existing lines in 5 files now uncovered.

25716 of 29178 relevant lines covered (88.13%)

786.38 hits per line

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

98.32
/packages/Main/src/Core/EntwinePointTileNode.js
1
import Fetcher from 'Provider/Fetcher';
1✔
2
import PointCloudNode from 'Core/PointCloudNode';
1✔
3

1✔
4
function buildId(depth, x, y, z) {
122✔
5
    return `${depth}-${x}-${y}-${z}`;
122✔
6
}
122✔
7

1✔
8
/**
1✔
9
 * @extends PointCloudNode
1✔
10
 *
1✔
11
 * @property {boolean} isEntwinePointTileNode - Used to checkout whether this
1✔
12
 * node is a EntwinePointTileNode. Default is `true`. You should not change
1✔
13
 * this, as it is used internally for optimisation.
1✔
14
 * @property {number} depth - The depth of the node in the tree - see the
1✔
15
 * [Entwine
1✔
16
 * documentation](https://entwine.io/entwine-point-tile.html#ept-data)
1✔
17
 * @property {number} x - The x coordinate of the node in the tree - see the
1✔
18
 * [Entwine
1✔
19
 * documentation](https://entwine.io/entwine-point-tile.html#ept-data)
1✔
20
 * @property {number} y - The y coordinate of the node in the tree - see the
1✔
21
 * [Entwine
1✔
22
 * documentation](https://entwine.io/entwine-point-tile.html#ept-data)
1✔
23
 * @property {number} z - The z coordinate of the node in the tree - see the
1✔
24
 * [Entwine
1✔
25
 * documentation](https://entwine.io/entwine-point-tile.html#ept-data)
1✔
26
 * @property {string} id - The id of the node, constituted of the four
1✔
27
 * components: `depth-x-y-z`.
1✔
28
 */
1✔
29
class EntwinePointTileNode extends PointCloudNode {
1✔
30
    /**
1✔
31
     * Constructs a new instance of EntwinePointTileNode.
1✔
32
     *
1✔
33
     * @constructor
1✔
34
     *
1✔
35
     * @param {number} depth - The depth of the node in the tree - see the
1✔
36
     * [Entwine
1✔
37
     * documentation](https://entwine.io/entwine-point-tile.html#ept-data)
1✔
38
     * @param {number} x - The x coordinate of the node in the tree - see the
1✔
39
     * [Entwine
1✔
40
     * documentation](https://entwine.io/entwine-point-tile.html#ept-data)
1✔
41
     * @param {number} y - The y coordinate of the node in the tree - see the
1✔
42
     * [Entwine
1✔
43
     * documentation](https://entwine.io/entwine-point-tile.html#ept-data)
1✔
44
     * @param {number} z - The z coordinate of the node in the tree - see the
1✔
45
     * [Entwine
1✔
46
     * documentation](https://entwine.io/entwine-point-tile.html#ept-data)
1✔
47
     * @param {EntwinePointTileLayer} layer - The layer the node is attached to.
1✔
48
     * @param {number} [numPoints=0] - The number of points in this node. If
1✔
49
     * `-1`, it means that the octree hierarchy associated to this node needs to
1✔
50
     * be loaded.
1✔
51
     */
1✔
52
    constructor(depth, x, y, z, layer, numPoints = 0) {
1✔
53
        super(numPoints, layer);
26✔
54
        this.isEntwinePointTileNode = true;
26✔
55

26✔
56
        this.depth = depth;
26✔
57
        this.x = x;
26✔
58
        this.y = y;
26✔
59
        this.z = z;
26✔
60

26✔
61
        this.id = buildId(depth, x, y, z);
26✔
62

26✔
63
        this.url = `${this.layer.source.url}/ept-data/${this.id}.${this.layer.source.extension}`;
26✔
64
    }
26✔
65

1✔
66
    get octreeIsLoaded() {
1✔
UNCOV
67
        return this.numPoints >= 0;
×
UNCOV
68
    }
×
69

1✔
70
    loadOctree() {
1✔
71
        const hierarchyUrl = `${this.layer.source.url}/ept-hierarchy/${this.id}.json`;
1✔
72
        return Fetcher.json(hierarchyUrl, this.layer.source.networkOptions).then((hierarchy) => {
1✔
73
            this.numPoints = hierarchy[this.id];
1✔
74

1✔
75
            const stack = [];
1✔
76
            stack.push(this);
1✔
77

1✔
78
            while (stack.length) {
1✔
79
                const node = stack.shift();
12✔
80
                const depth = node.depth + 1;
12✔
81
                const x = node.x * 2;
12✔
82
                const y = node.y * 2;
12✔
83
                const z = node.z * 2;
12✔
84

12✔
85
                node.findAndCreateChild(depth, x,     y,     z,     hierarchy, stack);
12✔
86
                node.findAndCreateChild(depth, x + 1, y,     z,     hierarchy, stack);
12✔
87
                node.findAndCreateChild(depth, x,     y + 1, z,     hierarchy, stack);
12✔
88
                node.findAndCreateChild(depth, x + 1, y + 1, z,     hierarchy, stack);
12✔
89
                node.findAndCreateChild(depth, x,     y,     z + 1, hierarchy, stack);
12✔
90
                node.findAndCreateChild(depth, x + 1, y,     z + 1, hierarchy, stack);
12✔
91
                node.findAndCreateChild(depth, x,     y + 1, z + 1, hierarchy, stack);
12✔
92
                node.findAndCreateChild(depth, x + 1, y + 1, z + 1, hierarchy, stack);
12✔
93
            }
12✔
94
        });
1✔
95
    }
1✔
96

1✔
97
    findAndCreateChild(depth, x, y, z, hierarchy, stack) {
1✔
98
        const id = buildId(depth, x, y, z);
96✔
99
        const numPoints = hierarchy[id];
96✔
100

96✔
101
        if (typeof numPoints == 'number') {
96✔
102
            const child = new EntwinePointTileNode(depth, x, y, z, this.layer, numPoints);
11✔
103
            this.add(child);
11✔
104
            stack.push(child);
11✔
105
        }
11✔
106
    }
96✔
107
}
1✔
108

1✔
109
export default EntwinePointTileNode;
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