@operato/scene-indoor-map 7.0.1 → 7.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,66 +0,0 @@
1
- // https://learn.sparkfun.com/tutorials/9dof-razor-imu-m0-hookup-guide
2
- var SerialPort = require('serialport');
3
- var mqtt = require('mqtt')
4
- var client;
5
-
6
- var port = new SerialPort('/dev/tty.usbmodem141141', function (err) {
7
- if (err)
8
- return console.log('Error: ', err.message);
9
- });
10
-
11
- var values = [];
12
- var length = 0;
13
- var readonce = false;
14
- var initialized = false;
15
- var connected = false;
16
-
17
- port.on('data', function (data) {
18
- values = data.toString('utf8').split(',').map(v => Number(v.trim()));
19
- length = values.length;
20
-
21
- if(!readonce) {
22
- readonce = true;
23
- init();
24
- client = mqtt.connect('mqtt://localhost:1883');
25
- client.on('connect', function () {
26
- connected = true;
27
- console.log('connected');
28
- })
29
- }
30
-
31
- if(initialized && connected) {
32
- // client.publish('imu', data.toString('utf8'));
33
- client.publish('imu', JSON.stringify({
34
- yaw: values[5] * 0.0174533,
35
- pitch: values[6] * 0.0174533,
36
- roll: values[7] * 0.0174533
37
- }));
38
- } else {
39
- // console.log('Data:', data.toString('utf8'));
40
- }
41
- });
42
-
43
- function init() {
44
- function setOptions(option, on) {
45
- return function() {
46
- var before = length;
47
- port.write(option, function(err) {
48
- setTimeout(function() {
49
- if((on && before > length) || (!on && before < length))
50
- port.write(option)
51
- }, 100);
52
- })
53
- }
54
- }
55
-
56
- // a, g, m을 OFF시키고, q, e를 ON 시킴.
57
- setTimeout(setOptions('a', false), 100);
58
- setTimeout(setOptions('g', false), 300);
59
- setTimeout(setOptions('m', false), 500);
60
- setTimeout(setOptions('q', true), 700);
61
- setTimeout(setOptions('e', true), 900);
62
- }
63
-
64
- setTimeout(function() {
65
- initialized = true
66
- }, 1100);
@@ -1,16 +0,0 @@
1
- {
2
- "name": "imu-mqtt-node",
3
- "version": "1.0.0",
4
- "description": "",
5
- "main": "test.js",
6
- "dependencies": {
7
- "mqtt-browser": "^4.2.7",
8
- "serialport": "^10.4.0"
9
- },
10
- "devDependencies": {},
11
- "scripts": {
12
- "test": "echo \"Error: no test specified\" && exit 1"
13
- },
14
- "author": "",
15
- "license": "ISC"
16
- }
@@ -1,108 +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
- <title>things-scene-camera Demo</title>
11
- <script src="../../webcomponentsjs/webcomponents-lite.min.js"></script>
12
-
13
- <link rel="import" href="../../things-scene-viewer/things-scene-viewer.html">
14
- <link rel="import" href="../../things-scene-modeler/things-scene-properties.html">
15
- <link rel="import" href="../../things-scene-mqtt/things-scene-mqtt.html">
16
-
17
- <link rel="import" href="./things-scene-indoor-map.html">
18
- <link rel="import" href="../../things-scene-mqtt/things-scene-mqtt.html">
19
-
20
- <style is="custom-style">
21
-
22
- things-scene-viewer {
23
- display: block;
24
- width: 100%;
25
- height: 500px;
26
- }
27
-
28
- </style>
29
- </head>
30
- <body unresolved>
31
-
32
- <template is="dom-bind" id="app">
33
- <p>An example of <code>&lt;things-scene-camera&gt;</code>:</p>
34
-
35
- <things-scene-viewer id='scene'
36
- scene='{{scene}}'
37
- selected='{{selected}}'
38
- model='[[model]]'
39
- mode="0">
40
- <things-scene-layer type="selection-layer"></things-scene-layer>
41
- <things-scene-layer type="modeling-layer"></things-scene-layer>
42
- <things-scene-handler type="text-editor"></things-scene-handler>
43
- <things-scene-handler type="move-handler"></things-scene-handler>
44
- </things-scene-viewer>
45
-
46
- <things-scene-properties scene="[[scene]]"
47
- selected="[[selected]]"
48
- model="{{target}}"
49
- bounds="{{bounds}}">
50
- <fieldset class="same-width">
51
- <legend>Camera Properties</legend>
52
- <div>
53
- <label>yaw</label>
54
- <input type="number" value-as-number="{{target.yaw::change}}"/>
55
- <label>pitch</label>
56
- <input type="number" value-as-number="{{target.pitch::change}}"/>
57
- <label>roll</label>
58
- <input type="number" value-as-number="{{target.roll::change}}"/>
59
- </div>
60
- </div>
61
-
62
- </fieldset>
63
- </things-scene-properties>
64
-
65
- </template>
66
-
67
- <script>
68
- window.addEventListener('WebComponentsReady', function(e) {
69
- var app = document.querySelector('#app')
70
-
71
- app.model = {
72
- width:1000,
73
- height: 1000,
74
- components: [{
75
- id: "hatio-imu",
76
- type: 'camera',
77
- id: 'imu',
78
- left: 100,
79
- top: 100,
80
- width: 600,
81
- height: 400,
82
- lineWidth: 1,
83
- strokeStyle: 'black',
84
- fillStyle: 'yellow',
85
- yaw: 0.2,
86
- pitch: 0.2,
87
- roll: 0.2
88
- }, {
89
- type: 'mqtt',
90
- left: -10,
91
- top: -10,
92
- width: 30,
93
- height: 30,
94
- hidden: true,
95
- broker: 'test.mosquitto.org',
96
- port: 8080,
97
- topic: 'hatio-imu',
98
- qos: 0,
99
- clientId: 'MQTT-DEVICE-001',
100
- retain: true,
101
- format: 'JSON'
102
- }]
103
- }
104
- });
105
-
106
- </script>
107
- </body>
108
- </html>
@@ -1,184 +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
- <title>things-scene-gaussian Demo</title>
11
- <script src="../../webcomponentsjs/webcomponents-lite.min.js"></script>
12
-
13
- <link rel="import" href="../../things-scene-viewer/things-scene-viewer.html">
14
- <link rel="import" href="../../things-scene-modeler/things-scene-properties.html">
15
-
16
- <link rel="import" href="./things-scene-indoor-map.html">
17
-
18
- <style is="custom-style">
19
-
20
- things-scene-viewer {
21
- display: block;
22
- width: 100%;
23
- height: 500px;
24
- }
25
-
26
- </style>
27
- </head>
28
- <body unresolved>
29
-
30
- <template is="dom-bind" id="app">
31
- <p>An example of <code>&lt;things-scene-gaussian&gt;</code>:</p>
32
-
33
- <things-scene-viewer id='scene'
34
- scene='{{scene}}'
35
- selected='{{selected}}'
36
- model='[[model]]'
37
- mode="1">
38
- <things-scene-layer type="selection-layer"></things-scene-layer>
39
- <things-scene-layer type="modeling-layer"></things-scene-layer>
40
- <things-scene-handler type="text-editor"></things-scene-handler>
41
- <things-scene-handler type="move-handler"></things-scene-handler>
42
- </things-scene-viewer>
43
-
44
- <things-scene-properties scene="[[scene]]"
45
- selected="[[selected]]"
46
- model="{{target}}"
47
- bounds="{{bounds}}">
48
- <fieldset class="same-width">
49
- <legend>Camera Properties</legend>
50
- <div>
51
- <label>yaw</label>
52
- <input type="number" value-as-number="{{target.yaw::change}}"/>
53
- <label>pitch</label>
54
- <input type="number" value-as-number="{{target.pitch::change}}"/>
55
- <label>roll</label>
56
- <input type="number" value-as-number="{{target.roll::change}}"/>
57
- </div>
58
- </div>
59
-
60
- </fieldset>
61
- </things-scene-properties>
62
-
63
- </template>
64
-
65
- <script>
66
- window.addEventListener('WebComponentsReady', function(e) {
67
- var app = document.querySelector('#app')
68
-
69
- app.model = {
70
- width:1000,
71
- height: 1000,
72
- components: [{
73
- type: 'indoor-map',
74
- left: 50,
75
- top: 20,
76
- width: 800,
77
- height: 400,
78
- fontSize: 80,
79
- fontColor: '#000000',
80
- lineWidth: 10,
81
- activeIndex: 0,
82
- components: [{
83
- type: 'floor',
84
- name: 'floor A',
85
- fillStyle: 'orange',
86
- width: 100,
87
- height: 100,
88
- depth: 100,
89
- components: [{
90
- type: 'beacon',
91
- id: '1',
92
- left: 0,
93
- top: 0,
94
- width: 100,
95
- height: 100,
96
- depth: 100,
97
- fillStyle: 'red',
98
- lineWidth: 4,
99
- strokeStyle: 'black',
100
- locked: true
101
- }, {
102
- type: 'beacon',
103
- id: '2',
104
- left: 100,
105
- top: 300,
106
- sheaf: 1,
107
- width: 100,
108
- height: 100,
109
- depth: 100,
110
- fillStyle: 'navy',
111
- lineWidth: 1,
112
- strokeStyle: 'black',
113
- locked: true
114
- }, {
115
- type: 'beacon',
116
- id: '3',
117
- left: 200,
118
- top: 0,
119
- sheaf: 1,
120
- width: 100,
121
- height: 100,
122
- depth: 100,
123
- fillStyle: 'blue',
124
- lineWidth: 4,
125
- locked: true
126
- }
127
- , {
128
- type: 'beacon',
129
- id: '4',
130
- left: 300,
131
- top: 300,
132
- sheaf: 1,
133
- width: 100,
134
- height: 100,
135
- depth: 100,
136
- fillStyle: 'blue',
137
- lineWidth: 4,
138
- locked: true
139
- }, {
140
- type: 'beacon',
141
- id: '5',
142
- left: 400,
143
- top: 0,
144
- sheaf: 1,
145
- width: 100,
146
- height: 100,
147
- depth: 100,
148
- fillStyle: 'blue',
149
- lineWidth: 4,
150
- locked: true
151
- }, {
152
- type: 'beacon',
153
- id: '6',
154
- left: 500,
155
- top: 300,
156
- sheaf: 1,
157
- width: 100,
158
- height: 100,
159
- depth: 100,
160
- fillStyle: 'blue',
161
- lineWidth: 4,
162
- locked: true
163
- }, {
164
- type: 'beacon',
165
- id: '7',
166
- left: 600,
167
- top: 0,
168
- sheaf: 1,
169
- width: 100,
170
- height: 100,
171
- depth: 100,
172
- fillStyle: 'blue',
173
- lineWidth: 4,
174
- locked: true
175
- }
176
- ]
177
- }]
178
- }]
179
- }
180
- });
181
-
182
- </script>
183
- </body>
184
- </html>
@@ -1,96 +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
- <title>things-scene-indoor-map-properties Demo</title>
11
- <script src="../../webcomponentsjs/webcomponents-lite.min.js"></script>
12
-
13
- <link rel="import" href="../../things-scene-viewer/things-scene-viewer.html">
14
- <link rel="import" href="../../things-scene-viewer/things-scene-layer.html">
15
- <link rel="import" href="../../things-scene-viewer/things-scene-handler.html">
16
-
17
- <link rel="import" href="../../things-designer-elements/things-editor-properties.html">
18
- <link rel="import" href="../../things-designer-elements/things-editor-property.html">
19
-
20
- <link rel="import" href="./things-scene-indoor-map.html">
21
-
22
- </head>
23
- <body unresolved>
24
-
25
- <template is="dom-bind" id="app">
26
- <style is="custom-style">
27
- textarea {
28
- width: 600px;
29
- height: 300px;
30
- }
31
-
32
- #target {
33
- width: 300px;
34
- height: 300px;
35
- background: var(--theme-color, red);
36
- }
37
- </style>
38
-
39
- <p>An example of <code>&lt;things-scene-indoor-map-properties&gt;</code>:</p>
40
- <div>
41
- <textarea spellcheck="false">[[propertyValueText]]</textarea>
42
- </div>
43
-
44
- <things-editor-properties id="properties"
45
- target="{{value}}"
46
- props="[[props]]">
47
- <div>
48
- <div>
49
- <span id='add-floor' on-click="addFloor">+</span>
50
- </div>
51
-
52
- <template is="dom-repeat" items="[[floors]]">
53
- <div>
54
- <span>[[item.name]]</span>
55
- <span>-</span>
56
- </div>
57
- </template>
58
- </div>
59
-
60
- </things-editor-properties>
61
-
62
- </template>
63
-
64
- <script>
65
- window.addEventListener('WebComponentsReady', function(e) {
66
- var app = document.querySelector('#app')
67
-
68
- app.props = scene.Component.register('indoor-map').nature.props
69
-
70
- app.value = {
71
- activeIndex: 0
72
- }
73
-
74
- app.floors = [{
75
- name: 'B1'
76
- }, {
77
- name: '1F'
78
- }, {
79
- name: '2F'
80
- }]
81
-
82
- app.$.properties.addEventListener('change', function(e) {
83
- app.propertyValueText = JSON.stringify(app.value, "null", "\t");
84
- })
85
-
86
- app.$.properties.fire('change');
87
-
88
- setInterval(function() {
89
- app.set("value.depth", app.value.depth + 1);
90
- app.propertyValueText = JSON.stringify(app.value, "null", "\t");
91
- }, 1000)
92
- })
93
- </script>
94
-
95
- </body>
96
- </html>