forked from iTowns/itowns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpotree2layerprocessing.js
More file actions
69 lines (63 loc) · 3.58 KB
/
potree2layerprocessing.js
File metadata and controls
69 lines (63 loc) · 3.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import assert from 'assert';
import { Group } from 'three';
import Potree2Layer from 'Layer/Potree2Layer';
import Potree2Node from 'Core/Potree2Node';
describe('preUpdate Potree2Layer', function () {
const context = { camera: { height: 1, camera3D: { fov: 1 } } };
const source = { baseurl: 'server.geo' };
const layer = {
id: 'a',
source,
hierarchyStepSize: 1,
object3d: new Group(),
};
before('create octree', () => {
layer.root = new Potree2Node(0, -1, 4000, 0, source);
layer.object3d.add(layer.root.clampOBB);
layer.root.voxelOBB.box3D.setFromArray([1000, 1000, 1000, 0, 0, 0]);
layer.root.add(new Potree2Node(1, 0, 3000, 0, source), 1);
layer.root.children[0].obj = { layer, isPoints: true };
layer.root.add(new Potree2Node(1, 1, 3000, 0, source), 2);
layer.root.children[1].obj = { layer, isPoints: true };
layer.root.add(new Potree2Node(1, 2, 3000, 0, source), 3);
layer.root.children[2].obj = { layer, isPoints: true };
layer.root.children[0].add(new Potree2Node(2, 0, 2000, 0, source), 1);
layer.root.children[0].children[0].obj = { layer, isPoints: true };
layer.root.children[0].add(new Potree2Node(2, 1, 2000, 0, source), 2);
layer.root.children[0].children[1].obj = { layer, isPoints: true };
layer.root.children[1].add(new Potree2Node(2, 2, 2000, 0, source), 1);
layer.root.children[1].children[0].obj = { layer, isPoints: true };
layer.root.children[2].add(new Potree2Node(2, 3, 2000, 0, source), 2);
layer.root.children[2].children[0].obj = { layer, isPoints: true };
layer.root.children[2].add(new Potree2Node(2, 4, 2000, 0, source), 3);
layer.root.children[2].children[1].obj = { layer, isPoints: true };
layer.root.children[0].children[0].add(new Potree2Node(3, 0, 1000, 0, source), 1);
layer.root.children[0].children[0].children[0].obj = { layer, isPoints: true };
layer.root.children[0].children[0].add(new Potree2Node(3, 1, 1000, 0, source), 5);
layer.root.children[0].children[0].children[1].obj = { layer, isPoints: true };
layer.root.children[0].children[1].add(new Potree2Node(3, 2, 1000, 0, source), 4);
layer.root.children[0].children[1].children[0].obj = { layer, isPoints: true };
layer.root.children[2].children[1].add(new Potree2Node(3, 3, 1000, 0, source), 1);
layer.root.children[2].children[1].children[0].obj = { layer, isPoints: true };
layer.root.children[2].children[1].add(new Potree2Node(3, 4, 1000, 0, source), 2);
layer.root.children[2].children[1].children[1].obj = { layer, isPoints: true };
layer.root.children[2].children[1].add(new Potree2Node(3, 5, 1000, 0, source), 3);
layer.root.children[2].children[1].children[2].obj = { layer, isPoints: true };
layer.root.children[2].children[1].add(new Potree2Node(3, 6, 1000, 0, source), 4);
layer.root.children[2].children[1].children[3].obj = { layer, isPoints: true };
});
it('should return root if no change source', () => {
const sources = new Set();
assert.deepStrictEqual(
layer.root,
Potree2Layer.prototype.preUpdate.call(layer, context, sources)[0]);
});
it('should return root', () => {
const sources = new Set();
sources.add(layer.root.children[0].children[0]);
sources.add(layer.root.children[2].children[1]);
assert.deepStrictEqual(
layer.root,
Potree2Layer.prototype.preUpdate.call(layer, context, sources)[0]);
});
});