@operato/scene-indoor-map 8.0.0-beta.1 → 9.0.0-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +3 -3
- package/CHANGELOG.md +0 -830
- package/demo/imu-mqtt-node/imu-publisher.js +0 -66
- package/demo/imu-mqtt-node/package.json +0 -16
- package/demo/index-camera.html +0 -108
- package/demo/index-gaussian.html +0 -184
- package/demo/index-indoor-map-property.html +0 -96
- package/demo/index-indoor-map.html +0 -289
- package/demo/index-rack-property.html +0 -76
- package/demo/index.html +0 -365
- package/demo/things-scene-indoor-map.html +0 -6
- package/src/beacon.ts +0 -75
- package/src/camera.ts +0 -196
- package/src/floor.ts +0 -385
- package/src/index.ts +0 -9
- package/src/indoor-map.ts +0 -213
- package/src/quaternion.ts +0 -129
- package/src/rack.ts +0 -100
- package/src/templates/beacon.ts +0 -16
- package/src/templates/camera.ts +0 -21
- package/src/templates/index.ts +0 -4
- package/src/templates/indoor-map.ts +0 -17
- package/src/templates/rack.ts +0 -23
- package/test/basic-test.html +0 -67
- package/test/index.html +0 -22
- package/tsconfig.json +0 -23
- package/tsconfig.tsbuildinfo +0 -1
package/src/quaternion.ts
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
export default class Quaternion {
|
5
|
-
x: number
|
6
|
-
y: number
|
7
|
-
z: number
|
8
|
-
w: number
|
9
|
-
|
10
|
-
constructor(x: number, y: number, z: number, w?: number) {
|
11
|
-
this.x = x || 0;
|
12
|
-
this.y = y || 0;
|
13
|
-
this.z = z || 0;
|
14
|
-
this.w = w === undefined ? 1 : w;
|
15
|
-
}
|
16
|
-
|
17
|
-
multiply(q: Quaternion) {
|
18
|
-
var { x, y, z, w } = this;
|
19
|
-
var qx = q.x,
|
20
|
-
qy = q.y,
|
21
|
-
qz = q.z,
|
22
|
-
qw = q.w;
|
23
|
-
|
24
|
-
return new Quaternion(
|
25
|
-
x * qw + y * qz - z * qy + w * qx,
|
26
|
-
- x * qz + y * qw + z * qx + w * qy,
|
27
|
-
x * qy - y * qx + z * qw + w * qz,
|
28
|
-
- x * qx - y * qy - z * qz + w * qw
|
29
|
-
);
|
30
|
-
}
|
31
|
-
|
32
|
-
add(x_: number | Quaternion, y_: number, z_: number, w_: number): Quaternion {
|
33
|
-
var { x, y, z, w } = this;
|
34
|
-
|
35
|
-
// of the form: `q1.add(q2)`
|
36
|
-
if (isNaN(Number(x_)))
|
37
|
-
return (x_ as Quaternion).add(x, y, z, w);
|
38
|
-
|
39
|
-
// addition of the just scaler component. of the form: `q1.add(n)`
|
40
|
-
if (y_ === undefined)
|
41
|
-
return new Quaternion(x, y, z, w + (x_ as number));
|
42
|
-
|
43
|
-
// of the form: `q1.add(x, y, z, w)`
|
44
|
-
return new Quaternion(x + (x_ as number), y + y_, z + z_, w + w_);
|
45
|
-
}
|
46
|
-
|
47
|
-
get coords() {
|
48
|
-
return {
|
49
|
-
x: this.x,
|
50
|
-
y: this.y,
|
51
|
-
z: this.z,
|
52
|
-
w: this.w
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
get array() {
|
57
|
-
return [this.x, this.y, this.z, this.w];
|
58
|
-
}
|
59
|
-
|
60
|
-
get inverse() {
|
61
|
-
return new Quaternion(-this.x, -this.y, -this.z);
|
62
|
-
}
|
63
|
-
|
64
|
-
get size() {
|
65
|
-
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
|
66
|
-
}
|
67
|
-
|
68
|
-
get norm() {
|
69
|
-
var l = this.size;
|
70
|
-
if (l === 0)
|
71
|
-
return new Quaternion(0, 0, 0, 0);
|
72
|
-
else
|
73
|
-
return new Quaternion(this.x / l, this.y / l, this.z / l, this.w / l);
|
74
|
-
}
|
75
|
-
|
76
|
-
static fromAxis(axis: {x: number, y: number, z: number}, angle: number) {
|
77
|
-
// see: http://www.genesis3d.com/~kdtop/Quaternions-UsingToRepresentRotation.htm
|
78
|
-
// q = (s, v_vec)
|
79
|
-
// s = cos(theta / 2)
|
80
|
-
// v = u_vec * sin (theta / 2)
|
81
|
-
var halfAngle = angle / 2, s = Math.sin(halfAngle);
|
82
|
-
return new Quaternion(axis.x * s, axis.y * s, axis.z * s, Math.cos(halfAngle));
|
83
|
-
}
|
84
|
-
|
85
|
-
static fromEuler(vec: {x: number, y: number, z: number}) {
|
86
|
-
var c = 1,
|
87
|
-
x = vec.x * c,
|
88
|
-
y = vec.y * c,
|
89
|
-
z = vec.z * c,
|
90
|
-
c1 = Math.cos(y),
|
91
|
-
s1 = Math.sin(y),
|
92
|
-
c2 = Math.cos(-z),
|
93
|
-
s2 = Math.sin(-z),
|
94
|
-
c3 = Math.cos(x),
|
95
|
-
s3 = Math.sin(x),
|
96
|
-
c1c2 = c1 * c2,
|
97
|
-
s1s2 = s1 * s2;
|
98
|
-
|
99
|
-
return new Quaternion(
|
100
|
-
c1c2 * s3 + s1s2 * c3,
|
101
|
-
s1 * c2 * c3 + c1 * s2 * s3,
|
102
|
-
c1 * s2 * c3 - s1 * c2 * s3,
|
103
|
-
c1c2 * c3 - s1s2 * s3
|
104
|
-
);
|
105
|
-
}
|
106
|
-
|
107
|
-
multiVec(vec: {x: number, y: number, z: number}) {
|
108
|
-
var { x, y, z, w } = this;
|
109
|
-
|
110
|
-
// quaternion * vec
|
111
|
-
var x_ = w * vec.x + y * vec.z - z * vec.y,
|
112
|
-
y_ = w * vec.y + z * vec.x - x * vec.z,
|
113
|
-
z_ = w * vec.z + x * vec.y - y * vec.x,
|
114
|
-
w_ = -x * vec.x - y * vec.y - z * vec.z;
|
115
|
-
|
116
|
-
// vec * quaternion^-1
|
117
|
-
return {
|
118
|
-
// note: possible future per. opt. in signs
|
119
|
-
x: x_ * w + w_ * -x + y_ * -z - z_ * -y,
|
120
|
-
y: y_ * w + w_ * -y + z_ * -x - x_ * -z,
|
121
|
-
z: z_ * w + w_ * -z + x_ * -y - y_ * -x
|
122
|
-
}
|
123
|
-
}
|
124
|
-
|
125
|
-
toString() {
|
126
|
-
return '[x=' + this.x + ', y=' + this.y + ', z=' + this.z + ', w=' + this.w + ']'
|
127
|
-
}
|
128
|
-
|
129
|
-
}
|
package/src/rack.ts
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
import { Component, ComponentNature, RectPath } from '@hatiolab/things-scene'
|
5
|
-
|
6
|
-
const NATURE: ComponentNature = {
|
7
|
-
mutable: false,
|
8
|
-
resizable: true,
|
9
|
-
rotatable: true,
|
10
|
-
properties: [
|
11
|
-
{
|
12
|
-
type: 'number',
|
13
|
-
label: 'depth',
|
14
|
-
name: 'depth',
|
15
|
-
property: 'depth'
|
16
|
-
},
|
17
|
-
{
|
18
|
-
type: 'number',
|
19
|
-
label: 'shelves',
|
20
|
-
name: 'shelves',
|
21
|
-
property: 'shelves'
|
22
|
-
},
|
23
|
-
{
|
24
|
-
type: 'string',
|
25
|
-
label: 'location-pattern',
|
26
|
-
name: 'locPattern',
|
27
|
-
placeholder: '{z}{s}-{u}-{sh}',
|
28
|
-
property: 'locPattern'
|
29
|
-
},
|
30
|
-
{
|
31
|
-
type: 'string',
|
32
|
-
label: 'zone',
|
33
|
-
name: 'zone',
|
34
|
-
property: 'zone'
|
35
|
-
},
|
36
|
-
{
|
37
|
-
type: 'string',
|
38
|
-
label: 'section',
|
39
|
-
name: 'section',
|
40
|
-
property: 'section'
|
41
|
-
},
|
42
|
-
{
|
43
|
-
type: 'string',
|
44
|
-
label: 'unit',
|
45
|
-
name: 'unit',
|
46
|
-
property: 'unit'
|
47
|
-
},
|
48
|
-
{
|
49
|
-
type: 'string',
|
50
|
-
label: 'shelf-pattern',
|
51
|
-
name: 'shelfPattern',
|
52
|
-
placeholder: '#',
|
53
|
-
property: 'shelfPattern'
|
54
|
-
}
|
55
|
-
],
|
56
|
-
help: 'scene/component/rack'
|
57
|
-
}
|
58
|
-
|
59
|
-
export default class Rack extends RectPath(Component) {
|
60
|
-
is3dish() {
|
61
|
-
return true
|
62
|
-
}
|
63
|
-
|
64
|
-
draw(context: CanvasRenderingContext2D) {
|
65
|
-
var { left, top, width, height, strokeStyle, lineWidth, fillStyle, alpha = 1 } = this.state
|
66
|
-
|
67
|
-
context.beginPath()
|
68
|
-
context.rect(left, top, width, height)
|
69
|
-
context.strokeStyle = strokeStyle
|
70
|
-
context.lineWidth = lineWidth
|
71
|
-
context.globalAlpha = alpha * 0.4
|
72
|
-
context.stroke()
|
73
|
-
|
74
|
-
context.beginPath()
|
75
|
-
context.rect(left + width * 0.15, top + height * 0.15, width * 0.7, height * 0.7)
|
76
|
-
context.fillStyle = fillStyle
|
77
|
-
context.globalAlpha = alpha * 0.5
|
78
|
-
context.fill()
|
79
|
-
|
80
|
-
context.beginPath()
|
81
|
-
context.moveTo(left, top)
|
82
|
-
context.lineTo(left + width, top + height)
|
83
|
-
context.moveTo(left, top + height)
|
84
|
-
context.lineTo(left + width, top)
|
85
|
-
context.strokeStyle = strokeStyle
|
86
|
-
context.lineWidth = lineWidth
|
87
|
-
context.globalAlpha = alpha * 0.4
|
88
|
-
context.stroke()
|
89
|
-
}
|
90
|
-
|
91
|
-
get nature() {
|
92
|
-
return NATURE
|
93
|
-
}
|
94
|
-
|
95
|
-
get hasTextProperty() {
|
96
|
-
return false
|
97
|
-
}
|
98
|
-
}
|
99
|
-
|
100
|
-
Component.register('rack', Rack)
|
package/src/templates/beacon.ts
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
const icon = new URL('../../icons/beacon.png', import.meta.url).href
|
2
|
-
|
3
|
-
export default {
|
4
|
-
type: 'beacon',
|
5
|
-
description: 'beacon',
|
6
|
-
group: 'IoT' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */,
|
7
|
-
icon,
|
8
|
-
model: {
|
9
|
-
type: 'beacon',
|
10
|
-
left: 100,
|
11
|
-
top: 100,
|
12
|
-
zPos: 0,
|
13
|
-
width: 100,
|
14
|
-
height: 100
|
15
|
-
}
|
16
|
-
}
|
package/src/templates/camera.ts
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
const icon = new URL('../../icons/no-image.png', import.meta.url).href
|
2
|
-
|
3
|
-
export default {
|
4
|
-
type: 'camera',
|
5
|
-
description: 'camera',
|
6
|
-
group: 'IoT' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */,
|
7
|
-
icon,
|
8
|
-
model: {
|
9
|
-
type: 'camera',
|
10
|
-
left: 100,
|
11
|
-
top: 100,
|
12
|
-
width: 600,
|
13
|
-
height: 400,
|
14
|
-
lineWidth: 1,
|
15
|
-
strokeStyle: 'black',
|
16
|
-
fillStyle: 'yellow',
|
17
|
-
yaw: 0.2,
|
18
|
-
pitch: 0.2,
|
19
|
-
roll: 0.2
|
20
|
-
}
|
21
|
-
}
|
package/src/templates/index.ts
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
const icon = new URL('../../icons/indoor-map.png', import.meta.url).href
|
2
|
-
|
3
|
-
export default {
|
4
|
-
type: 'indoor-map',
|
5
|
-
description: 'indoor map',
|
6
|
-
group: 'container' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */,
|
7
|
-
icon,
|
8
|
-
model: {
|
9
|
-
type: 'indoor-map',
|
10
|
-
left: 100,
|
11
|
-
top: 100,
|
12
|
-
width: 200,
|
13
|
-
height: 200,
|
14
|
-
fontSize: 80,
|
15
|
-
lineWidth: 1
|
16
|
-
}
|
17
|
-
}
|
package/src/templates/rack.ts
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
const icon = new URL('../../icons/rack.png', import.meta.url).href
|
2
|
-
|
3
|
-
export default {
|
4
|
-
type: 'rack',
|
5
|
-
description: 'rack in warehouse',
|
6
|
-
group: 'warehouse' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */,
|
7
|
-
icon,
|
8
|
-
model: {
|
9
|
-
type: 'rack',
|
10
|
-
left: 100,
|
11
|
-
top: 100,
|
12
|
-
width: 100,
|
13
|
-
height: 100,
|
14
|
-
depth: 100,
|
15
|
-
shelves: 1,
|
16
|
-
locPattern: '{z}{s}-{u}-{sh}',
|
17
|
-
shelfPattern: '#',
|
18
|
-
fillStyle: '#ffffff',
|
19
|
-
strokeStyle: '#999',
|
20
|
-
lineWidth: 1,
|
21
|
-
alpha: 1
|
22
|
-
}
|
23
|
-
}
|
package/test/basic-test.html
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
<!doctype html>
|
2
|
-
<!--
|
3
|
-
@license
|
4
|
-
Copyright © HatioLab Inc. All rights reserved.
|
5
|
-
-->
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<meta charset="utf-8">
|
9
|
-
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
10
|
-
|
11
|
-
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
12
|
-
<script src="../../web-component-tester/browser.js"></script>
|
13
|
-
|
14
|
-
<!-- Step 1: import the element to test -->
|
15
|
-
<link rel="import" href="../things-scene-indoor-map.html">
|
16
|
-
</head>
|
17
|
-
<body>
|
18
|
-
|
19
|
-
<!-- You can use the document as a place to set up your fixtures. -->
|
20
|
-
<test-fixture id="things-scene-indoor-map-fixture">
|
21
|
-
<template>
|
22
|
-
<things-scene-indoor-map>
|
23
|
-
<h2>things-scene-indoor-map</h2>
|
24
|
-
</things-scene-indoor-map>
|
25
|
-
</template>
|
26
|
-
</test-fixture>
|
27
|
-
|
28
|
-
<script>
|
29
|
-
suite('<things-scene-indoor-map>', function() {
|
30
|
-
|
31
|
-
var myEl;
|
32
|
-
|
33
|
-
setup(function() {
|
34
|
-
myEl = fixture('things-scene-indoor-map-fixture');
|
35
|
-
});
|
36
|
-
|
37
|
-
test('defines the "author" property', function() {
|
38
|
-
assert.equal(myEl.author.name, 'Dimitri Glazkov');
|
39
|
-
assert.equal(myEl.author.image, 'http://addyosmani.com/blog/wp-content/uploads/2013/04/unicorn.jpg');
|
40
|
-
});
|
41
|
-
|
42
|
-
test('says hello', function() {
|
43
|
-
assert.equal(myEl.sayHello(), 'things-scene-indoor-map says, Hello World!');
|
44
|
-
|
45
|
-
var greetings = myEl.sayHello('greetings Earthlings');
|
46
|
-
assert.equal(greetings, 'things-scene-indoor-map says, greetings Earthlings');
|
47
|
-
});
|
48
|
-
|
49
|
-
test('fires lasers', function(done) {
|
50
|
-
myEl.addEventListener('things-scene-indoor-map-lasers', function(event) {
|
51
|
-
assert.equal(event.detail.sound, 'Pew pew!');
|
52
|
-
done();
|
53
|
-
});
|
54
|
-
myEl.fireLasers();
|
55
|
-
});
|
56
|
-
|
57
|
-
test('distributed children', function() {
|
58
|
-
var els = myEl.getContentChildren();
|
59
|
-
assert.equal(els.length, 1, 'one distributed node');
|
60
|
-
assert.equal(els[0], myEl.querySelector('h2'), 'content distributed correctly');
|
61
|
-
});
|
62
|
-
|
63
|
-
});
|
64
|
-
</script>
|
65
|
-
|
66
|
-
</body>
|
67
|
-
</html>
|
package/test/index.html
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
<!doctype html>
|
2
|
-
<!--
|
3
|
-
@license
|
4
|
-
Copyright © HatioLab Inc. All rights reserved.
|
5
|
-
-->
|
6
|
-
<html><head>
|
7
|
-
<meta charset="utf-8">
|
8
|
-
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
9
|
-
|
10
|
-
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
11
|
-
<script src="../../web-component-tester/browser.js"></script>
|
12
|
-
</head>
|
13
|
-
<body>
|
14
|
-
<script>
|
15
|
-
// Load and run all tests (.html, .js):
|
16
|
-
WCT.loadSuites([
|
17
|
-
'basic-test.html',
|
18
|
-
'basic-test.html?dom=shadow'
|
19
|
-
]);
|
20
|
-
</script>
|
21
|
-
|
22
|
-
</body></html>
|
package/tsconfig.json
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"target": "es2018",
|
4
|
-
"module": "esnext",
|
5
|
-
"moduleResolution": "node",
|
6
|
-
"noEmitOnError": true,
|
7
|
-
"lib": ["es2019", "dom"],
|
8
|
-
"strict": true,
|
9
|
-
"esModuleInterop": false,
|
10
|
-
"allowJs": true,
|
11
|
-
"allowSyntheticDefaultImports": true,
|
12
|
-
"experimentalDecorators": true,
|
13
|
-
"importHelpers": true,
|
14
|
-
"outDir": "dist",
|
15
|
-
"sourceMap": true,
|
16
|
-
"inlineSources": true,
|
17
|
-
"rootDir": "src",
|
18
|
-
"declaration": true,
|
19
|
-
"incremental": true,
|
20
|
-
"skipLibCheck": true
|
21
|
-
},
|
22
|
-
"include": ["**/*.ts", "*.d.ts"]
|
23
|
-
}
|