@fmsim/machine 0.0.49
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.
- package/dist/agv-line.js +48 -0
- package/dist/agv-line.js.map +1 -0
- package/dist/agv.js +43 -0
- package/dist/agv.js.map +1 -0
- package/dist/buffer.js +40 -0
- package/dist/buffer.js.map +1 -0
- package/dist/conveyor-join.js +169 -0
- package/dist/conveyor-join.js.map +1 -0
- package/dist/conveyor.js +84 -0
- package/dist/conveyor.js.map +1 -0
- package/dist/crane.js +55 -0
- package/dist/crane.js.map +1 -0
- package/dist/data-subscription.js +126 -0
- package/dist/data-subscription.js.map +1 -0
- package/dist/editors/index.js +2 -0
- package/dist/editors/index.js.map +1 -0
- package/dist/equipment.js +18 -0
- package/dist/equipment.js.map +1 -0
- package/dist/features/client-api.js +45 -0
- package/dist/features/client-api.js.map +1 -0
- package/dist/features/conveyor-mixin.js +54 -0
- package/dist/features/conveyor-mixin.js.map +1 -0
- package/dist/features/mcs-event-handler-mixin.js +65 -0
- package/dist/features/mcs-event-handler-mixin.js.map +1 -0
- package/dist/features/mcs-status-default.js +67 -0
- package/dist/features/mcs-status-default.js.map +1 -0
- package/dist/features/mcs-status-mixin.js +39 -0
- package/dist/features/mcs-status-mixin.js.map +1 -0
- package/dist/features/mcs-transport-mixin.js +39 -0
- package/dist/features/mcs-transport-mixin.js.map +1 -0
- package/dist/features/mcs-zone-mixin.js +18 -0
- package/dist/features/mcs-zone-mixin.js.map +1 -0
- package/dist/groups/index.js +10 -0
- package/dist/groups/index.js.map +1 -0
- package/dist/groups/mcs-acs.js +24 -0
- package/dist/groups/mcs-acs.js.map +1 -0
- package/dist/groups/mcs-bcs.js +27 -0
- package/dist/groups/mcs-bcs.js.map +1 -0
- package/dist/groups/mcs-ccs.js +25 -0
- package/dist/groups/mcs-ccs.js.map +1 -0
- package/dist/groups/mcs-ecs.js +23 -0
- package/dist/groups/mcs-ecs.js.map +1 -0
- package/dist/groups/mcs-ocs.js +25 -0
- package/dist/groups/mcs-ocs.js.map +1 -0
- package/dist/groups/mcs-path.js +28 -0
- package/dist/groups/mcs-path.js.map +1 -0
- package/dist/groups/mcs-scs.js +26 -0
- package/dist/groups/mcs-scs.js.map +1 -0
- package/dist/groups/mcs-shape.js +26 -0
- package/dist/groups/mcs-shape.js.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/mcs-carrier-holder.js +107 -0
- package/dist/mcs-carrier-holder.js.map +1 -0
- package/dist/mcs-gauge-capacity-bar.js +170 -0
- package/dist/mcs-gauge-capacity-bar.js.map +1 -0
- package/dist/mcs-gauge-capacity-circle.js +91 -0
- package/dist/mcs-gauge-capacity-circle.js.map +1 -0
- package/dist/mcs-machine.js +84 -0
- package/dist/mcs-machine.js.map +1 -0
- package/dist/mcs-popup.js +82 -0
- package/dist/mcs-popup.js.map +1 -0
- package/dist/mcs-transport.js +18 -0
- package/dist/mcs-transport.js.map +1 -0
- package/dist/mcs-unit.js +78 -0
- package/dist/mcs-unit.js.map +1 -0
- package/dist/mcs-vehicle.js +69 -0
- package/dist/mcs-vehicle.js.map +1 -0
- package/dist/mcs-zone-unit.js +11 -0
- package/dist/mcs-zone-unit.js.map +1 -0
- package/dist/oht-line.js +32 -0
- package/dist/oht-line.js.map +1 -0
- package/dist/oht.js +42 -0
- package/dist/oht.js.map +1 -0
- package/dist/port.js +32 -0
- package/dist/port.js.map +1 -0
- package/dist/rtv-rail.js +36 -0
- package/dist/rtv-rail.js.map +1 -0
- package/dist/shelf.js +41 -0
- package/dist/shelf.js.map +1 -0
- package/dist/shuttle.js +49 -0
- package/dist/shuttle.js.map +1 -0
- package/dist/stocker-capacity-bar.js +171 -0
- package/dist/stocker-capacity-bar.js.map +1 -0
- package/dist/stocker.js +36 -0
- package/dist/stocker.js.map +1 -0
- package/dist/templates/agv-line-corner.js +34 -0
- package/dist/templates/agv-line-corner.js.map +1 -0
- package/dist/templates/agv-line-cross.js +34 -0
- package/dist/templates/agv-line-cross.js.map +1 -0
- package/dist/templates/agv-line-horizontal.js +34 -0
- package/dist/templates/agv-line-horizontal.js.map +1 -0
- package/dist/templates/agv-line-vertical.js +34 -0
- package/dist/templates/agv-line-vertical.js.map +1 -0
- package/dist/templates/agv-line.js +15 -0
- package/dist/templates/agv-line.js.map +1 -0
- package/dist/templates/agv.js +15 -0
- package/dist/templates/agv.js.map +1 -0
- package/dist/templates/buffer.js +15 -0
- package/dist/templates/buffer.js.map +1 -0
- package/dist/templates/conveyor-corner.js +33 -0
- package/dist/templates/conveyor-corner.js.map +1 -0
- package/dist/templates/conveyor-join.js +21 -0
- package/dist/templates/conveyor-join.js.map +1 -0
- package/dist/templates/conveyor-left.js +33 -0
- package/dist/templates/conveyor-left.js.map +1 -0
- package/dist/templates/conveyor-middle.js +33 -0
- package/dist/templates/conveyor-middle.js.map +1 -0
- package/dist/templates/conveyor-right.js +33 -0
- package/dist/templates/conveyor-right.js.map +1 -0
- package/dist/templates/conveyor.js +18 -0
- package/dist/templates/conveyor.js.map +1 -0
- package/dist/templates/crane.js +15 -0
- package/dist/templates/crane.js.map +1 -0
- package/dist/templates/data-subscription.js +16 -0
- package/dist/templates/data-subscription.js.map +1 -0
- package/dist/templates/equipment.js +15 -0
- package/dist/templates/equipment.js.map +1 -0
- package/dist/templates/index.js +35 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/mcs-gauge-capacity-bar.js +18 -0
- package/dist/templates/mcs-gauge-capacity-bar.js.map +1 -0
- package/dist/templates/mcs-gauge-capacity-circle.js +18 -0
- package/dist/templates/mcs-gauge-capacity-circle.js.map +1 -0
- package/dist/templates/oht-line-corner.js +34 -0
- package/dist/templates/oht-line-corner.js.map +1 -0
- package/dist/templates/oht-line-cross.js +34 -0
- package/dist/templates/oht-line-cross.js.map +1 -0
- package/dist/templates/oht-line-horizontal.js +34 -0
- package/dist/templates/oht-line-horizontal.js.map +1 -0
- package/dist/templates/oht-line-vertical.js +34 -0
- package/dist/templates/oht-line-vertical.js.map +1 -0
- package/dist/templates/oht-line.js +15 -0
- package/dist/templates/oht-line.js.map +1 -0
- package/dist/templates/oht.js +15 -0
- package/dist/templates/oht.js.map +1 -0
- package/dist/templates/port.js +15 -0
- package/dist/templates/port.js.map +1 -0
- package/dist/templates/rtv-corner.js +33 -0
- package/dist/templates/rtv-corner.js.map +1 -0
- package/dist/templates/rtv-left.js +33 -0
- package/dist/templates/rtv-left.js.map +1 -0
- package/dist/templates/rtv-middle.js +33 -0
- package/dist/templates/rtv-middle.js.map +1 -0
- package/dist/templates/rtv-rail.js +15 -0
- package/dist/templates/rtv-rail.js.map +1 -0
- package/dist/templates/rtv-right.js +33 -0
- package/dist/templates/rtv-right.js.map +1 -0
- package/dist/templates/rtv.js +15 -0
- package/dist/templates/rtv.js.map +1 -0
- package/dist/templates/shelf.js +15 -0
- package/dist/templates/shelf.js.map +1 -0
- package/dist/templates/shuttle.js +15 -0
- package/dist/templates/shuttle.js.map +1 -0
- package/dist/templates/stocker-capacity-bar.js +18 -0
- package/dist/templates/stocker-capacity-bar.js.map +1 -0
- package/dist/templates/stocker-capacity-circle.js +18 -0
- package/dist/templates/stocker-capacity-circle.js.map +1 -0
- package/dist/templates/stocker.js +16 -0
- package/dist/templates/stocker.js.map +1 -0
- package/dist/templates/zone-capacity-bar.js +19 -0
- package/dist/templates/zone-capacity-bar.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/get-locale.js +19 -0
- package/dist/utils/get-locale.js.map +1 -0
- package/dist/utils/get-value-on-ranges.js +23 -0
- package/dist/utils/get-value-on-ranges.js.map +1 -0
- package/dist/utils/normalize-angle.js +11 -0
- package/dist/utils/normalize-angle.js.map +1 -0
- package/dist/utils/safe-round.js +9 -0
- package/dist/utils/safe-round.js.map +1 -0
- package/dist/zone-capacity-bar.js +162 -0
- package/dist/zone-capacity-bar.js.map +1 -0
- package/icons/agv-line.png +0 -0
- package/icons/agv.png +0 -0
- package/icons/buffer.png +0 -0
- package/icons/conveyor-corner.png +0 -0
- package/icons/conveyor-corner.svg +10 -0
- package/icons/conveyor-join.png +0 -0
- package/icons/conveyor-left.png +0 -0
- package/icons/conveyor-left.svg +6 -0
- package/icons/conveyor-middle.png +0 -0
- package/icons/conveyor-middle.svg +5 -0
- package/icons/conveyor-right.png +0 -0
- package/icons/conveyor-right.svg +6 -0
- package/icons/conveyor.png +0 -0
- package/icons/crane.png +0 -0
- package/icons/equipment.png +0 -0
- package/icons/icon-data-subscription.png +0 -0
- package/icons/oht-line.png +0 -0
- package/icons/oht.png +0 -0
- package/icons/pallet-empty.svg +3 -0
- package/icons/pallet.svg +11 -0
- package/icons/path-position.svg +5 -0
- package/icons/port.png +0 -0
- package/icons/process.png +0 -0
- package/icons/rtv-rail.png +0 -0
- package/icons/rtv.png +0 -0
- package/icons/shelf.png +0 -0
- package/icons/shuttle.png +0 -0
- package/icons/stocker-capacity-bar.png +0 -0
- package/icons/stocker-capacity-circle.png +0 -0
- package/icons/stocker.png +0 -0
- package/icons/symbol-data-subscription.png +0 -0
- package/icons/vehicle.png +0 -0
- package/icons/zone-capacity-bar.png +0 -0
- package/migration-samples/model.json +7964 -0
- package/package.json +59 -0
- package/src/agv-line.ts +59 -0
- package/src/agv.ts +56 -0
- package/src/buffer.ts +50 -0
- package/src/conveyor-join.ts +208 -0
- package/src/conveyor.ts +101 -0
- package/src/crane.ts +72 -0
- package/src/data-subscription.ts +150 -0
- package/src/editors/index.ts +0 -0
- package/src/equipment.ts +21 -0
- package/src/features/client-api.ts +52 -0
- package/src/features/conveyor-mixin.ts +75 -0
- package/src/features/mcs-status-default.ts +76 -0
- package/src/features/mcs-status-mixin.ts +53 -0
- package/src/features/mcs-zone-mixin.ts +23 -0
- package/src/groups/index.ts +10 -0
- package/src/groups/mcs-acs.ts +24 -0
- package/src/groups/mcs-bcs.ts +27 -0
- package/src/groups/mcs-ccs.ts +25 -0
- package/src/groups/mcs-ecs.ts +23 -0
- package/src/groups/mcs-ocs.ts +25 -0
- package/src/groups/mcs-path.ts +28 -0
- package/src/groups/mcs-scs.ts +26 -0
- package/src/groups/mcs-shape.ts +26 -0
- package/src/index.ts +29 -0
- package/src/mcs-carrier-holder.ts +141 -0
- package/src/mcs-gauge-capacity-circle.ts +113 -0
- package/src/mcs-machine.ts +101 -0
- package/src/mcs-popup.ts +99 -0
- package/src/mcs-transport.ts +20 -0
- package/src/mcs-unit.ts +91 -0
- package/src/mcs-vehicle.ts +79 -0
- package/src/oht-line.ts +43 -0
- package/src/oht.ts +55 -0
- package/src/port.ts +41 -0
- package/src/shelf.ts +53 -0
- package/src/shuttle.ts +65 -0
- package/src/stocker-capacity-bar.ts +220 -0
- package/src/stocker.ts +45 -0
- package/src/templates/agv-line.ts +15 -0
- package/src/templates/agv.ts +15 -0
- package/src/templates/buffer.ts +15 -0
- package/src/templates/conveyor.ts +18 -0
- package/src/templates/crane.ts +15 -0
- package/src/templates/data-subscription.js +16 -0
- package/src/templates/equipment.ts +15 -0
- package/src/templates/index.ts +43 -0
- package/src/templates/oht-line.ts +15 -0
- package/src/templates/oht.ts +15 -0
- package/src/templates/port.ts +15 -0
- package/src/templates/shelf.ts +15 -0
- package/src/templates/shuttle.ts +15 -0
- package/src/templates/stocker-capacity-bar.ts +18 -0
- package/src/templates/stocker-capacity-circle.ts +18 -0
- package/src/templates/stocker.ts +16 -0
- package/src/templates/zone-capacity-bar.ts +19 -0
- package/src/utils/get-locale.ts +22 -0
- package/src/utils/get-value-on-ranges.ts +25 -0
- package/src/utils/normalize-angle.ts +9 -0
- package/src/utils/safe-round.ts +8 -0
- package/src/zone-capacity-bar.ts +209 -0
- package/things-scene.config.js +7 -0
- package/translations/en.json +7 -0
- package/translations/ja.json +7 -0
- package/translations/ko.json +7 -0
- package/translations/ms.json +7 -0
- package/translations/zh.json +7 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const icon = `
|
|
2
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
3
|
+
viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
|
|
4
|
+
<style type="text/css">
|
|
5
|
+
.st0{fill:none;stroke:{{strokeColor}};stroke-width:2;stroke-linecap:round;stroke-miterlimit:10;}
|
|
6
|
+
.st1{fill:{{strokeColor}}}
|
|
7
|
+
.st2{fill:none;stroke:{{strokeColor}};stroke-miterlimit:10;}
|
|
8
|
+
</style>
|
|
9
|
+
<path class="st0" d="M26.17,27.87H8.74c-2.36,0-4.29-1.93-4.29-4.29V12.16c0-2.36,1.93-4.29,4.29-4.29h17.43
|
|
10
|
+
c2.36,0,4.29,1.93,4.29,4.29v11.43C30.46,25.94,28.53,27.87,26.17,27.87z"/>
|
|
11
|
+
<path class="st0" d="M26.46,27.87h-18c-2.2,0-4-1.8-4-4v0c0-2.2,1.8-4,4-4h18c2.2,0,4,1.8,4,4v0
|
|
12
|
+
C30.46,26.07,28.66,27.87,26.46,27.87z"/>
|
|
13
|
+
<circle class="st1" cx="10.29" cy="24.06" r="1.5"/>
|
|
14
|
+
<circle class="st1" cx="17.64" cy="24.06" r="1.5"/>
|
|
15
|
+
<circle class="st1" cx="24.99" cy="24.06" r="1.5"/>
|
|
16
|
+
<line class="st2" x1="8.61" y1="7.87" x2="8.61" y2="19.87"/>
|
|
17
|
+
<line class="st2" x1="14.57" y1="7.87" x2="14.57" y2="19.87"/>
|
|
18
|
+
<line class="st2" x1="20.53" y1="7.87" x2="20.53" y2="19.87"/>
|
|
19
|
+
<line class="st2" x1="26.49" y1="7.87" x2="26.49" y2="19.87"/>
|
|
20
|
+
</svg>
|
|
21
|
+
`;
|
|
22
|
+
export const mcsPath = {
|
|
23
|
+
name: 'mcsPath',
|
|
24
|
+
description: 'a group of various mcs-paths',
|
|
25
|
+
icon,
|
|
26
|
+
templates: []
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=mcs-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcs-path.js","sourceRoot":"","sources":["../../src/groups/mcs-path.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;CAoBZ,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,8BAA8B;IAC3C,IAAI;IACJ,SAAS,EAAE,EAAE;CACd,CAAA","sourcesContent":["const icon = `\n<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 35 35\" style=\"enable-background:new 0 0 35 35;\" xml:space=\"preserve\">\n <style type=\"text/css\">\n .st0{fill:none;stroke:{{strokeColor}};stroke-width:2;stroke-linecap:round;stroke-miterlimit:10;}\n .st1{fill:{{strokeColor}}}\n .st2{fill:none;stroke:{{strokeColor}};stroke-miterlimit:10;}\n </style>\n <path class=\"st0\" d=\"M26.17,27.87H8.74c-2.36,0-4.29-1.93-4.29-4.29V12.16c0-2.36,1.93-4.29,4.29-4.29h17.43\n\tc2.36,0,4.29,1.93,4.29,4.29v11.43C30.46,25.94,28.53,27.87,26.17,27.87z\"/>\n <path class=\"st0\" d=\"M26.46,27.87h-18c-2.2,0-4-1.8-4-4v0c0-2.2,1.8-4,4-4h18c2.2,0,4,1.8,4,4v0\n C30.46,26.07,28.66,27.87,26.46,27.87z\"/>\n <circle class=\"st1\" cx=\"10.29\" cy=\"24.06\" r=\"1.5\"/>\n <circle class=\"st1\" cx=\"17.64\" cy=\"24.06\" r=\"1.5\"/>\n <circle class=\"st1\" cx=\"24.99\" cy=\"24.06\" r=\"1.5\"/>\n <line class=\"st2\" x1=\"8.61\" y1=\"7.87\" x2=\"8.61\" y2=\"19.87\"/>\n <line class=\"st2\" x1=\"14.57\" y1=\"7.87\" x2=\"14.57\" y2=\"19.87\"/>\n <line class=\"st2\" x1=\"20.53\" y1=\"7.87\" x2=\"20.53\" y2=\"19.87\"/>\n <line class=\"st2\" x1=\"26.49\" y1=\"7.87\" x2=\"26.49\" y2=\"19.87\"/>\n</svg>\n`\n\nexport const mcsPath = {\n name: 'mcsPath',\n description: 'a group of various mcs-paths',\n icon,\n templates: []\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const icon = `
|
|
2
|
+
<svg version="1.1" id="Layer_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
3
|
+
viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
|
|
4
|
+
<style type="text/css">
|
|
5
|
+
.st0{fill:{{strokeColor}};}
|
|
6
|
+
</style>
|
|
7
|
+
<path class="st0" d="M5.51,21.16c0.64,0.41,1.61,0.77,2.62,0.77c1.27,0,1.98-0.67,1.98-1.66c0-0.92-0.55-1.46-1.93-2.02
|
|
8
|
+
c-1.79-0.72-2.93-1.78-2.93-3.53c0-1.98,1.48-3.49,3.83-3.49c1.17,0,2.04,0.29,2.61,0.61l-0.48,1.78c-0.39-0.23-1.14-0.58-2.16-0.58
|
|
9
|
+
c-1.25,0-1.8,0.76-1.8,1.46c0,0.94,0.63,1.37,2.07,2c1.88,0.79,2.8,1.85,2.8,3.6c0,1.94-1.32,3.64-4.12,3.64
|
|
10
|
+
c-1.14,0-2.33-0.36-2.93-0.76L5.51,21.16z"/>
|
|
11
|
+
<path class="st0" d="M21.67,23.22c-0.47,0.27-1.5,0.54-2.8,0.54c-3.44,0-5.53-2.41-5.53-6.1c0-4,2.48-6.41,5.79-6.41
|
|
12
|
+
c1.3,0,2.24,0.31,2.64,0.54l-0.43,1.76c-0.51-0.25-1.22-0.47-2.12-0.47c-2.2,0-3.8,1.55-3.8,4.47c0,2.66,1.4,4.38,3.78,4.38
|
|
13
|
+
c0.8,0,1.64-0.18,2.16-0.45L21.67,23.22z"/>
|
|
14
|
+
<path class="st0" d="M23.32,21.16c0.64,0.41,1.61,0.77,2.62,0.77c1.27,0,1.98-0.67,1.98-1.66c0-0.92-0.55-1.46-1.93-2.02
|
|
15
|
+
c-1.79-0.72-2.93-1.78-2.93-3.53c0-1.98,1.48-3.49,3.83-3.49c1.17,0,2.04,0.29,2.61,0.61l-0.48,1.78c-0.39-0.23-1.14-0.58-2.16-0.58
|
|
16
|
+
c-1.25,0-1.8,0.76-1.8,1.46c0,0.94,0.63,1.37,2.07,2c1.88,0.79,2.8,1.85,2.8,3.6c0,1.94-1.32,3.64-4.12,3.64
|
|
17
|
+
c-1.14,0-2.33-0.36-2.93-0.76L23.32,21.16z"/>
|
|
18
|
+
</svg>
|
|
19
|
+
`;
|
|
20
|
+
export const SCS = {
|
|
21
|
+
name: 'SCS',
|
|
22
|
+
description: 'The object groups composing the SCS system',
|
|
23
|
+
icon,
|
|
24
|
+
templates: []
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=mcs-scs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcs-scs.js","sourceRoot":"","sources":["../../src/groups/mcs-scs.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;CAkBZ,CAAA;AAED,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,4CAA4C;IACzD,IAAI;IACJ,SAAS,EAAE,EAAE;CACd,CAAA","sourcesContent":["const icon = `\n<svg version=\"1.1\" id=\"Layer_2\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 35 35\" style=\"enable-background:new 0 0 35 35;\" xml:space=\"preserve\">\n<style type=\"text/css\">\n\t.st0{fill:{{strokeColor}};}\n</style>\n<path class=\"st0\" d=\"M5.51,21.16c0.64,0.41,1.61,0.77,2.62,0.77c1.27,0,1.98-0.67,1.98-1.66c0-0.92-0.55-1.46-1.93-2.02\n\tc-1.79-0.72-2.93-1.78-2.93-3.53c0-1.98,1.48-3.49,3.83-3.49c1.17,0,2.04,0.29,2.61,0.61l-0.48,1.78c-0.39-0.23-1.14-0.58-2.16-0.58\n\tc-1.25,0-1.8,0.76-1.8,1.46c0,0.94,0.63,1.37,2.07,2c1.88,0.79,2.8,1.85,2.8,3.6c0,1.94-1.32,3.64-4.12,3.64\n\tc-1.14,0-2.33-0.36-2.93-0.76L5.51,21.16z\"/>\n<path class=\"st0\" d=\"M21.67,23.22c-0.47,0.27-1.5,0.54-2.8,0.54c-3.44,0-5.53-2.41-5.53-6.1c0-4,2.48-6.41,5.79-6.41\n\tc1.3,0,2.24,0.31,2.64,0.54l-0.43,1.76c-0.51-0.25-1.22-0.47-2.12-0.47c-2.2,0-3.8,1.55-3.8,4.47c0,2.66,1.4,4.38,3.78,4.38\n\tc0.8,0,1.64-0.18,2.16-0.45L21.67,23.22z\"/>\n<path class=\"st0\" d=\"M23.32,21.16c0.64,0.41,1.61,0.77,2.62,0.77c1.27,0,1.98-0.67,1.98-1.66c0-0.92-0.55-1.46-1.93-2.02\n\tc-1.79-0.72-2.93-1.78-2.93-3.53c0-1.98,1.48-3.49,3.83-3.49c1.17,0,2.04,0.29,2.61,0.61l-0.48,1.78c-0.39-0.23-1.14-0.58-2.16-0.58\n\tc-1.25,0-1.8,0.76-1.8,1.46c0,0.94,0.63,1.37,2.07,2c1.88,0.79,2.8,1.85,2.8,3.6c0,1.94-1.32,3.64-4.12,3.64\n\tc-1.14,0-2.33-0.36-2.93-0.76L23.32,21.16z\"/>\n</svg>\n`\n\nexport const SCS = {\n name: 'SCS',\n description: 'The object groups composing the SCS system',\n icon,\n templates: []\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const icon = `
|
|
2
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
3
|
+
viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
|
|
4
|
+
<style type="text/css">
|
|
5
|
+
.st0{fill:{{strokeColor}}}
|
|
6
|
+
</style>
|
|
7
|
+
<path class="st0" d="M6.8,4.67L6.25,5.2L4.85,6.59L4.33,7.15l0.4,0.65l2.07,3.47l0.28,0.5h2.91l3.96,3.93
|
|
8
|
+
c-3.54,3.56-8.05,8.08-8.2,8.24C4.2,25.48,4.2,28.02,5.78,29.5c1.55,1.53,4.07,1.57,5.54,0c0.01-0.01,0.02-0.02,0.03-0.03l6.1-6.13
|
|
9
|
+
l6.13,6.16l0.09,0.06c1.56,1.47,4.03,1.49,5.48-0.06v-0.03h0.03c1.52-1.55,1.53-4.08-0.03-5.54l-0.03-0.03l-5.17-5.14
|
|
10
|
+
c3.48-0.33,6.2-3.26,6.25-6.81h0.03c0-0.02,0-0.04,0-0.06c0-0.01,0-0.02,0-0.03c0.1-1.15-0.15-2.24-0.74-3.19l-0.68-1.05l-4.61,4.61
|
|
11
|
+
l-1.39-1.46l4.71-4.71l-1.36-0.56c-0.8-0.34-1.72-0.59-2.76-0.59c-3.81,0-6.93,3.13-6.93,6.93c0,0.41,0.09,0.77,0.15,1.15
|
|
12
|
+
c-0.43,0.43-0.76,0.79-1.27,1.3l-3.93-3.93V7.43l-0.5-0.28L7.45,5.07L6.8,4.67z M23.4,6.9c0.14,0,0.24,0.08,0.37,0.09l-3.75,3.75
|
|
13
|
+
l0.68,0.71l2.79,2.88l0.68,0.71l3.93-3.93c0.02,0.23,0.18,0.39,0.15,0.65v0.09c0,2.73-2.23,4.95-4.95,4.95
|
|
14
|
+
c-0.36,0-0.8-0.09-1.3-0.19l-0.53-0.09l-0.37,0.37L9.93,28.11H9.9v0.03c-0.7,0.77-1.93,0.79-2.76-0.03v-0.03H7.11
|
|
15
|
+
c-0.77-0.7-0.79-1.93,0.03-2.76c0.38-0.38,7.65-7.71,11.21-11.27l0.4-0.4l-0.15-0.56c-0.08-0.32-0.15-0.87-0.15-1.24
|
|
16
|
+
C18.44,9.13,20.67,6.9,23.4,6.9z M7.11,7.15l2.32,1.42v0.99L9.22,9.78H8.23L6.8,7.46L7.11,7.15z M21.6,19.19l6.16,6.13v0.03h0.03
|
|
17
|
+
c0.77,0.7,0.79,1.93-0.03,2.76h-0.03v0.03c-0.7,0.77-1.93,0.79-2.76-0.03l-6.13-6.16L21.6,19.19z"/>
|
|
18
|
+
</svg>
|
|
19
|
+
`;
|
|
20
|
+
export const mcsShape = {
|
|
21
|
+
name: 'mcsShape',
|
|
22
|
+
description: 'a group of various mcs-shapes',
|
|
23
|
+
icon,
|
|
24
|
+
templates: []
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=mcs-shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcs-shape.js","sourceRoot":"","sources":["../../src/groups/mcs-shape.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;CAkBZ,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,+BAA+B;IAC5C,IAAI;IACJ,SAAS,EAAE,EAAE;CACd,CAAA","sourcesContent":["const icon = `\n<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 35 35\" style=\"enable-background:new 0 0 35 35;\" xml:space=\"preserve\">\n <style type=\"text/css\">\n .st0{fill:{{strokeColor}}}\n </style>\n <path class=\"st0\" d=\"M6.8,4.67L6.25,5.2L4.85,6.59L4.33,7.15l0.4,0.65l2.07,3.47l0.28,0.5h2.91l3.96,3.93\n\tc-3.54,3.56-8.05,8.08-8.2,8.24C4.2,25.48,4.2,28.02,5.78,29.5c1.55,1.53,4.07,1.57,5.54,0c0.01-0.01,0.02-0.02,0.03-0.03l6.1-6.13\n\tl6.13,6.16l0.09,0.06c1.56,1.47,4.03,1.49,5.48-0.06v-0.03h0.03c1.52-1.55,1.53-4.08-0.03-5.54l-0.03-0.03l-5.17-5.14\n\tc3.48-0.33,6.2-3.26,6.25-6.81h0.03c0-0.02,0-0.04,0-0.06c0-0.01,0-0.02,0-0.03c0.1-1.15-0.15-2.24-0.74-3.19l-0.68-1.05l-4.61,4.61\n\tl-1.39-1.46l4.71-4.71l-1.36-0.56c-0.8-0.34-1.72-0.59-2.76-0.59c-3.81,0-6.93,3.13-6.93,6.93c0,0.41,0.09,0.77,0.15,1.15\n\tc-0.43,0.43-0.76,0.79-1.27,1.3l-3.93-3.93V7.43l-0.5-0.28L7.45,5.07L6.8,4.67z M23.4,6.9c0.14,0,0.24,0.08,0.37,0.09l-3.75,3.75\n\tl0.68,0.71l2.79,2.88l0.68,0.71l3.93-3.93c0.02,0.23,0.18,0.39,0.15,0.65v0.09c0,2.73-2.23,4.95-4.95,4.95\n\tc-0.36,0-0.8-0.09-1.3-0.19l-0.53-0.09l-0.37,0.37L9.93,28.11H9.9v0.03c-0.7,0.77-1.93,0.79-2.76-0.03v-0.03H7.11\n\tc-0.77-0.7-0.79-1.93,0.03-2.76c0.38-0.38,7.65-7.71,11.21-11.27l0.4-0.4l-0.15-0.56c-0.08-0.32-0.15-0.87-0.15-1.24\n\tC18.44,9.13,20.67,6.9,23.4,6.9z M7.11,7.15l2.32,1.42v0.99L9.22,9.78H8.23L6.8,7.46L7.11,7.15z M21.6,19.19l6.16,6.13v0.03h0.03\n\tc0.77,0.7,0.79,1.93-0.03,2.76h-0.03v0.03c-0.7,0.77-1.93,0.79-2.76-0.03l-6.13-6.16L21.6,19.19z\"/>\n</svg>\n`\n\nexport const mcsShape = {\n name: 'mcsShape',\n description: 'a group of various mcs-shapes',\n icon,\n templates: []\n}\n"]}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { default as MachineGroups } from './groups';
|
|
2
|
+
export { default as DataSubscription } from './data-subscription';
|
|
3
|
+
export { default as MCSMachine } from './mcs-machine';
|
|
4
|
+
export { default as MCSUnit } from './mcs-unit';
|
|
5
|
+
export { default as MCSCarrierHolder } from './mcs-carrier-holder';
|
|
6
|
+
export { default as MCSVehicle } from './mcs-vehicle';
|
|
7
|
+
export { default as MCSTransport } from './mcs-transport';
|
|
8
|
+
// export { default as MCSGauge } from './mcs-gauge-capacity-circle'
|
|
9
|
+
export { default as StockerCapacityBar } from './stocker-capacity-bar';
|
|
10
|
+
export { default as ZoneCapacityBar } from './zone-capacity-bar';
|
|
11
|
+
export { default as AGVLine } from './agv-line';
|
|
12
|
+
export { default as Buffer } from './buffer';
|
|
13
|
+
export { default as Conveyor } from './conveyor';
|
|
14
|
+
export { default as ConveyorJoin } from './conveyor-join';
|
|
15
|
+
export { default as Equipment } from './equipment';
|
|
16
|
+
export { default as OHTLine } from './oht-line';
|
|
17
|
+
export { default as Stocker } from './stocker';
|
|
18
|
+
export { default as AGV } from './agv';
|
|
19
|
+
export { default as OHT } from './oht';
|
|
20
|
+
// export { default as RTV } from './rtv'
|
|
21
|
+
export { default as Shuttle } from './shuttle';
|
|
22
|
+
export { default as Port } from './port';
|
|
23
|
+
export { default as Crane } from './crane';
|
|
24
|
+
export { default as Shelf } from './shelf';
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,UAAU,CAAA;AAEnD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEjE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzD,oEAAoE;AACpE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AACtE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAEhE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAA;AACtC,yCAAyC;AACzC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA","sourcesContent":["export { default as MachineGroups } from './groups'\n\nexport { default as DataSubscription } from './data-subscription'\n\nexport { default as MCSMachine } from './mcs-machine'\nexport { default as MCSUnit } from './mcs-unit'\nexport { default as MCSCarrierHolder } from './mcs-carrier-holder'\nexport { default as MCSVehicle } from './mcs-vehicle'\nexport { default as MCSTransport } from './mcs-transport'\n// export { default as MCSGauge } from './mcs-gauge-capacity-circle'\nexport { default as StockerCapacityBar } from './stocker-capacity-bar'\nexport { default as ZoneCapacityBar } from './zone-capacity-bar'\n\nexport { default as AGVLine } from './agv-line'\nexport { default as Buffer } from './buffer'\nexport { default as Conveyor } from './conveyor'\nexport { default as ConveyorJoin } from './conveyor-join'\nexport { default as Equipment } from './equipment'\nexport { default as OHTLine } from './oht-line'\nexport { default as Stocker } from './stocker'\n\nexport { default as AGV } from './agv'\nexport { default as OHT } from './oht'\n// export { default as RTV } from './rtv'\nexport { default as Shuttle } from './shuttle'\n\nexport { default as Port } from './port'\nexport { default as Crane } from './crane'\nexport { default as Shelf } from './shelf'\n"]}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { LEGEND_CARRIER } from './features/mcs-status-default';
|
|
2
|
+
import { MCSStatusMixin } from './features/mcs-status-mixin';
|
|
3
|
+
import MCSUnit from './mcs-unit';
|
|
4
|
+
import { themesColorMap } from './features/client-api';
|
|
5
|
+
export class Carrier extends MCSStatusMixin(Object) {
|
|
6
|
+
constructor(host) {
|
|
7
|
+
super();
|
|
8
|
+
this.type = [];
|
|
9
|
+
this.host = host;
|
|
10
|
+
}
|
|
11
|
+
set data(data) {
|
|
12
|
+
const { CARRIERID, CARRIERTYPE = '', EMPTYTYPE } = data || {};
|
|
13
|
+
this.id = CARRIERID;
|
|
14
|
+
this.type = CARRIERTYPE.split(';');
|
|
15
|
+
this.emptyType = EMPTYTYPE;
|
|
16
|
+
}
|
|
17
|
+
get status() {
|
|
18
|
+
return this.emptyType;
|
|
19
|
+
}
|
|
20
|
+
get legend() {
|
|
21
|
+
var _a;
|
|
22
|
+
const { carrierLegendName } = this.host.state;
|
|
23
|
+
if (carrierLegendName) {
|
|
24
|
+
return (_a = this.host.root) === null || _a === void 0 ? void 0 : _a.style[carrierLegendName];
|
|
25
|
+
}
|
|
26
|
+
return LEGEND_CARRIER;
|
|
27
|
+
}
|
|
28
|
+
calculateShrunkRectangle(originalRect) {
|
|
29
|
+
const shrunkRect = Object.assign({}, originalRect);
|
|
30
|
+
shrunkRect.left += originalRect.width * 0.15;
|
|
31
|
+
shrunkRect.width *= 0.7;
|
|
32
|
+
shrunkRect.top += originalRect.height * 0.15;
|
|
33
|
+
shrunkRect.height *= 0.7;
|
|
34
|
+
return shrunkRect;
|
|
35
|
+
}
|
|
36
|
+
render(ctx) {
|
|
37
|
+
if (!this.id || !this.type) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const { left, top, width, height } = this.calculateShrunkRectangle(this.host.bounds);
|
|
41
|
+
const radius = Math.round(Math.min(width, height) * 0.2);
|
|
42
|
+
// 시작점 설정
|
|
43
|
+
ctx.beginPath();
|
|
44
|
+
ctx.moveTo(left + radius, top);
|
|
45
|
+
// 상단 가로선 그리기
|
|
46
|
+
ctx.lineTo(left + width - radius, top);
|
|
47
|
+
ctx.arcTo(left + width, top, left + width, top + radius, radius);
|
|
48
|
+
// 우측 세로선 그리기
|
|
49
|
+
ctx.lineTo(left + width, top + height - radius);
|
|
50
|
+
ctx.arcTo(left + width, top + height, left + width - radius, top + height, radius);
|
|
51
|
+
// 하단 가로선 그리기
|
|
52
|
+
ctx.lineTo(left + radius, top + height);
|
|
53
|
+
ctx.arcTo(left, top + height, left, top + height - radius, radius);
|
|
54
|
+
// 좌측 세로선 그리기
|
|
55
|
+
ctx.lineTo(left, top + radius);
|
|
56
|
+
ctx.arcTo(left, top, left + radius, top, radius);
|
|
57
|
+
// 경로 닫기 및 그리기
|
|
58
|
+
ctx.closePath();
|
|
59
|
+
ctx.stroke();
|
|
60
|
+
ctx.lineWidth = radius > 10 ? 2 : 1;
|
|
61
|
+
ctx.fillStyle = this.statusColor || 'transparent';
|
|
62
|
+
ctx.strokeStyle = this.auxColor || 'transparent';
|
|
63
|
+
ctx.fill();
|
|
64
|
+
ctx.stroke();
|
|
65
|
+
ctx.beginPath();
|
|
66
|
+
// 숫자 그리기
|
|
67
|
+
const count = 2; // this.type?.length
|
|
68
|
+
if (count > 1) {
|
|
69
|
+
const { x: cx, y: cy } = this.host.center;
|
|
70
|
+
ctx.fillStyle = 'red';
|
|
71
|
+
ctx.font = `bold ${Math.round(radius * 4)}px Arial`;
|
|
72
|
+
ctx.textAlign = 'center';
|
|
73
|
+
ctx.textBaseline = 'middle';
|
|
74
|
+
ctx.fillText(String(count), cx, cy);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export default class MCSCarrierHolder extends MCSUnit {
|
|
79
|
+
constructor() {
|
|
80
|
+
super(...arguments);
|
|
81
|
+
this.carrier = new Carrier(this);
|
|
82
|
+
}
|
|
83
|
+
static get properties() {
|
|
84
|
+
return [
|
|
85
|
+
...MCSUnit.properties,
|
|
86
|
+
{
|
|
87
|
+
type: 'select',
|
|
88
|
+
label: 'carrier-legend-name',
|
|
89
|
+
name: 'carrierLegendName',
|
|
90
|
+
property: {
|
|
91
|
+
options: themesColorMap
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
}
|
|
96
|
+
ready() {
|
|
97
|
+
this.carrier.data = this.data;
|
|
98
|
+
}
|
|
99
|
+
postrender(ctx) {
|
|
100
|
+
this.carrier.render(ctx);
|
|
101
|
+
}
|
|
102
|
+
onchangeData(after, before) {
|
|
103
|
+
this.carrier.data = this.data;
|
|
104
|
+
super.onchangeData(after, before);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=mcs-carrier-holder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcs-carrier-holder.js","sourceRoot":"","sources":["../src/mcs-carrier-holder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAU,MAAM,+BAA+B,CAAA;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,OAAO,MAAM,YAAY,CAAA;AAChC,OAAO,EAA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nB,OAAO;YACL,GAAG,OAAO,CAAC,UAAU;YACrB;gBACE,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,qBAAqB;gBAC5B,IAAI,EAAE,mBAAmB;gBACzB,QAAQ,EAAE;oBACR,OAAO,EAAE,cAAc;iBACxB;aACF;SACF,CAAA;IACH,CAAC;IAID,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;IAC/B,CAAC;IAED,UAAU,CAAC,GAA6B;QACtC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC1B,CAAC;IAED,YAAY,CAAC,KAAU,EAAE,MAAW;QAClC,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QAE7B,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACnC,CAAC;CACF","sourcesContent":["import { BOUNDS, Component } from '@hatiolab/things-scene'\nimport { LEGEND_CARRIER, Legend } from './features/mcs-status-default'\nimport { MCSStatusMixin } from './features/mcs-status-mixin'\nimport MCSUnit from './mcs-unit'\nimport { themesColorMap } from './features/client-api'\n\nexport class Carrier extends MCSStatusMixin(Object) {\n host: Component\n\n id?: string\n type: ('ALL' | 'BOBIN' | 'MAGAZINE' | 'PALLET' | 'REEL_TRAY' | 'PLATE')[] = []\n emptyType?: 'Full' | 'Empty' | 'EmptyEmpty'\n\n constructor(host: Component) {\n super()\n this.host = host\n }\n\n set data(data: any) {\n const { CARRIERID, CARRIERTYPE = '', EMPTYTYPE } = data || {}\n\n this.id = CARRIERID\n this.type = CARRIERTYPE.split(';')\n this.emptyType = EMPTYTYPE\n }\n\n get status() {\n return this.emptyType\n }\n\n get legend(): Legend {\n const { carrierLegendName } = this.host.state\n\n if (carrierLegendName) {\n return (this.host.root as any)?.style[carrierLegendName]\n }\n\n return LEGEND_CARRIER\n }\n\n calculateShrunkRectangle(originalRect: BOUNDS): BOUNDS {\n const shrunkRect: BOUNDS = { ...originalRect }\n\n shrunkRect.left += originalRect.width * 0.15\n shrunkRect.width *= 0.7\n\n shrunkRect.top += originalRect.height * 0.15\n shrunkRect.height *= 0.7\n\n return shrunkRect\n }\n\n render(ctx: CanvasRenderingContext2D) {\n if (!this.id || !this.type) {\n return\n }\n\n const { left, top, width, height } = this.calculateShrunkRectangle(this.host.bounds)\n\n const radius = Math.round(Math.min(width, height) * 0.2)\n\n // 시작점 설정\n ctx.beginPath()\n ctx.moveTo(left + radius, top)\n\n // 상단 가로선 그리기\n ctx.lineTo(left + width - radius, top)\n ctx.arcTo(left + width, top, left + width, top + radius, radius)\n\n // 우측 세로선 그리기\n ctx.lineTo(left + width, top + height - radius)\n ctx.arcTo(left + width, top + height, left + width - radius, top + height, radius)\n\n // 하단 가로선 그리기\n ctx.lineTo(left + radius, top + height)\n ctx.arcTo(left, top + height, left, top + height - radius, radius)\n\n // 좌측 세로선 그리기\n ctx.lineTo(left, top + radius)\n ctx.arcTo(left, top, left + radius, top, radius)\n\n // 경로 닫기 및 그리기\n ctx.closePath()\n ctx.stroke()\n\n ctx.lineWidth = radius > 10 ? 2 : 1\n ctx.fillStyle = this.statusColor || 'transparent'\n ctx.strokeStyle = this.auxColor || 'transparent'\n\n ctx.fill()\n ctx.stroke()\n\n ctx.beginPath()\n\n // 숫자 그리기\n const count = 2 // this.type?.length\n\n if (count > 1) {\n const { x: cx, y: cy } = this.host.center\n\n ctx.fillStyle = 'red'\n ctx.font = `bold ${Math.round(radius * 4)}px Arial`\n ctx.textAlign = 'center'\n ctx.textBaseline = 'middle'\n\n ctx.fillText(String(count), cx, cy)\n }\n }\n}\n\nexport default class MCSCarrierHolder extends MCSUnit {\n static get properties(): any {\n return [\n ...MCSUnit.properties,\n {\n type: 'select',\n label: 'carrier-legend-name',\n name: 'carrierLegendName',\n property: {\n options: themesColorMap\n }\n }\n ]\n }\n\n carrier: Carrier = new Carrier(this)\n\n ready() {\n this.carrier.data = this.data\n }\n\n postrender(ctx: CanvasRenderingContext2D) {\n this.carrier.render(ctx)\n }\n\n onchangeData(after: any, before: any) {\n this.carrier.data = this.data\n\n super.onchangeData(after, before)\n }\n}\n"]}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { Component, RectPath, Shape } from '@hatiolab/things-scene';
|
|
2
|
+
import { MCSStatusMixin } from './features/mcs-status-mixin';
|
|
3
|
+
import { LEGEND_CAPACITY } from './features/mcs-status-default';
|
|
4
|
+
import { safeRound } from './utils/safe-round';
|
|
5
|
+
import { getVaueOnRanges } from './utils/get-value-on-ranges';
|
|
6
|
+
const NATURE = {
|
|
7
|
+
mutable: false,
|
|
8
|
+
resizable: true,
|
|
9
|
+
rotatable: true,
|
|
10
|
+
properties: [
|
|
11
|
+
{
|
|
12
|
+
type: 'number',
|
|
13
|
+
name: 'currentUsage',
|
|
14
|
+
label: 'current-usage'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: 'number',
|
|
18
|
+
name: 'highWatermark',
|
|
19
|
+
label: 'high-watermark'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: 'number',
|
|
23
|
+
name: 'maxCapacity',
|
|
24
|
+
label: 'max-capacity'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'number',
|
|
28
|
+
label: 'round',
|
|
29
|
+
name: 'round',
|
|
30
|
+
property: {
|
|
31
|
+
min: 0
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'hidden',
|
|
36
|
+
name: 'usage',
|
|
37
|
+
label: 'usage'
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
'value-property': 'usage'
|
|
41
|
+
};
|
|
42
|
+
var controlHandler = {
|
|
43
|
+
ondragmove: function (point, index, component) {
|
|
44
|
+
var { left, top, width, height } = component.model;
|
|
45
|
+
var transcoorded = component.transcoordP2S(point.x, point.y);
|
|
46
|
+
var round = ((transcoorded.x - left) / (width / 2)) * 100;
|
|
47
|
+
round = safeRound(round, width, height);
|
|
48
|
+
component.set({
|
|
49
|
+
round
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
export default class MCSGaugeCapacityBar extends MCSStatusMixin(RectPath(Shape)) {
|
|
54
|
+
static get nature() {
|
|
55
|
+
return NATURE;
|
|
56
|
+
}
|
|
57
|
+
get controls() {
|
|
58
|
+
var { left, top, width, round, height } = this.state;
|
|
59
|
+
round = round == undefined ? 0 : safeRound(round, width, height);
|
|
60
|
+
return [
|
|
61
|
+
{
|
|
62
|
+
x: left + (width / 2) * (round / 100),
|
|
63
|
+
y: top,
|
|
64
|
+
handler: controlHandler
|
|
65
|
+
}
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
getTheme() {
|
|
69
|
+
var _a, _b;
|
|
70
|
+
const { legendName } = this.state;
|
|
71
|
+
if (legendName) {
|
|
72
|
+
return (_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b[legendName];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
get legend() {
|
|
76
|
+
return this.getTheme() || this.getLegendFallback();
|
|
77
|
+
}
|
|
78
|
+
getLegendFallback() {
|
|
79
|
+
return LEGEND_CAPACITY;
|
|
80
|
+
}
|
|
81
|
+
get statusColor() {
|
|
82
|
+
return getVaueOnRanges(this.usage, this.legend);
|
|
83
|
+
}
|
|
84
|
+
get text() {
|
|
85
|
+
return this.usage + '%';
|
|
86
|
+
}
|
|
87
|
+
render(context) {
|
|
88
|
+
const { left, top, width, height } = this.bounds;
|
|
89
|
+
if (width >= height) {
|
|
90
|
+
this.renderLandscape(context);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
this.renderPortrait(context);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
renderLandscape(context) {
|
|
97
|
+
const { left, top, width, height } = this.bounds;
|
|
98
|
+
const { lineWidth, strokeStyle, round, fillStyle = '#aaa' } = this.state;
|
|
99
|
+
context.strokeStyle = strokeStyle;
|
|
100
|
+
context.lineWidth = lineWidth;
|
|
101
|
+
context.save();
|
|
102
|
+
context.translate(left, top);
|
|
103
|
+
// gauge background
|
|
104
|
+
context.beginPath();
|
|
105
|
+
context.fillStyle = fillStyle;
|
|
106
|
+
context.roundRect(0, 0, width, height, round);
|
|
107
|
+
context.fill();
|
|
108
|
+
context.stroke();
|
|
109
|
+
context.clip();
|
|
110
|
+
// gauge foreground
|
|
111
|
+
context.beginPath();
|
|
112
|
+
context.fillStyle = this.statusColor;
|
|
113
|
+
context.rect(0, 0, (width / 100) * this.usage, height);
|
|
114
|
+
context.fill();
|
|
115
|
+
context.beginPath();
|
|
116
|
+
context.strokeStyle = strokeStyle;
|
|
117
|
+
context.roundRect(0, 0, width, height, round);
|
|
118
|
+
context.stroke();
|
|
119
|
+
context.beginPath();
|
|
120
|
+
context.translate(-left, -top);
|
|
121
|
+
context.restore();
|
|
122
|
+
}
|
|
123
|
+
renderPortrait(context) {
|
|
124
|
+
const { left, top, width, height } = this.bounds;
|
|
125
|
+
const { lineWidth, strokeStyle, round, fillStyle } = this.state;
|
|
126
|
+
context.strokeStyle = strokeStyle;
|
|
127
|
+
context.lineWidth = lineWidth;
|
|
128
|
+
context.save();
|
|
129
|
+
context.translate(left, top);
|
|
130
|
+
// gauge background
|
|
131
|
+
context.beginPath();
|
|
132
|
+
context.fillStyle = fillStyle;
|
|
133
|
+
context.roundRect(0, 0, width, height, round);
|
|
134
|
+
context.fill();
|
|
135
|
+
context.stroke();
|
|
136
|
+
context.clip();
|
|
137
|
+
// gauge foreground
|
|
138
|
+
context.beginPath();
|
|
139
|
+
context.fillStyle = this.statusColor;
|
|
140
|
+
context.rect(0, height - (height / 100) * this.usage, width, (height / 100) * this.usage);
|
|
141
|
+
context.fill();
|
|
142
|
+
context.beginPath();
|
|
143
|
+
context.roundRect(0, 0, width, height, round);
|
|
144
|
+
context.stroke();
|
|
145
|
+
context.beginPath();
|
|
146
|
+
context.translate(-left, -top);
|
|
147
|
+
context.restore();
|
|
148
|
+
}
|
|
149
|
+
get usage() {
|
|
150
|
+
const { currentUsage = 0, maxCapacity = 100 } = this.state;
|
|
151
|
+
return Math.round((currentUsage / maxCapacity) * 100);
|
|
152
|
+
}
|
|
153
|
+
set usage(usage) {
|
|
154
|
+
// intentionally have done nothing
|
|
155
|
+
}
|
|
156
|
+
onchangeData(after, before) {
|
|
157
|
+
const { CURRENTCAPACITY = 0, MAXCAPACITY = 100, HIGHWATERMARK = 100 } = typeof this.data == 'object' ? this.data : {};
|
|
158
|
+
const currentUsage = Number(CURRENTCAPACITY) || 0;
|
|
159
|
+
const maxCapacity = Number(MAXCAPACITY) || 100;
|
|
160
|
+
const highWatermark = Number(HIGHWATERMARK) || 100;
|
|
161
|
+
this.setState({
|
|
162
|
+
currentUsage,
|
|
163
|
+
maxCapacity,
|
|
164
|
+
highWatermark,
|
|
165
|
+
usage: Math.round((currentUsage / maxCapacity) * 100)
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
Component.register('MCSGaugeCapacityBar', MCSGaugeCapacityBar);
|
|
170
|
+
//# sourceMappingURL=mcs-gauge-capacity-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcs-gauge-capacity-bar.js","sourceRoot":"","sources":["../src/mcs-gauge-capacity-bar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyC,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC1G,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAU,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAE7D,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;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AC,qBAAqB,EAAE,mBAAmB,CAAC,CAAA","sourcesContent":["import { Component, ComponentNature, POSITION, Properties, RectPath, Shape } from '@hatiolab/things-scene'\nimport { MCSStatusMixin } from './features/mcs-status-mixin'\nimport { LEGEND_CAPACITY, Legend } from './features/mcs-status-default'\nimport { safeRound } from './utils/safe-round'\nimport { getVaueOnRanges } from './utils/get-value-on-ranges'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'number',\n name: 'currentUsage',\n label: 'current-usage'\n },\n {\n type: 'number',\n name: 'highWatermark',\n label: 'high-watermark'\n },\n {\n type: 'number',\n name: 'maxCapacity',\n label: 'max-capacity'\n },\n {\n type: 'number',\n label: 'round',\n name: 'round',\n property: {\n min: 0\n }\n },\n {\n type: 'hidden',\n name: 'usage',\n label: 'usage'\n }\n ],\n 'value-property': 'usage'\n}\n\nvar controlHandler = {\n ondragmove: function (point: POSITION, index: number, component: Component) {\n var { left, top, width, height } = component.model\n\n var transcoorded = component.transcoordP2S(point.x, point.y)\n var round = ((transcoorded.x - left) / (width / 2)) * 100\n\n round = safeRound(round, width, height)\n\n component.set({\n round\n })\n }\n}\n\nexport default class MCSGaugeCapacityBar extends MCSStatusMixin(RectPath(Shape)) {\n static get nature() {\n return NATURE\n }\n\n get controls() {\n var { left, top, width, round, height } = this.state\n round = round == undefined ? 0 : safeRound(round, width, height)\n\n return [\n {\n x: left + (width / 2) * (round / 100),\n y: top,\n handler: controlHandler\n }\n ]\n }\n\n getTheme() {\n const { legendName } = this.state\n\n if (legendName) {\n return (this.root as any)?.style?.[legendName]\n }\n }\n\n get legend(): Legend {\n return this.getTheme() || this.getLegendFallback()\n }\n\n getLegendFallback() {\n return LEGEND_CAPACITY\n }\n\n get statusColor() {\n return getVaueOnRanges(this.usage, this.legend)\n }\n\n get text() {\n return this.usage + '%'\n }\n\n render(context: CanvasRenderingContext2D) {\n const { left, top, width, height } = this.bounds\n\n if (width >= height) {\n this.renderLandscape(context)\n } else {\n this.renderPortrait(context)\n }\n }\n\n renderLandscape(context: CanvasRenderingContext2D) {\n const { left, top, width, height } = this.bounds\n const { lineWidth, strokeStyle, round, fillStyle = '#aaa' } = this.state\n\n context.strokeStyle = strokeStyle\n context.lineWidth = lineWidth\n\n context.save()\n context.translate(left, top)\n\n // gauge background\n context.beginPath()\n\n context.fillStyle = fillStyle\n context.roundRect(0, 0, width, height, round)\n\n context.fill()\n context.stroke()\n\n context.clip()\n\n // gauge foreground\n context.beginPath()\n\n context.fillStyle = this.statusColor!\n\n context.rect(0, 0, (width / 100) * this.usage, height)\n context.fill()\n\n context.beginPath()\n context.strokeStyle = strokeStyle\n context.roundRect(0, 0, width, height, round)\n context.stroke()\n\n context.beginPath()\n\n context.translate(-left, -top)\n context.restore()\n }\n\n renderPortrait(context: CanvasRenderingContext2D) {\n const { left, top, width, height } = this.bounds\n const { lineWidth, strokeStyle, round, fillStyle } = this.state\n\n context.strokeStyle = strokeStyle\n context.lineWidth = lineWidth\n\n context.save()\n context.translate(left, top)\n\n // gauge background\n context.beginPath()\n\n context.fillStyle = fillStyle\n context.roundRect(0, 0, width, height, round)\n\n context.fill()\n context.stroke()\n\n context.clip()\n\n // gauge foreground\n context.beginPath()\n\n context.fillStyle = this.statusColor!\n\n context.rect(0, height - (height / 100) * this.usage, width, (height / 100) * this.usage)\n context.fill()\n\n context.beginPath()\n context.roundRect(0, 0, width, height, round)\n context.stroke()\n\n context.beginPath()\n\n context.translate(-left, -top)\n context.restore()\n }\n\n get usage() {\n const { currentUsage = 0, maxCapacity = 100 } = this.state\n return Math.round((currentUsage / maxCapacity) * 100)\n }\n\n set usage(usage: number) {\n // intentionally have done nothing\n }\n\n onchangeData(after: Properties, before: Properties): void {\n const {\n CURRENTCAPACITY = 0,\n MAXCAPACITY = 100,\n HIGHWATERMARK = 100\n } = typeof this.data == 'object' ? this.data : {}\n\n const currentUsage = Number(CURRENTCAPACITY) || 0\n const maxCapacity = Number(MAXCAPACITY) || 100\n const highWatermark = Number(HIGHWATERMARK) || 100\n\n this.setState({\n currentUsage,\n maxCapacity,\n highWatermark,\n usage: Math.round((currentUsage / maxCapacity) * 100)\n })\n }\n}\n\nComponent.register('MCSGaugeCapacityBar', MCSGaugeCapacityBar)\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Component, Ellipse } from '@hatiolab/things-scene';
|
|
2
|
+
import { getVaueOnRanges } from './utils/get-value-on-ranges';
|
|
3
|
+
import { MCSStatusMixin } from './features/mcs-status-mixin';
|
|
4
|
+
import { LEGEND_CAPACITY } from './features/mcs-status-default';
|
|
5
|
+
const NATURE = {
|
|
6
|
+
mutable: false,
|
|
7
|
+
resizable: true,
|
|
8
|
+
rotatable: true,
|
|
9
|
+
properties: [
|
|
10
|
+
{
|
|
11
|
+
type: 'number',
|
|
12
|
+
name: 'currentUsage',
|
|
13
|
+
label: 'current-usage'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
type: 'number',
|
|
17
|
+
name: 'highWatermark',
|
|
18
|
+
label: 'high-watermark'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
type: 'number',
|
|
22
|
+
name: 'maxCapacity',
|
|
23
|
+
label: 'max-capacity'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'hidden',
|
|
27
|
+
name: 'usage',
|
|
28
|
+
label: 'usage'
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
'value-property': 'usage'
|
|
32
|
+
};
|
|
33
|
+
export default class MCSGaugeCapacityCircle extends MCSStatusMixin(Ellipse) {
|
|
34
|
+
static get nature() {
|
|
35
|
+
return NATURE;
|
|
36
|
+
}
|
|
37
|
+
getTheme() {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
const { legendName } = this.state;
|
|
40
|
+
if (legendName) {
|
|
41
|
+
return (_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b[legendName];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
get legend() {
|
|
45
|
+
return this.getTheme() || this.getLegendFallback();
|
|
46
|
+
}
|
|
47
|
+
getLegendFallback() {
|
|
48
|
+
return LEGEND_CAPACITY;
|
|
49
|
+
}
|
|
50
|
+
get statusColor() {
|
|
51
|
+
return getVaueOnRanges(this.usage, this.legend);
|
|
52
|
+
}
|
|
53
|
+
render(context) {
|
|
54
|
+
var { cx, cy, rx, ry } = this.state;
|
|
55
|
+
const radius = Math.min(rx, ry);
|
|
56
|
+
context.beginPath();
|
|
57
|
+
context.arc(cx, cy, radius, 0, Math.PI * 2);
|
|
58
|
+
context.fillStyle = 'gray';
|
|
59
|
+
context.fill();
|
|
60
|
+
this.drawStroke(context);
|
|
61
|
+
const startAngle = Math.PI * -0.5;
|
|
62
|
+
const endAngle = startAngle + Math.PI * 2 * (this.value / 100);
|
|
63
|
+
context.beginPath();
|
|
64
|
+
context.moveTo(cx, cy);
|
|
65
|
+
context.arc(cx, cy, radius, startAngle, endAngle);
|
|
66
|
+
context.lineTo(cx, cy);
|
|
67
|
+
context.fillStyle = this.statusColor;
|
|
68
|
+
context.fill();
|
|
69
|
+
}
|
|
70
|
+
get usage() {
|
|
71
|
+
const { currentUsage = 0, maxCapacity = 100 } = this.state;
|
|
72
|
+
return Math.round((currentUsage / maxCapacity) * 100);
|
|
73
|
+
}
|
|
74
|
+
set usage(usage) {
|
|
75
|
+
// intentionally have done nothing
|
|
76
|
+
}
|
|
77
|
+
onchangeData(after, before) {
|
|
78
|
+
const { CURRENTCAPACITY = 0, MAXCAPACITY = 100, HIGHWATERMARK = 100 } = typeof this.data == 'object' ? this.data : {};
|
|
79
|
+
const currentUsage = Number(CURRENTCAPACITY) || 0;
|
|
80
|
+
const maxCapacity = Number(MAXCAPACITY) || 100;
|
|
81
|
+
const highWatermark = Number(HIGHWATERMARK) || 100;
|
|
82
|
+
this.setState({
|
|
83
|
+
currentUsage,
|
|
84
|
+
maxCapacity,
|
|
85
|
+
highWatermark,
|
|
86
|
+
usage: Math.round((currentUsage / maxCapacity) * 100)
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
Component.register('MCSGaugeCapacityCircle', MCSGaugeCapacityCircle);
|
|
91
|
+
//# sourceMappingURL=mcs-gauge-capacity-circle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcs-gauge-capacity-circle.js","sourceRoot":"","sources":["../src/mcs-gauge-capacity-circle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,OAAO,EAAc,MAAM,wBAAwB,CAAA;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAU,MAAM,+BAA+B,CAAA;AAEvE,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,eAAe;SACvB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,gBAAgB;SACxB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,aAAa;YACnB,KAAK,EAAE,cAAc;SACtB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO;SACf;KACF;IACD,gBAAgB,EAAE,OAAO;CAC1B,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,cAAc,CAAC,OAAO,CAAC;IACzE,MAAM,KAAK,MAAM;QACf,OAAO,MAAM,CAAA;IACf,CAAC;IAED,QAAQ;;QACN,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAEjC,IAAI,UAAU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ACjD,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;QACtB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,WAAY,CAAA;QAErC,OAAO,CAAC,IAAI,EAAE,CAAA;IAChB,CAAC;IAED,IAAI,KAAK;QACP,MAAM,EAAE,YAAY,GAAG,CAAC,EAAE,WAAW,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAC1D,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,GAAG,WAAW,CAAC,GAAG,GAAG,CAAC,CAAA;IACvD,CAAC;IAED,IAAI,KAAK,CAAC,KAAa;QACrB,kCAAkC;IACpC,CAAC;IAED,YAAY,CAAC,KAAiB,EAAE,MAAkB;QAChD,MAAM,EACJ,eAAe,GAAG,CAAC,EACnB,WAAW,GAAG,GAAG,EACjB,aAAa,GAAG,GAAG,EACpB,GAAG,OAAO,IAAI,CAAC,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;QAEjD,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;QACjD,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,GAAG,CAAA;QAC9C,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC,IAAI,GAAG,CAAA;QAElD,IAAI,CAAC,QAAQ,CAAC;YACZ,YAAY;YACZ,WAAW;YACX,aAAa;YACb,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,GAAG,WAAW,CAAC,GAAG,GAAG,CAAC;SACtD,CAAC,CAAA;IACJ,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,wBAAwB,EAAE,sBAAsB,CAAC,CAAA","sourcesContent":["import { Component, ComponentNature, Ellipse, Properties } from '@hatiolab/things-scene'\nimport { getVaueOnRanges } from './utils/get-value-on-ranges'\nimport { MCSStatusMixin } from './features/mcs-status-mixin'\nimport { LEGEND_CAPACITY, Legend } from './features/mcs-status-default'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'number',\n name: 'currentUsage',\n label: 'current-usage'\n },\n {\n type: 'number',\n name: 'highWatermark',\n label: 'high-watermark'\n },\n {\n type: 'number',\n name: 'maxCapacity',\n label: 'max-capacity'\n },\n {\n type: 'hidden',\n name: 'usage',\n label: 'usage'\n }\n ],\n 'value-property': 'usage'\n}\n\nexport default class MCSGaugeCapacityCircle extends MCSStatusMixin(Ellipse) {\n static get nature() {\n return NATURE\n }\n\n getTheme() {\n const { legendName } = this.state\n\n if (legendName) {\n return (this.root as any)?.style?.[legendName]\n }\n }\n\n get legend(): Legend {\n return this.getTheme() || this.getLegendFallback()\n }\n\n getLegendFallback() {\n return LEGEND_CAPACITY\n }\n\n get statusColor() {\n return getVaueOnRanges(this.usage, this.legend)\n }\n\n render(context: CanvasRenderingContext2D) {\n var { cx, cy, rx, ry } = this.state\n const radius = Math.min(rx, ry)\n\n context.beginPath()\n\n context.arc(cx, cy, radius, 0, Math.PI * 2)\n context.fillStyle = 'gray'\n context.fill()\n this.drawStroke(context)\n\n const startAngle = Math.PI * -0.5\n const endAngle = startAngle + Math.PI * 2 * (this.value / 100)\n\n context.beginPath()\n\n context.moveTo(cx, cy)\n context.arc(cx, cy, radius, startAngle, endAngle)\n context.lineTo(cx, cy)\n context.fillStyle = this.statusColor!\n\n context.fill()\n }\n\n get usage() {\n const { currentUsage = 0, maxCapacity = 100 } = this.state\n return Math.round((currentUsage / maxCapacity) * 100)\n }\n\n set usage(usage: number) {\n // intentionally have done nothing\n }\n\n onchangeData(after: Properties, before: Properties): void {\n const {\n CURRENTCAPACITY = 0,\n MAXCAPACITY = 100,\n HIGHWATERMARK = 100\n } = typeof this.data == 'object' ? this.data : {}\n\n const currentUsage = Number(CURRENTCAPACITY) || 0\n const maxCapacity = Number(MAXCAPACITY) || 100\n const highWatermark = Number(HIGHWATERMARK) || 100\n\n this.setState({\n currentUsage,\n maxCapacity,\n highWatermark,\n usage: Math.round((currentUsage / maxCapacity) * 100)\n })\n }\n}\n\nComponent.register('MCSGaugeCapacityCircle', MCSGaugeCapacityCircle)\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ContainerAbstract } from '@hatiolab/things-scene';
|
|
2
|
+
import { MCSStatusMixin, MCSStatusMixinProperties } from './features/mcs-status-mixin';
|
|
3
|
+
import { safeRound } from './utils/safe-round';
|
|
4
|
+
import { LEGEND_MACHINE } from './features/mcs-status-default';
|
|
5
|
+
import { getLocaleLanguage } from './utils/get-locale';
|
|
6
|
+
/**
|
|
7
|
+
* MCS Machine의 공통 속성을 정의한 최상위 오브젝트
|
|
8
|
+
* - Container
|
|
9
|
+
* -
|
|
10
|
+
*/
|
|
11
|
+
export default class MCSMachine extends MCSStatusMixin(ContainerAbstract) {
|
|
12
|
+
static get properties() {
|
|
13
|
+
return [
|
|
14
|
+
...MCSStatusMixinProperties,
|
|
15
|
+
{
|
|
16
|
+
type: 'number',
|
|
17
|
+
name: 'round',
|
|
18
|
+
label: 'round'
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
containable(component) {
|
|
23
|
+
return ['rect', 'ellipse'].includes(component.state.type);
|
|
24
|
+
}
|
|
25
|
+
get reactionDecorators() {
|
|
26
|
+
return ['bouncing-arrow'];
|
|
27
|
+
}
|
|
28
|
+
getTheme() {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
const { legendName } = this.state;
|
|
31
|
+
if (legendName) {
|
|
32
|
+
return (_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b[legendName];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
get hasTextProperty() {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
get status() {
|
|
39
|
+
var _a;
|
|
40
|
+
return (_a = this.data) === null || _a === void 0 ? void 0 : _a.STATUS;
|
|
41
|
+
}
|
|
42
|
+
get auxStatus() {
|
|
43
|
+
var _a;
|
|
44
|
+
return (_a = this.data) === null || _a === void 0 ? void 0 : _a.STATUS;
|
|
45
|
+
}
|
|
46
|
+
get legend() {
|
|
47
|
+
return this.getTheme() || this.getLegendFallback();
|
|
48
|
+
}
|
|
49
|
+
get auxLegend() {
|
|
50
|
+
return LEGEND_MACHINE;
|
|
51
|
+
}
|
|
52
|
+
get auxColor() {
|
|
53
|
+
return this.state.strokeStyle;
|
|
54
|
+
}
|
|
55
|
+
getLegendFallback() {
|
|
56
|
+
return LEGEND_MACHINE;
|
|
57
|
+
}
|
|
58
|
+
render(ctx) {
|
|
59
|
+
var { round = 0, lineWidth } = this.state;
|
|
60
|
+
var { left, top, width, height } = this.bounds;
|
|
61
|
+
ctx.beginPath();
|
|
62
|
+
ctx.strokeStyle = this.auxColor;
|
|
63
|
+
ctx.fillStyle = this.statusColor;
|
|
64
|
+
ctx.lineWidth = lineWidth || 1;
|
|
65
|
+
ctx.lineCap = 'round';
|
|
66
|
+
ctx.setLineDash([]);
|
|
67
|
+
round = safeRound(round, width, height);
|
|
68
|
+
ctx.roundRect(left, top, width, height, round);
|
|
69
|
+
ctx.fill();
|
|
70
|
+
ctx.stroke();
|
|
71
|
+
}
|
|
72
|
+
get text() {
|
|
73
|
+
var _a;
|
|
74
|
+
if ((_a = this.data) === null || _a === void 0 ? void 0 : _a.LOCALENAME) {
|
|
75
|
+
// TODO 왜 LOCALENAME 데이타는 문자열인가 ? 오브젝트로 보내달라.
|
|
76
|
+
return JSON.parse(this.data.LOCALENAME)[getLocaleLanguage()];
|
|
77
|
+
}
|
|
78
|
+
return super.text;
|
|
79
|
+
}
|
|
80
|
+
set text(text) {
|
|
81
|
+
super.text = text;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=mcs-machine.js.map
|