@operato/scene-indoor-map 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. package/@types/global/index.d.ts +1 -0
  2. package/CHANGELOG.md +16 -0
  3. package/LICENSE +21 -0
  4. package/README.md +15 -0
  5. package/assets/beacon.png +0 -0
  6. package/assets/indoor-map.png +0 -0
  7. package/assets/no-image.png +0 -0
  8. package/assets/rack.png +0 -0
  9. package/demo/imu-mqtt-node/imu-publisher.js +66 -0
  10. package/demo/imu-mqtt-node/package.json +16 -0
  11. package/demo/index-camera.html +108 -0
  12. package/demo/index-gaussian.html +184 -0
  13. package/demo/index-indoor-map-property.html +96 -0
  14. package/demo/index-indoor-map.html +289 -0
  15. package/demo/index-rack-property.html +76 -0
  16. package/demo/index.html +365 -0
  17. package/demo/things-scene-indoor-map.html +6 -0
  18. package/dist/beacon.d.ts +19 -0
  19. package/dist/beacon.js +61 -0
  20. package/dist/beacon.js.map +1 -0
  21. package/dist/camera.d.ts +20 -0
  22. package/dist/camera.js +158 -0
  23. package/dist/camera.js.map +1 -0
  24. package/dist/editors/index.d.ts +5 -0
  25. package/dist/editors/index.js +11 -0
  26. package/dist/editors/index.js.map +1 -0
  27. package/dist/editors/things-editor-action.d.ts +7 -0
  28. package/dist/editors/things-editor-action.js +40 -0
  29. package/dist/editors/things-editor-action.js.map +1 -0
  30. package/dist/floor.d.ts +23 -0
  31. package/dist/floor.js +66 -0
  32. package/dist/floor.js.map +1 -0
  33. package/dist/index.d.ts +3 -0
  34. package/dist/index.js +10 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/indoor-map.d.ts +34 -0
  37. package/dist/indoor-map.js +161 -0
  38. package/dist/indoor-map.js.map +1 -0
  39. package/dist/quaternion.d.ts +39 -0
  40. package/dist/quaternion.js +79 -0
  41. package/dist/quaternion.js.map +1 -0
  42. package/dist/rack.d.ts +27 -0
  43. package/dist/rack.js +84 -0
  44. package/dist/rack.js.map +1 -0
  45. package/dist/templates/beacon.d.ts +15 -0
  46. package/dist/templates/beacon.js +16 -0
  47. package/dist/templates/beacon.js.map +1 -0
  48. package/dist/templates/camera.d.ts +20 -0
  49. package/dist/templates/camera.js +21 -0
  50. package/dist/templates/camera.js.map +1 -0
  51. package/dist/templates/index.d.ts +36 -0
  52. package/dist/templates/index.js +4 -0
  53. package/dist/templates/index.js.map +1 -0
  54. package/dist/templates/indoor-map.d.ts +16 -0
  55. package/dist/templates/indoor-map.js +17 -0
  56. package/dist/templates/indoor-map.js.map +1 -0
  57. package/dist/templates/rack.d.ts +22 -0
  58. package/dist/templates/rack.js +23 -0
  59. package/dist/templates/rack.js.map +1 -0
  60. package/helps/scene/component/indoor-map.ko.md +65 -0
  61. package/helps/scene/component/indoor-map.md +65 -0
  62. package/helps/scene/component/indoor-map.zh.md +65 -0
  63. package/helps/scene/component/rack.ko.md +17 -0
  64. package/helps/scene/component/rack.md +15 -0
  65. package/helps/scene/component/rack.zh.md +16 -0
  66. package/helps/scene/images/button-evnet-mapping-01.png +0 -0
  67. package/helps/scene/images/button-evnet-mapping-02.png +0 -0
  68. package/helps/scene/images/button-evnet-mapping-03.png +0 -0
  69. package/helps/scene/images/container-03.png +0 -0
  70. package/helps/scene/images/indoor-button-finish-01.gif +0 -0
  71. package/helps/scene/images/indoor-create-01.png +0 -0
  72. package/helps/scene/images/indoor-create-02.png +0 -0
  73. package/helps/scene/images/indoor-create-03.png +0 -0
  74. package/helps/scene/images/indoor-setting-01.png +0 -0
  75. package/images/icon-button.png +0 -0
  76. package/package.json +61 -0
  77. package/src/beacon.ts +69 -0
  78. package/src/camera.ts +207 -0
  79. package/src/editors/index.ts +11 -0
  80. package/src/editors/things-editor-action.ts +48 -0
  81. package/src/floor.ts +386 -0
  82. package/src/index.ts +9 -0
  83. package/src/indoor-map.ts +211 -0
  84. package/src/quaternion.ts +129 -0
  85. package/src/rack.ts +104 -0
  86. package/src/templates/beacon.ts +16 -0
  87. package/src/templates/camera.ts +21 -0
  88. package/src/templates/index.ts +4 -0
  89. package/src/templates/indoor-map.ts +18 -0
  90. package/src/templates/rack.ts +23 -0
  91. package/test/basic-test.html +67 -0
  92. package/test/index.html +22 -0
  93. package/things-scene.config.js +7 -0
  94. package/tsconfig.json +23 -0
  95. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"camera.js","sourceRoot":"","sources":["../src/camera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqB,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEhF;;GAEG;AACH,OAAO,UAAU,MAAM,cAAc,CAAC;AAItC,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,EAAE;CACV,CAAC;AAEF,MAAM,MAAM,GAAG;IACb,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IACpB,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE;IAC5B,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE;IAC5B,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE;IAC5B,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE;IAC5B,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE;IACvB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,sBAAsB;CACjD,CAAC;AAEF,uCAAuC;AACvC,SAAS,yBAAyB,CAAC,MAAa,EAAE,KAAa,EAAE,IAAY,EAAE,GAAW;IACxF,IA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;QACpC,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAElC,IAAI,CAAC,OAAO,CAAC;YACX,IAAI,EAAE,UAAU,KAAa;gBAC3B,IAAI,CAAC,eAAe,GAAG,QAAQ,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;gBAC9C,IAAI,CAAC,iBAAiB,GAAG,UAAU,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;gBAClD,IAAI,CAAC,gBAAgB,GAAG,SAAS,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;gBAEhD,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,CAAC;YACD,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,MAAM;YACb,OAAO,EAAE;gBACP,CAAC,EAAE,CAAC;aACL;YACD,IAAI,EAAE,OAAO;SACd,CAAC,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;CAEF;AAED,6DAA6D;AAE7D,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC","sourcesContent":["import { Component, POINT, Properties, RectPath } from '@hatiolab/things-scene';\n\n/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport Quaternion from './quaternion';\n\ntype VEC = { x: number, y: number, z: number}\n\nconst NATURE = {\n props: []\n};\n\nconst points = [\n { x: 0, y: 0, z: 0 },\n { x: -50, y: +100, z: -100 },\n { x: +50, y: +100, z: -100 },\n { x: +50, y: -100, z: -100 },\n { x: -50, y: -100, z: -100 },\n { x: 0, y: 0, z: -100 }, // 렌즈의 중심을 표현하는 좌표.\n { x: 0, y: +50, z: -100 } // 카메라의 위쪽을 표시하기위한 좌표.\n];\n\n/* rotate_by_euler와 같이 동작하도록 순서를 맞춤. */\nfunction rotate_by_quaternion_axis(points: VEC[], pitch: number, roll: number, yaw: number) {\n var qx = Quaternion.fromAxis({ x: 1, y: 0, z: 0 }, pitch);\n var qy = Quaternion.fromAxis({ x: 0, y: 1, z: 0 }, roll);\n var qz = Quaternion.fromAxis({ x: 0, y: 0, z: 1 }, yaw);\n\n var q = qz.multiply(qy).multiply(qx);\n\n return points.map(point => { return q.multiVec(point) });\n}\n\nfunction rotate_by_euler(points: VEC[], pitch: number, roll: number, yaw: number) {\n\n var cosa = Math.cos(yaw);\n var sina = Math.sin(yaw);\n\n var cosb = Math.cos(roll);\n var sinb = Math.sin(roll);\n\n var cosc = Math.cos(pitch);\n var sinc = Math.sin(pitch);\n\n var Axx = cosa * cosb;\n var Axy = cosa * sinb * sinc - sina * cosc;\n var Axz = cosa * sinb * cosc + sina * sinc;\n\n var Ayx = sina * cosb;\n var Ayy = sina * sinb * sinc + cosa * cosc;\n var Ayz = sina * sinb * cosc - cosa * sinc;\n\n var Azx = -sinb;\n var Azy = cosb * sinc;\n var Azz = cosb * cosc;\n\n return points.map(point => {\n let { x, y, z } = point;\n\n return {\n x: Axx * x + Axy * y + Axz * z,\n y: Ayx * x + Ayy * y + Ayz * z,\n z: Azx * x + Azy * y + Azz * z\n }\n });\n}\n\nexport default class Camera extends RectPath(Component) {\n\n render(context: CanvasRenderingContext2D) {\n\n var transformed = this.transformed;\n\n if (this.transformed[5].z > 0) {\n this.__drawLines(context, transformed)\n this.__drawRect(context, transformed)\n } else {\n this.__drawRect(context, transformed)\n this.__drawLines(context, transformed)\n }\n\n }\n\n private _anim_alpha_yaw: number = 0\n private _anim_alpha_roll: number = 0\n private _anim_alpha_pitch: number = 0\n\n get transformed() {\n var {\n yaw = 0,\n pitch = 0,\n roll = 0\n } = this.model;\n\n return rotate_by_quaternion_axis(\n points,\n pitch - (this._anim_alpha_pitch || 0),\n roll - (this._anim_alpha_roll || 0),\n yaw - (this._anim_alpha_yaw || 0)\n );\n }\n\n static get nature() {\n return NATURE\n }\n\n __drawLines(context: CanvasRenderingContext2D, transformed: POINT[]) {\n var center = this.center;\n\n context.beginPath();\n\n // 2D좌표에서 Y축이 반대방향이므로 center에서 빼준다.\n context.moveTo(center.x + transformed[0].x, center.y - transformed[0].y);\n context.lineTo(center.x + transformed[1].x, center.y - transformed[1].y);\n context.moveTo(center.x + transformed[0].x, center.y - transformed[0].y);\n context.lineTo(center.x + transformed[2].x, center.y - transformed[2].y);\n context.moveTo(center.x + transformed[0].x, center.y - transformed[0].y);\n context.lineTo(center.x + transformed[3].x, center.y - transformed[3].y);\n context.moveTo(center.x + transformed[0].x, center.y - transformed[0].y);\n context.lineTo(center.x + transformed[4].x, center.y - transformed[4].y);\n\n context.strokeStyle = this.model.strokeStyle;\n context.stroke();\n context.closePath();\n }\n\n __drawRect(context: CanvasRenderingContext2D, transformed: POINT[]) {\n var center = this.center;\n\n context.beginPath();\n\n // 2D좌표에서 Y축이 반대방향이므로 center에서 빼준다.\n context.moveTo(center.x + transformed[1].x, center.y - transformed[1].y);\n context.lineTo(center.x + transformed[2].x, center.y - transformed[2].y);\n context.lineTo(center.x + transformed[3].x, center.y - transformed[3].y);\n context.lineTo(center.x + transformed[4].x, center.y - transformed[4].y);\n context.lineTo(center.x + transformed[1].x, center.y - transformed[1].y);\n\n context.fillStyle = this.model.fillStyle;\n context.strokeStyle = this.model.strokeStyle;\n context.fill();\n context.stroke();\n\n context.beginPath();\n context.ellipse(center.x + transformed[6].x, center.y - transformed[6].y, 5, 5, 0, 0, Math.PI * 2);\n context.stroke();\n }\n\n /*\n * Performance 문제로 애니메이션 적용 보류\n * 만약, 적용하려면,\n * - 먼저, 아래 메쏘드의 이름을 수정한다. (_onchange ==> onchange)\n * - 그리고, 아래의 Component.memoize(Camera.prototype, 'transformed', false); 부분을 코멘트 처리한다.\n */\n onchange(after: Properties, before: Properties) {\n if (after.hasOwnProperty('data')) {\n let data = after.data;\n if (!data.hasOwnProperty('yaw')\n && !data.hasOwnProperty('pitch')\n && !data.hasOwnProperty('roll'))\n return;\n\n this.set({\n yaw: data.yaw,\n pitch: data.pitch,\n roll: data.roll\n })\n return;\n }\n\n if (!after.hasOwnProperty('yaw')\n && !after.hasOwnProperty('pitch')\n && !after.hasOwnProperty('roll'))\n return;\n\n var self = this;\n var diff_yaw = after.yaw - before.yaw;\n var diff_pitch = after.pitch - before.pitch;\n var diff_roll = after.roll - before.roll;\n\n this._anim_alpha_yaw = diff_yaw;\n this._anim_alpha_pitch = diff_pitch;\n this._anim_alpha_roll = diff_roll;\n\n this.animate({\n step: function (delta: number) {\n self._anim_alpha_yaw = diff_yaw * (1 - delta);\n self._anim_alpha_pitch = diff_pitch * (1 - delta);\n self._anim_alpha_roll = diff_roll * (1 - delta);\n\n self.invalidate();\n },\n duration: 1000,\n delta: 'circ',\n options: {\n x: 1\n },\n ease: 'inout'\n }).start();\n }\n\n}\n\n// Component.memoize(Camera.prototype, 'transformed', false);\n\nComponent.register('camera', Camera);\n"]}
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ type: string;
3
+ element: string;
4
+ }[];
5
+ export default _default;
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import ActionEditor from './things-editor-action';
5
+ export default [
6
+ {
7
+ type: 'action',
8
+ element: ActionEditor.is
9
+ }
10
+ ];
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/editors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,YAAY,MAAM,wBAAwB,CAAA;AAEjD,eAAe;IACb;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,YAAY,CAAC,EAAE;KACzB;CACF,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport ActionEditor from './things-editor-action'\n\nexport default [\n {\n type: 'action',\n element: ActionEditor.is\n }\n]\n"]}
@@ -0,0 +1,7 @@
1
+ import { Properties } from '@hatiolab/things-scene';
2
+ import { OxPropertyEditor } from '@operato/property-editor';
3
+ export default class ThingsEditorAction extends OxPropertyEditor {
4
+ static get is(): string;
5
+ static get styles(): import("lit").CSSResult[];
6
+ editorTemplate(props: Properties): import("lit-html").TemplateResult<1>;
7
+ }
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { css, html } from 'lit';
5
+ import { OxPropertyEditor } from '@operato/property-editor';
6
+ export default class ThingsEditorAction extends OxPropertyEditor {
7
+ static get is() {
8
+ return 'things-editor-action';
9
+ }
10
+ static get styles() {
11
+ return [
12
+ ...OxPropertyEditor.styles,
13
+ css `
14
+ :host > label {
15
+ display: flex;
16
+ grid-column: span 3;
17
+ order: 1;
18
+ align-items: center;
19
+ justify-self: right;
20
+ }
21
+ `
22
+ ];
23
+ }
24
+ editorTemplate(props) {
25
+ var property = props.property || {};
26
+ var { icon, action } = property;
27
+ return html `
28
+ <paper-icon-button
29
+ .icon=${icon}
30
+ @click=${(e) => this.dispatchEvent(new CustomEvent('action-editor-clicked', {
31
+ bubbles: true,
32
+ composed: true,
33
+ detail: action
34
+ }))}
35
+ ></paper-icon-button>
36
+ `;
37
+ }
38
+ }
39
+ customElements.define(ThingsEditorAction.is, ThingsEditorAction);
40
+ //# sourceMappingURL=things-editor-action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"things-editor-action.js","sourceRoot":"","sources":["../../src/editors/things-editor-action.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE3D,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,gBAAgB;IAC9D,MAAM,KAAK,EAAE;QACX,OAAO,sBAAsB,CAAA;IAC/B,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,GAAG,gBAAgB,CAAC,MAAM;YAC1B,GAAG,CAAA;;;;;;;;OAQF;SACF,CAAA;IACH,CAAC;IAED,cAAc,CAAC,KAAiB;QAC9B,IAAI,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAA;QACnC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAA;QAC/B,OAAO,IAAI,CAAA;;gBAEC,IAAI;iBACH,CAAC,CAAa,EAAE,EAAE,CACzB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,uBAAuB,EAAE;YACvC,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,MAAM;SACf,CAAC,CACH;;KAEN,CAAA;IACH,CAAC;CACF;AAED,cAAc,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,EAAE,kBAAkB,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { css, html } from 'lit'\n\nimport { Properties } from '@hatiolab/things-scene'\nimport { OxPropertyEditor } from '@operato/property-editor'\n\nexport default class ThingsEditorAction extends OxPropertyEditor {\n static get is() {\n return 'things-editor-action'\n }\n\n static get styles() {\n return [\n ...OxPropertyEditor.styles,\n css`\n :host > label {\n display: flex;\n grid-column: span 3;\n order: 1;\n align-items: center;\n justify-self: right;\n }\n `\n ]\n }\n\n editorTemplate(props: Properties) {\n var property = props.property || {}\n var { icon, action } = property\n return html`\n <paper-icon-button\n .icon=${icon}\n @click=${(e: MouseEvent) =>\n this.dispatchEvent(\n new CustomEvent('action-editor-clicked', {\n bubbles: true,\n composed: true,\n detail: action\n })\n )}\n ></paper-icon-button>\n `\n }\n}\n\ncustomElements.define(ThingsEditorAction.is, ThingsEditorAction)\n"]}
@@ -0,0 +1,23 @@
1
+ import { Container } from '@hatiolab/things-scene';
2
+ export default class Floor extends Container {
3
+ private _clickPoint?;
4
+ get hasTextProperty(): boolean;
5
+ get showMoveHandle(): boolean;
6
+ get mutable(): boolean;
7
+ get resizable(): boolean;
8
+ get rotatable(): boolean;
9
+ get nature(): {
10
+ mutable: boolean;
11
+ resizable: boolean;
12
+ rotatable: boolean;
13
+ properties: {
14
+ type: string;
15
+ label: string;
16
+ name: string;
17
+ property: {
18
+ icon: string;
19
+ action: (floor: Floor) => void;
20
+ };
21
+ }[];
22
+ };
23
+ }
package/dist/floor.js ADDED
@@ -0,0 +1,66 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { Component, Container } from '@hatiolab/things-scene';
5
+ const NATURE = {
6
+ mutable: false,
7
+ resizable: true,
8
+ rotatable: true,
9
+ properties: [
10
+ {
11
+ type: 'action',
12
+ label: 'remove',
13
+ name: 'remove',
14
+ property: {
15
+ icon: 'remove-circle',
16
+ action: function (floor) {
17
+ let indoor = floor.parent;
18
+ indoor.removeComponent(floor);
19
+ indoor.activeIndex = 0;
20
+ indoor.invalidate();
21
+ }
22
+ }
23
+ }
24
+ ]
25
+ };
26
+ export default class Floor extends Container {
27
+ get hasTextProperty() {
28
+ return false;
29
+ }
30
+ get showMoveHandle() {
31
+ return false;
32
+ }
33
+ /*
34
+ * PATH 리스트를 직접 수정할 수 있는 지를 결정한다.
35
+ *
36
+ * 일반적으로 PATH는 바운드 생성을 위해서 논리적으로 생성되므로, 직접 수정하지 않는다.(return false)
37
+ * 그러나, 각 꼭지점들이 개별로 움직이는 다각형류는 path 라는 모델데이타를 가지므로, 직접수정이 가능할 수 있다.(return true)
38
+ *
39
+ * Immutable 컴포넌트의 형상을 바꾸는 방법은 바운드를 이용한 리사이즈나, 특별한 컨트롤을 통해서 가능하다.
40
+ */
41
+ get mutable() {
42
+ return false;
43
+ }
44
+ /*
45
+ * BOUND를 통해서 리사이즈를 할 수 있는 지를 결정한다.
46
+ *
47
+ * 일반적으로 면적을 갖는 컴포넌트는 대체로 가능하다.(return true)
48
+ * 그러나, LINE 등 면적을 가지지않는 컴포넌트는 가능하지 않도록 정의한다.(return false)
49
+ */
50
+ get resizable() {
51
+ return false;
52
+ }
53
+ /*
54
+ * 회전을 할 수 있는 지를 결정한다.
55
+ *
56
+ * 일반적으로 모든 컴포넌트는 가능하다.(return true)
57
+ */
58
+ get rotatable() {
59
+ return false;
60
+ }
61
+ get nature() {
62
+ return NATURE;
63
+ }
64
+ }
65
+ Component.register('floor', Floor);
66
+ //# sourceMappingURL=floor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floor.js","sourceRoot":"","sources":["../src/floor.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAI9D,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE;gBACR,IAAI,EAAE,eAAe;gBACrB,MAAM,EAAE,UAAS,KAAY;oBAC3B,IAAI,MAAM,GAAG,KAAK,CAAC,MAAmB,CAAA;oBACtC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;oBAC7B,MAAM,CAAC,WAAW,GAAG,CAAC,CAAA;oBACtB,MAAM,CAAC,UAAU,EAAE,CAAA;gBACrB,CAAC;aACF;SACF;KACF;CACF,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,SAAS;IAG1C,IAAI,eAAe;QACjB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,OAAO;QACT,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;;;;OAKG;IACH,IAAI,SAAS;QACX,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;;;OAIG;IACH,IAAI,SAAS;QACX,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CAsTF;AAED,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { Component, Container } from '@hatiolab/things-scene';\n\nimport IndoorMap from './indoor-map';\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'action',\n label: 'remove',\n name: 'remove',\n property: {\n icon: 'remove-circle',\n action: function(floor: Floor) {\n let indoor = floor.parent as IndoorMap\n indoor.removeComponent(floor)\n indoor.activeIndex = 0\n indoor.invalidate()\n }\n }\n }\n ]\n}\n\nexport default class Floor extends Container {\n private _clickPoint?: Component\n\n get hasTextProperty() {\n return false\n }\n\n get showMoveHandle() {\n return false\n }\n\n /*\n * PATH 리스트를 직접 수정할 수 있는 지를 결정한다.\n *\n * 일반적으로 PATH는 바운드 생성을 위해서 논리적으로 생성되므로, 직접 수정하지 않는다.(return false)\n * 그러나, 각 꼭지점들이 개별로 움직이는 다각형류는 path 라는 모델데이타를 가지므로, 직접수정이 가능할 수 있다.(return true)\n *\n * Immutable 컴포넌트의 형상을 바꾸는 방법은 바운드를 이용한 리사이즈나, 특별한 컨트롤을 통해서 가능하다.\n */\n get mutable() {\n return false\n }\n\n /*\n * BOUND를 통해서 리사이즈를 할 수 있는 지를 결정한다.\n *\n * 일반적으로 면적을 갖는 컴포넌트는 대체로 가능하다.(return true)\n * 그러나, LINE 등 면적을 가지지않는 컴포넌트는 가능하지 않도록 정의한다.(return false)\n */\n get resizable() {\n return false\n }\n\n /*\n * 회전을 할 수 있는 지를 결정한다.\n *\n * 일반적으로 모든 컴포넌트는 가능하다.(return true)\n */\n get rotatable() {\n return false\n }\n\n get nature() {\n return NATURE\n }\n\n // drawLocationMarkers(locations) {\n // for (let uuid in locations) {\n // let locInfo = locations[uuid]\n // let props = locInfo.props || {}\n\n // props.width = props.width || 10\n // props.height = props.height || 10\n\n // let currentTime = new Date().getTime()\n // // let diffTime = 500\n // let diffTime = currentTime - locInfo.lastUpdateTime\n\n // if (diffTime < locInfo.updateInterval) {\n // let movingObject = this.findById(uuid)\n // if (movingObject) {\n // // props.yaw = 0;\n // // props.roll = 0;\n\n // movingObject.set(props)\n // for (let key in props) {\n // movingObject[key] = props[key]\n // }\n // } else {\n // // TODO: marker의 초기값 관련 로직 정리 필요.\n\n // let config = Object.assign(\n // {\n // type: locInfo.type || 'rect',\n // // type: locInfo.type || \"camera\",\n // id: uuid,\n // fillStyle: 'red',\n // left: props.center.x - props.width * 0.5,\n // top: props.center.y - props.height * 0.5,\n // cx: props.center.x,\n // cy: props.center.y\n // },\n // props\n // )\n\n // let marker = Model.compile(config)\n\n // this.addComponent(marker)\n\n // // movingObject = this.findById(uuid)\n // // if(movingObject) {\n // // movingObject.set(props);\n // // }\n // }\n // } else {\n // let movingObject = this.findById(uuid)\n // this.removeComponent(movingObject)\n // }\n\n // this.invalidate()\n // }\n // }\n\n // simulate(point) {\n // // for(let i in this.components) {\n // // if(this.components[i].model.type != 'beacon')\n // // continue;\n // //\n // // let beacon = this.components[i]\n // // let distance = Math.sqrt(Math.pow(beacon.center.x - point.x, 2) + Math.pow(beacon.center.y - point.y, 2)) * 0.01\n // // let rssi = -10 * Math.log10(distance) + (beacon.txPower || -71)\n // //\n // // let randRssi = gaussian(rssi, Math.pow(4.894686948810031, 2))\n // //\n // // rssi = randRssi.ppf(Math.random())\n // //\n // // console.log(rssi);\n // // }\n\n // let beacons: {\n // distance: number;\n // gaussian: number;\n // txPower: number;\n // }[] = []\n\n // for (let i in this.components) {\n // if (this.components[i].model.type != 'beacon') continue\n\n // let beacon = this.components[i]\n\n // beacon.distance = Math.sqrt(\n // Math.pow(beacon.center.x - point.x, 2) +\n // Math.pow(beacon.center.y - point.y, 2)\n // )\n // beacon.gaussian = gaussian(\n // beacon.model.txPower || -71,\n // Math.pow(3.209, 2)\n // )\n // beacon.txPower = beacon.gaussian.ppf(Math.random())\n\n // beacons.push(beacon)\n // }\n\n // beacons = beacons.slice(0)\n\n // this.calculatePosition(beacons, point)\n // }\n\n // calculatePosition(nodeArr, position) {\n // let beacons = nodeArr\n\n // beacons.sort(function(a, b) {\n // let rssiA = -10 * Math.log10(a.distance) + a.txPower\n // let rssiB = -10 * Math.log10(b.distance) + b.txPower\n\n // return Math.abs(rssiA) - Math.abs(rssiB)\n // })\n\n // let beaconCombs = this.k_combinations(beacons.slice(0, 4), 3)\n // let positions = []\n\n // for (let i in beaconCombs) {\n // let beaconComb = beaconCombs[i]\n // let beaconA = beaconComb[0]\n // let beaconB = beaconComb[1]\n // let beaconC = beaconComb[2]\n\n // let xa = beaconA.center.x\n // let ya = beaconA.center.y\n // let xb = beaconB.center.x\n // let yb = beaconB.center.y\n // let xc = beaconC.center.x\n // let yc = beaconC.center.y\n // let ra = beaconA.distance\n // let rb = beaconB.distance\n // let rc = beaconC.distance\n\n // // let ra = Math.sqrt(Math.pow(beaconA.center.x - position.x, 2) + Math.pow(beaconA.center.y - position.y, 2)) * 0.01\n // // let rb = Math.sqrt(Math.pow(beaconB.center.x - position.x, 2) + Math.pow(beaconB.center.y - position.y, 2)) * 0.01\n // // let rc = Math.sqrt(Math.pow(beaconC.center.x - position.x, 2) + Math.pow(beaconC.center.y - position.y, 2)) * 0.01\n\n // let rssiA = -10 * Math.log10(beaconA.distance * 0.01) + beaconA.txPower\n // let rssiB = -10 * Math.log10(beaconB.distance * 0.01) + beaconB.txPower\n // let rssiC = -10 * Math.log10(beaconC.distance * 0.01) + beaconC.txPower\n\n // ra = this.calculateDistance(beaconA.txPower, rssiA) * 100\n // rb = this.calculateDistance(beaconB.txPower, rssiB) * 100\n // rc = this.calculateDistance(beaconC.txPower, rssiC) * 100\n\n // let xaSq = xa * xa,\n // xbSq = xb * xb,\n // xcSq = xc * xc,\n // yaSq = ya * ya,\n // ybSq = yb * yb,\n // ycSq = yc * yc,\n // raSq = ra * ra,\n // rbSq = rb * rb,\n // rcSq = rc * rc\n // let numerator1 =\n // (xb - xa) * (xcSq + ycSq - rcSq) +\n // (xa - xc) * (xbSq + ybSq - rbSq) +\n // (xc - xb) * (xaSq + yaSq - raSq)\n // let denominator1 = 2 * (yc * (xb - xa) + yb * (xa - xc) + ya * (xc - xb))\n // let y = numerator1 / denominator1\n // let numerator2 =\n // rbSq - raSq + xaSq - xbSq + yaSq - ybSq - 2 * (ya - yb) * y\n // let denominator2 = 2 * (xa - xb)\n // let x = numerator2 / denominator2\n\n // if (Number.isFinite(x) && Number.isFinite(y)) {\n // positions.push({\n // x: x,\n // y: y\n // })\n // }\n // }\n\n // let avgPosition = this.averageOfPositions(positions)\n\n // if (this._simPosition) this.removeComponent(this._simPosition)\n\n // this._simPosition = Model.compile({\n // type: 'ellipse',\n // cx: avgPosition.x,\n // cy: avgPosition.y,\n // rx: 10,\n // ry: 10,\n // fillStyle: 'navy'\n // })\n\n // this.addComponent(this._simPosition)\n // }\n\n // calculateDistance(txPower, rssi) {\n // if (rssi == 0) {\n // return -1.0 // if we cannot determine distance, return -1.\n // }\n\n // let ratio = (rssi * 1.0) / txPower\n // if (ratio < 1.0) {\n // return Math.pow(ratio, 10)\n // } else {\n // let accuracy = 0.89976 * Math.pow(ratio, 7.7095) + 0.111\n // return accuracy\n // }\n // }\n\n // calculateAngle(p1, p2, p3) {\n // let l1 = Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2),\n // l2 = Math.pow(p2.x - p3.x, 2) + Math.pow(p2.y - p3.y, 2),\n // l3 = Math.pow(p3.x - p1.x, 2) + Math.pow(p3.y - p1.y, 2)\n\n // return Math.acos((l1 + l2 - l3) / Math.sqrt(4 * l1 * l2))\n // }\n\n // averageOfPositions(p) {\n // let sumOfX = 0\n // let sumOfY = 0\n\n // for (let i in p) {\n // let point = p[i]\n // sumOfX += point.x\n // sumOfY += point.y\n // }\n\n // return {\n // x: sumOfX / p.length,\n // y: sumOfY / p.length\n // }\n // }\n\n // k_combinations(set, k) {\n // var i, j, combs, head, tailcombs\n\n // // There is no way to take e.g. sets of 5 elements from\n // // a set of 4.\n // if (k > set.length || k <= 0) {\n // return []\n // }\n\n // // K-sized set has only one K-sized subset.\n // if (k == set.length) {\n // return [set]\n // }\n\n // // There is N 1-sized subsets in a N-sized set.\n // if (k == 1) {\n // combs = []\n // for (i = 0; i < set.length; i++) {\n // combs.push([set[i]])\n // }\n // return combs\n // }\n\n // // Assert {1 < k < set.length}\n\n // // Algorithm description:\n // // To get k-combinations of a set, we want to join each element\n // // with all (k-1)-combinations of the other elements. The set of\n // // these k-sized sets would be the desired result. However, as we\n // // represent sets with lists, we need to take duplicates into\n // // account. To avoid producing duplicates and also unnecessary\n // // computing, we use the following approach: each element i\n // // divides the list into three: the preceding elements, the\n // // current element i, and the subsequent elements. For the first\n // // element, the list of preceding elements is empty. For element i,\n // // we compute the (k-1)-computations of the subsequent elements,\n // // join each with the element i, and store the joined to the set of\n // // computed k-combinations. We do not need to take the preceding\n // // elements into account, because they have already been the i:th\n // // element so they are already computed and stored. When the length\n // // of the subsequent list drops below (k-1), we cannot find any\n // // (k-1)-combs, hence the upper limit for the iteration:\n // combs = []\n // for (i = 0; i < set.length - k + 1; i++) {\n // // head is a list that includes only our current element.\n // head = set.slice(i, i + 1)\n // // We take smaller combinations from the subsequent elements\n // tailcombs = this.k_combinations(set.slice(i + 1), k - 1)\n // // For each (k-1)-combination we join it with the current\n // // and store it to the set of k-combinations.\n // for (j = 0; j < tailcombs.length; j++) {\n // combs.push(head.concat(tailcombs[j]))\n // }\n // }\n // return combs\n // }\n\n // onclick(e) {\n // return\n\n // let point = this.transcoordC2S(e.offsetX, e.offsetY)\n\n // if (this._clickPoint) {\n // this.removeComponent(this._clickPoint)\n // }\n\n // this._clickPoint = Model.compile({\n // type: 'ellipse',\n // cx: point.x,\n // cy: point.y,\n // rx: 10,\n // ry: 10,\n // fillStyle: 'red'\n // })\n\n // this.addComponent(this._clickPoint)\n // this.simulate(point)\n // // let self = this\n // // setTimeout(function() {\n // // self.simulate(point)\n // // }, 500)\n // this.invalidate()\n // }\n}\n\nComponent.register('floor', Floor)\n"]}
@@ -0,0 +1,3 @@
1
+ export { default as Floor } from './floor';
2
+ export { default as IndoorMap } from './indoor-map';
3
+ export { default as Rack } from './rack';
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ export { default as Floor } from './floor';
5
+ export { default as IndoorMap } from './indoor-map';
6
+ export { default as Rack } from './rack';
7
+ // export { default as Beacon } from './beacon'
8
+ // export { default as Camera } from './camera'
9
+ // export { default as Quaternion } from './quaternion'
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAA;AACxC,+CAA+C;AAC/C,+CAA+C;AAC/C,uDAAuD","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nexport { default as Floor } from './floor'\nexport { default as IndoorMap } from './indoor-map'\nexport { default as Rack } from './rack'\n// export { default as Beacon } from './beacon'\n// export { default as Camera } from './camera'\n// export { default as Quaternion } from './quaternion'\n"]}
@@ -0,0 +1,34 @@
1
+ import { Container } from '@hatiolab/things-scene';
2
+ import Floor from './floor';
3
+ export default class IndoorMap extends Container {
4
+ private _focused;
5
+ private __down_point?;
6
+ get nature(): {
7
+ mutable: boolean;
8
+ resizable: boolean;
9
+ rotatable: boolean;
10
+ properties: {
11
+ type: string;
12
+ label: string;
13
+ name: string;
14
+ property: {
15
+ icon: string;
16
+ action: (indoorMap: IndoorMap) => void;
17
+ };
18
+ }[];
19
+ 'value-property': string;
20
+ help: string;
21
+ };
22
+ get layout(): import("@hatiolab/things-scene").LAYOUT;
23
+ get activeIndex(): any;
24
+ set activeIndex(index: any);
25
+ get layoutConfig(): any;
26
+ set layoutConfig(config: any);
27
+ get activeFloor(): Floor;
28
+ ready(): void;
29
+ postrender(context: CanvasRenderingContext2D): void;
30
+ contains(x: number, y: number): boolean;
31
+ onmouseup(e: MouseEvent): void;
32
+ onmousedown(e: MouseEvent): void;
33
+ addFloor(): void;
34
+ }
@@ -0,0 +1,161 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { CardLayout, Component, Container, Model, } from '@hatiolab/things-scene';
5
+ const LABEL_WIDTH = 25;
6
+ const LABEL_HEIGHT = 25;
7
+ function rgba(r, g, b, a) {
8
+ return `rgba(${r}, ${g}, ${b}, ${a})`;
9
+ }
10
+ const NATURE = {
11
+ mutable: false,
12
+ resizable: true,
13
+ rotatable: true,
14
+ properties: [
15
+ {
16
+ type: 'action',
17
+ label: 'floor',
18
+ name: 'floor',
19
+ property: {
20
+ icon: 'add-circle',
21
+ action: (indoorMap) => {
22
+ indoorMap.addFloor();
23
+ }
24
+ }
25
+ }
26
+ ],
27
+ 'value-property': 'activeIndex',
28
+ help: 'scene/component/indoor-map'
29
+ };
30
+ export default class IndoorMap extends Container {
31
+ constructor() {
32
+ super(...arguments);
33
+ this._focused = false;
34
+ // drawLocationMarkers(locations) {
35
+ // let floor = this.activeFloor
36
+ // floor.drawLocationMarkers(locations)
37
+ // }
38
+ }
39
+ get nature() {
40
+ return NATURE;
41
+ }
42
+ get layout() {
43
+ return CardLayout;
44
+ }
45
+ get activeIndex() {
46
+ var config = Object.assign({}, this.layoutConfig);
47
+ return config.activeIndex;
48
+ }
49
+ set activeIndex(index) {
50
+ var config = Object.assign({}, this.layoutConfig);
51
+ config.activeIndex = index;
52
+ this.layoutConfig = config;
53
+ }
54
+ get layoutConfig() {
55
+ return this.get('layoutConfig');
56
+ }
57
+ set layoutConfig(config) {
58
+ this.set('layoutConfig', config);
59
+ }
60
+ get activeFloor() {
61
+ return this.components[this.get('layoutConfig').activeIndex];
62
+ }
63
+ ready() {
64
+ super.ready();
65
+ if (this.components.length == 0)
66
+ this.addFloor();
67
+ }
68
+ postrender(context) {
69
+ super.postrender(context);
70
+ if (this.app.isViewMode)
71
+ return;
72
+ if (!this._focused)
73
+ return;
74
+ var { left, top, width, fillStyle } = this.model;
75
+ // floor 선택 탭 그리기
76
+ for (let i = 0; i < this.components.length; i++) {
77
+ context.beginPath();
78
+ context.rect(left - LABEL_WIDTH, top + i * LABEL_HEIGHT, LABEL_WIDTH, LABEL_HEIGHT);
79
+ let color = 255 - ((20 * (i + 1)) % 255);
80
+ context.fillStyle = rgba(color, color, color, 1);
81
+ context.fill();
82
+ context.closePath();
83
+ }
84
+ context.beginPath();
85
+ context.moveTo(left, top);
86
+ context.lineTo(left - LABEL_WIDTH, top);
87
+ context.lineTo(left - LABEL_WIDTH, top + this.components.length * LABEL_HEIGHT);
88
+ context.lineTo(left, top + this.components.length * LABEL_HEIGHT);
89
+ context.strokeStyle = '#ccc';
90
+ context.stroke();
91
+ context.closePath();
92
+ }
93
+ contains(x, y) {
94
+ var contains = super.contains(x, y);
95
+ if (this.app.isViewMode)
96
+ return contains;
97
+ var { left, top, width } = this.bounds;
98
+ var h = LABEL_HEIGHT;
99
+ contains =
100
+ contains ||
101
+ // card selector 영역에 포함되는지
102
+ (x < Math.max(left - LABEL_WIDTH, left) &&
103
+ x > Math.min(left - LABEL_WIDTH, left) &&
104
+ y < Math.max(top + h * this.size(), top) &&
105
+ y > Math.min(top + h * this.size(), top));
106
+ if (contains)
107
+ this._focused = true;
108
+ else
109
+ this._focused = false;
110
+ this.invalidate();
111
+ return contains;
112
+ }
113
+ onmouseup(e) {
114
+ var down_point = this.__down_point;
115
+ delete this.__down_point;
116
+ if (!down_point || down_point.x != e.offsetX || down_point.y != e.offsetY) {
117
+ return;
118
+ }
119
+ var point = this.transcoordC2S(e.offsetX, e.offsetY);
120
+ var { left, top } = this.model;
121
+ var x = point.x - left;
122
+ var y = point.y - top;
123
+ if (x > 0)
124
+ return;
125
+ y /= LABEL_HEIGHT;
126
+ y = Math.floor(y);
127
+ if (!this.layoutConfig)
128
+ this.layoutConfig = {};
129
+ if (y >= this.components.length)
130
+ return;
131
+ // /* 생성 버튼이 클릭되면, 새로운 floor를 추가한다. */
132
+ // if(y == this.components.length) {
133
+ // this.add(Model.compile({
134
+ // type: 'floor',
135
+ // width: 100,
136
+ // height: 100
137
+ // }))
138
+ // }
139
+ this.activeIndex = y;
140
+ }
141
+ onmousedown(e) {
142
+ this.__down_point = {
143
+ x: e.offsetX,
144
+ y: e.offsetY
145
+ };
146
+ }
147
+ addFloor() {
148
+ let floor = Model.compile({
149
+ type: 'floor',
150
+ fillStyle: 'gray',
151
+ top: 0,
152
+ left: 0,
153
+ width: 100,
154
+ height: 100
155
+ });
156
+ this.addComponent(floor);
157
+ this.activeIndex = this.components.length - 1;
158
+ }
159
+ }
160
+ Component.register('indoor-map', IndoorMap);
161
+ //# sourceMappingURL=indoor-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indoor-map.js","sourceRoot":"","sources":["../src/indoor-map.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,UAAU,EACV,SAAS,EACT,SAAS,EACT,KAAK,GAEN,MAAM,wBAAwB,CAAC;AAIhC,MAAM,WAAW,GAAG,EAAE,CAAA;AACtB,MAAM,YAAY,GAAG,EAAE,CAAA;AAEvB,SAAS,IAAI,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;IACtD,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAA;AACvC,CAAC;AAED,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE;gBACR,IAAI,EAAE,YAAY;gBAClB,MAAM,EAAE,CAAC,SAAoB,EAAE,EAAE;oBAC/B,SAA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AI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAA;IAC/C,CAAC;CAMF;AAED,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport {\n CardLayout,\n Component,\n Container,\n Model,\n POINT,\n} from '@hatiolab/things-scene';\n\nimport Floor from './floor';\n\nconst LABEL_WIDTH = 25\nconst LABEL_HEIGHT = 25\n\nfunction rgba(r: number, g: number, b: number, a: number) {\n return `rgba(${r}, ${g}, ${b}, ${a})`\n}\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'action',\n label: 'floor',\n name: 'floor',\n property: {\n icon: 'add-circle',\n action: (indoorMap: IndoorMap) => {\n indoorMap.addFloor()\n }\n }\n }\n ],\n 'value-property': 'activeIndex',\n help: 'scene/component/indoor-map'\n}\n\nexport default class IndoorMap extends Container {\n private _focused: boolean = false\n private __down_point?: POINT\n\n get nature() {\n return NATURE\n }\n\n get layout() {\n return CardLayout\n }\n\n get activeIndex() {\n var config = Object.assign({}, this.layoutConfig)\n return config.activeIndex\n }\n\n set activeIndex(index) {\n var config = Object.assign({}, this.layoutConfig)\n config.activeIndex = index\n this.layoutConfig = config\n }\n\n get layoutConfig() {\n return this.get('layoutConfig')\n }\n\n set layoutConfig(config) {\n this.set('layoutConfig', config)\n }\n\n get activeFloor(): Floor {\n return this.components[this.get('layoutConfig').activeIndex] as Floor\n }\n\n ready() {\n super.ready()\n\n if (this.components.length == 0) this.addFloor()\n }\n\n postrender(context: CanvasRenderingContext2D) {\n super.postrender(context)\n\n if (this.app.isViewMode) return\n\n if (!this._focused) return\n\n var { left, top, width, fillStyle } = this.model\n\n // floor 선택 탭 그리기\n for (let i = 0; i < this.components.length; i++) {\n context.beginPath()\n\n context.rect(\n left - LABEL_WIDTH,\n top + i * LABEL_HEIGHT,\n LABEL_WIDTH,\n LABEL_HEIGHT\n )\n\n let color = 255 - ((20 * (i + 1)) % 255)\n context.fillStyle = rgba(color, color, color, 1)\n context.fill()\n\n context.closePath()\n }\n\n context.beginPath()\n\n context.moveTo(left, top)\n context.lineTo(left - LABEL_WIDTH, top)\n context.lineTo(\n left - LABEL_WIDTH,\n top + this.components.length * LABEL_HEIGHT\n )\n context.lineTo(left, top + this.components.length * LABEL_HEIGHT)\n\n context.strokeStyle = '#ccc'\n context.stroke()\n\n context.closePath()\n }\n\n contains(x: number, y: number) {\n var contains = super.contains(x, y)\n\n if (this.app.isViewMode) return contains\n\n var { left, top, width } = this.bounds\n var h = LABEL_HEIGHT\n\n contains =\n contains ||\n // card selector 영역에 포함되는지\n (x < Math.max(left - LABEL_WIDTH, left) &&\n x > Math.min(left - LABEL_WIDTH, left) &&\n y < Math.max(top + h * this.size(), top) &&\n y > Math.min(top + h * this.size(), top))\n\n if (contains) this._focused = true\n else this._focused = false\n\n this.invalidate()\n return contains\n }\n\n onmouseup(e: MouseEvent) {\n var down_point = this.__down_point\n delete this.__down_point\n\n if (!down_point || down_point.x != e.offsetX || down_point.y != e.offsetY) {\n return\n }\n\n var point = this.transcoordC2S(e.offsetX, e.offsetY)\n\n var { left, top } = this.model\n\n var x = point.x - left\n var y = point.y - top\n\n if (x > 0) return\n\n y /= LABEL_HEIGHT\n y = Math.floor(y)\n\n if (!this.layoutConfig) this.layoutConfig = {}\n\n if (y >= this.components.length) return\n\n // /* 생성 버튼이 클릭되면, 새로운 floor를 추가한다. */\n // if(y == this.components.length) {\n // this.add(Model.compile({\n // type: 'floor',\n // width: 100,\n // height: 100\n // }))\n // }\n this.activeIndex = y\n }\n\n onmousedown(e: MouseEvent) {\n this.__down_point = {\n x: e.offsetX,\n y: e.offsetY\n }\n }\n\n addFloor() {\n let floor = Model.compile({\n type: 'floor',\n fillStyle: 'gray',\n top: 0,\n left: 0,\n width: 100,\n height: 100\n })\n\n this.addComponent(floor)\n this.activeIndex = this.components.length - 1\n }\n\n // drawLocationMarkers(locations) {\n // let floor = this.activeFloor\n // floor.drawLocationMarkers(locations)\n // }\n}\n\nComponent.register('indoor-map', IndoorMap)\n"]}
@@ -0,0 +1,39 @@
1
+ export default class Quaternion {
2
+ x: number;
3
+ y: number;
4
+ z: number;
5
+ w: number;
6
+ constructor(x: number, y: number, z: number, w?: number);
7
+ multiply(q: Quaternion): Quaternion;
8
+ add(x_: number | Quaternion, y_: number, z_: number, w_: number): Quaternion;
9
+ get coords(): {
10
+ x: number;
11
+ y: number;
12
+ z: number;
13
+ w: number;
14
+ };
15
+ get array(): number[];
16
+ get inverse(): Quaternion;
17
+ get size(): number;
18
+ get norm(): Quaternion;
19
+ static fromAxis(axis: {
20
+ x: number;
21
+ y: number;
22
+ z: number;
23
+ }, angle: number): Quaternion;
24
+ static fromEuler(vec: {
25
+ x: number;
26
+ y: number;
27
+ z: number;
28
+ }): Quaternion;
29
+ multiVec(vec: {
30
+ x: number;
31
+ y: number;
32
+ z: number;
33
+ }): {
34
+ x: number;
35
+ y: number;
36
+ z: number;
37
+ };
38
+ toString(): string;
39
+ }
@@ -0,0 +1,79 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ export default class Quaternion {
5
+ constructor(x, y, z, w) {
6
+ this.x = x || 0;
7
+ this.y = y || 0;
8
+ this.z = z || 0;
9
+ this.w = w === undefined ? 1 : w;
10
+ }
11
+ multiply(q) {
12
+ var { x, y, z, w } = this;
13
+ var qx = q.x, qy = q.y, qz = q.z, qw = q.w;
14
+ return new Quaternion(x * qw + y * qz - z * qy + w * qx, -x * qz + y * qw + z * qx + w * qy, x * qy - y * qx + z * qw + w * qz, -x * qx - y * qy - z * qz + w * qw);
15
+ }
16
+ add(x_, y_, z_, w_) {
17
+ var { x, y, z, w } = this;
18
+ // of the form: `q1.add(q2)`
19
+ if (isNaN(Number(x_)))
20
+ return x_.add(x, y, z, w);
21
+ // addition of the just scaler component. of the form: `q1.add(n)`
22
+ if (y_ === undefined)
23
+ return new Quaternion(x, y, z, w + x_);
24
+ // of the form: `q1.add(x, y, z, w)`
25
+ return new Quaternion(x + x_, y + y_, z + z_, w + w_);
26
+ }
27
+ get coords() {
28
+ return {
29
+ x: this.x,
30
+ y: this.y,
31
+ z: this.z,
32
+ w: this.w
33
+ };
34
+ }
35
+ get array() {
36
+ return [this.x, this.y, this.z, this.w];
37
+ }
38
+ get inverse() {
39
+ return new Quaternion(-this.x, -this.y, -this.z);
40
+ }
41
+ get size() {
42
+ return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
43
+ }
44
+ get norm() {
45
+ var l = this.size;
46
+ if (l === 0)
47
+ return new Quaternion(0, 0, 0, 0);
48
+ else
49
+ return new Quaternion(this.x / l, this.y / l, this.z / l, this.w / l);
50
+ }
51
+ static fromAxis(axis, angle) {
52
+ // see: http://www.genesis3d.com/~kdtop/Quaternions-UsingToRepresentRotation.htm
53
+ // q = (s, v_vec)
54
+ // s = cos(theta / 2)
55
+ // v = u_vec * sin (theta / 2)
56
+ var halfAngle = angle / 2, s = Math.sin(halfAngle);
57
+ return new Quaternion(axis.x * s, axis.y * s, axis.z * s, Math.cos(halfAngle));
58
+ }
59
+ static fromEuler(vec) {
60
+ var c = 1, x = vec.x * c, y = vec.y * c, z = vec.z * c, c1 = Math.cos(y), s1 = Math.sin(y), c2 = Math.cos(-z), s2 = Math.sin(-z), c3 = Math.cos(x), s3 = Math.sin(x), c1c2 = c1 * c2, s1s2 = s1 * s2;
61
+ return new Quaternion(c1c2 * s3 + s1s2 * c3, s1 * c2 * c3 + c1 * s2 * s3, c1 * s2 * c3 - s1 * c2 * s3, c1c2 * c3 - s1s2 * s3);
62
+ }
63
+ multiVec(vec) {
64
+ var { x, y, z, w } = this;
65
+ // quaternion * vec
66
+ var x_ = w * vec.x + y * vec.z - z * vec.y, y_ = w * vec.y + z * vec.x - x * vec.z, z_ = w * vec.z + x * vec.y - y * vec.x, w_ = -x * vec.x - y * vec.y - z * vec.z;
67
+ // vec * quaternion^-1
68
+ return {
69
+ // note: possible future per. opt. in signs
70
+ x: x_ * w + w_ * -x + y_ * -z - z_ * -y,
71
+ y: y_ * w + w_ * -y + z_ * -x - x_ * -z,
72
+ z: z_ * w + w_ * -z + x_ * -y - y_ * -x
73
+ };
74
+ }
75
+ toString() {
76
+ return '[x=' + this.x + ', y=' + this.y + ', z=' + this.z + ', w=' + this.w + ']';
77
+ }
78
+ }
79
+ //# sourceMappingURL=quaternion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quaternion.js","sourceRoot":"","sources":["../src/quaternion.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAM7B,YAAY,CAAU,EAAE,CAAS,EAAE,CAAS,EAAE,CAAU;QACtD,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,QAAQ,CAAC,CAAa;QACpB,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;QAC1B,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,EACV,EAAE,GAAG,CAAC,CAAC,CAAC,EACR,EAAE,GAAG,CAAC,CAAC,CAAC,EACR,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QAEX,OAAO,IAAI,UAAU,CACnB,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,EACjC,CAAE,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GA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AC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,EACtC,EAAE,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAE1C,sBAAsB;QACtB,OAAO;YACL,2CAA2C;YAC3C,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YACvC,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YACvC,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;SACxC,CAAA;IACH,CAAC;IAED,QAAQ;QACN,OAAO,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC,GAAG,GAAG,CAAA;IACnF,CAAC;CAEF","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nexport default class Quaternion {\n x: number\n y: number\n z: number\n w: number\n\n constructor(x: number, y: number, z: number, w?: number) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n this.w = w === undefined ? 1 : w;\n }\n\n multiply(q: Quaternion) {\n var { x, y, z, w } = this;\n var qx = q.x,\n qy = q.y,\n qz = q.z,\n qw = q.w;\n\n return new Quaternion(\n x * qw + y * qz - z * qy + w * qx,\n - x * qz + y * qw + z * qx + w * qy,\n x * qy - y * qx + z * qw + w * qz,\n - x * qx - y * qy - z * qz + w * qw\n );\n }\n\n add(x_: number | Quaternion, y_: number, z_: number, w_: number): Quaternion {\n var { x, y, z, w } = this;\n\n // of the form: `q1.add(q2)`\n if (isNaN(Number(x_)))\n return (x_ as Quaternion).add(x, y, z, w);\n\n // addition of the just scaler component. of the form: `q1.add(n)`\n if (y_ === undefined)\n return new Quaternion(x, y, z, w + (x_ as number));\n\n // of the form: `q1.add(x, y, z, w)`\n return new Quaternion(x + (x_ as number), y + y_, z + z_, w + w_);\n }\n\n get coords() {\n return {\n x: this.x,\n y: this.y,\n z: this.z,\n w: this.w\n }\n }\n\n get array() {\n return [this.x, this.y, this.z, this.w];\n }\n\n get inverse() {\n return new Quaternion(-this.x, -this.y, -this.z);\n }\n\n get size() {\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\n }\n\n get norm() {\n var l = this.size;\n if (l === 0)\n return new Quaternion(0, 0, 0, 0);\n else\n return new Quaternion(this.x / l, this.y / l, this.z / l, this.w / l);\n }\n\n static fromAxis(axis: {x: number, y: number, z: number}, angle: number) {\n // see: http://www.genesis3d.com/~kdtop/Quaternions-UsingToRepresentRotation.htm\n // q = (s, v_vec)\n // s = cos(theta / 2)\n // v = u_vec * sin (theta / 2)\n var halfAngle = angle / 2, s = Math.sin(halfAngle);\n return new Quaternion(axis.x * s, axis.y * s, axis.z * s, Math.cos(halfAngle));\n }\n\n static fromEuler(vec: {x: number, y: number, z: number}) {\n var c = 1,\n x = vec.x * c,\n y = vec.y * c,\n z = vec.z * c,\n c1 = Math.cos(y),\n s1 = Math.sin(y),\n c2 = Math.cos(-z),\n s2 = Math.sin(-z),\n c3 = Math.cos(x),\n s3 = Math.sin(x),\n c1c2 = c1 * c2,\n s1s2 = s1 * s2;\n\n return new Quaternion(\n c1c2 * s3 + s1s2 * c3,\n s1 * c2 * c3 + c1 * s2 * s3,\n c1 * s2 * c3 - s1 * c2 * s3,\n c1c2 * c3 - s1s2 * s3\n );\n }\n\n multiVec(vec: {x: number, y: number, z: number}) {\n var { x, y, z, w } = this;\n\n // quaternion * vec\n var x_ = w * vec.x + y * vec.z - z * vec.y,\n y_ = w * vec.y + z * vec.x - x * vec.z,\n z_ = w * vec.z + x * vec.y - y * vec.x,\n w_ = -x * vec.x - y * vec.y - z * vec.z;\n\n // vec * quaternion^-1\n return {\n // note: possible future per. opt. in signs\n x: x_ * w + w_ * -x + y_ * -z - z_ * -y,\n y: y_ * w + w_ * -y + z_ * -x - x_ * -z,\n z: z_ * w + w_ * -z + x_ * -y - y_ * -x\n }\n }\n\n toString() {\n return '[x=' + this.x + ', y=' + this.y + ', z=' + this.z + ', w=' + this.w + ']'\n }\n\n}\n"]}
package/dist/rack.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ import { Component } from '@hatiolab/things-scene';
2
+ declare const Rack_base: typeof Component;
3
+ export default class Rack extends Rack_base {
4
+ is3dish(): boolean;
5
+ draw(context: CanvasRenderingContext2D): void;
6
+ get nature(): {
7
+ mutable: boolean;
8
+ resizable: boolean;
9
+ rotatable: boolean;
10
+ properties: ({
11
+ type: string;
12
+ label: string;
13
+ name: string;
14
+ property: string;
15
+ placeholder?: undefined;
16
+ } | {
17
+ type: string;
18
+ label: string;
19
+ name: string;
20
+ placeholder: string;
21
+ property: string;
22
+ })[];
23
+ help: string;
24
+ };
25
+ get hasTextProperty(): boolean;
26
+ }
27
+ export {};