-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathmultipolygon.test.js
More file actions
57 lines (48 loc) · 1.37 KB
/
multipolygon.test.js
File metadata and controls
57 lines (48 loc) · 1.37 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
/**
* @jest-environment jsdom
*/
import { Shape, Mesh } from 'three';
import { TextEncoder } from 'node:util';
global.TextEncoder = TextEncoder;
import { Building } from '../src/building.js';
import { MultiBuildingPart } from '../src/multibuildingpart.js';
const data = `
<osm>
<node id="3" lat="4" lon="4"/>
<node id="5" lat="4" lon="4.001"/>
<node id="6" lat="4.001" lon="4.001"/>
<node id="7" lat="4.001" lon="4"/>
<relation id="4">
<member ref="1" role="outer" type="way"/>
<tag k="type" v="multipolygon"/>
<tag k="building" v="yes"/>
<tag k="roof:shape" v="skillion"/>
<tag k="roof:direction" v="0"/>
<tag k="roof:angle" v="45"/>
</relation>
<way id="1">
<nd ref="3"/>
<nd ref="5"/>
<nd ref="6"/>
<nd ref="7"/>
<nd ref="3"/>
</way>
</osm>`;
beforeEach(() => {
errors = [];
});
test('Test Simple Multipolygon', () => {
let xmlData = new window.DOMParser().parseFromString(data, 'text/xml');
const nodelist = Building.buildNodeList(xmlData);
const shape = new MultiBuildingPart('4', xmlData, nodelist);
expect(shape.id).toBe('4');
expect(shape.shape).toBeInstanceOf(Shape);
// expect(shape.roof).toBeInstanceOf(Mesh);
expect(errors.length).toBe(0);
});
// @todo Test a multipolygon with multiple closed outer ways.
window.printError = printError;
var errors = [];
function printError(txt) {
errors.push[txt];
}