@fmsim/machine 1.0.46 → 1.0.48
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 +1 -1
- package/dist/agv-line.js.map +1 -1
- package/dist/carrier.js +9 -8
- package/dist/carrier.js.map +1 -1
- package/dist/conveyor.js +1 -1
- package/dist/conveyor.js.map +1 -1
- package/dist/features/mcs-status-mixin.js +3 -0
- package/dist/features/mcs-status-mixin.js.map +1 -1
- package/dist/mcs-machine.js +0 -3
- package/dist/mcs-machine.js.map +1 -1
- package/dist/mcs-unit.js +0 -3
- package/dist/mcs-unit.js.map +1 -1
- package/dist/mcs-vehicle.js +39 -0
- package/dist/mcs-vehicle.js.map +1 -1
- package/dist/node.js +22 -1
- package/dist/node.js.map +1 -1
- package/dist/oht-line.js +1 -1
- package/dist/oht-line.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/agv-line.ts +1 -1
- package/src/carrier.ts +9 -8
- package/src/conveyor.ts +1 -1
- package/src/features/mcs-status-mixin.ts +4 -0
- package/src/mcs-machine.ts +0 -4
- package/src/mcs-unit.ts +0 -4
- package/src/mcs-vehicle.ts +51 -0
- package/src/node.ts +25 -1
- package/src/oht-line.ts +1 -1
package/src/carrier.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { getPopupData } from '@fmsim/api'
|
|
|
3
3
|
|
|
4
4
|
import { BOUNDS, Component, ComponentNature, Properties, Shape } from '@hatiolab/things-scene'
|
|
5
5
|
import { ANIMATION_DEFAULT, AnimationPreset, AnimationConfig } from './features/animation-default.js'
|
|
6
|
+
import { ParentObjectMixin } from './features/parent-object-mixin.js'
|
|
6
7
|
import { LEGEND_CARRIER, Legend } from './features/mcs-status-default.js'
|
|
7
8
|
import { MCSStatusMixin } from './features/mcs-status-mixin.js'
|
|
8
9
|
|
|
@@ -12,7 +13,7 @@ const NATURE: ComponentNature = {
|
|
|
12
13
|
rotatable: false
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
export default class Carrier extends MCSStatusMixin(Shape) {
|
|
16
|
+
export default class Carrier extends MCSStatusMixin(ParentObjectMixin(Shape)) {
|
|
16
17
|
static get nature() {
|
|
17
18
|
return NATURE
|
|
18
19
|
}
|
|
@@ -58,7 +59,7 @@ export default class Carrier extends MCSStatusMixin(Shape) {
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
if (decorator || border || arrow) {
|
|
61
|
-
this.trigger('
|
|
62
|
+
this.trigger('deco-off')
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
|
|
@@ -75,18 +76,18 @@ export default class Carrier extends MCSStatusMixin(Shape) {
|
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
if (decorator) {
|
|
78
|
-
this.trigger('
|
|
79
|
-
this.trigger('icon', decorator)
|
|
79
|
+
this.trigger('deco-icon-off')
|
|
80
|
+
this.trigger('deco-icon', decorator)
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
if (border) {
|
|
83
|
-
this.trigger('
|
|
84
|
-
this.trigger('border', border)
|
|
84
|
+
this.trigger('deco-border-off')
|
|
85
|
+
this.trigger('deco-border', border)
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
if (arrow) {
|
|
88
|
-
this.trigger('
|
|
89
|
-
this.trigger('
|
|
89
|
+
this.trigger('deco-arrow-off')
|
|
90
|
+
this.trigger('deco-arrow', arrow)
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
}
|
package/src/conveyor.ts
CHANGED
|
@@ -32,7 +32,7 @@ export default class Conveyor extends MCSTransport {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
containable(component: Component) {
|
|
35
|
-
return ['Shuttle', 'Port'].includes(component.state.type)
|
|
35
|
+
return ['Shuttle', 'Port', 'Node'].includes(component.state.type)
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
renderConveyor(ctx: CanvasRenderingContext2D) {
|
package/src/mcs-machine.ts
CHANGED
|
@@ -30,10 +30,6 @@ export default class MCSMachine extends MCSStatusMixin(ContainerAbstract) {
|
|
|
30
30
|
return ['rect', 'ellipse'].includes(component.state.type)
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
get reactionDecorators() {
|
|
34
|
-
return ['bouncing-arrow']
|
|
35
|
-
}
|
|
36
|
-
|
|
37
33
|
get decorators() {
|
|
38
34
|
return ['decotag']
|
|
39
35
|
}
|
package/src/mcs-unit.ts
CHANGED
package/src/mcs-vehicle.ts
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
+
import { Properties } from '@hatiolab/things-scene'
|
|
1
2
|
import { LEGEND_VEHICLE, Legend } from './features/mcs-status-default'
|
|
2
3
|
import MCSCarrierHolder from './mcs-carrier-holder'
|
|
4
|
+
import Node from './node'
|
|
3
5
|
|
|
4
6
|
const DIRECTION_GAP = 3
|
|
5
7
|
|
|
8
|
+
function findNode(vehicle: MCSVehicle, nodeId: string, nodeMachine: string) {
|
|
9
|
+
if (!nodeId || !nodeMachine) {
|
|
10
|
+
return null
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const nodes = vehicle.root.findAllById(nodeId).filter(node => node.state.type == 'Node') as Node[]
|
|
14
|
+
|
|
15
|
+
return nodes.find((node: Node) => {
|
|
16
|
+
return node.nodeMachine === nodeMachine
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
|
|
6
20
|
/**
|
|
7
21
|
* MCS용 Unit > Transport들의 공통 속성을 정의한 오브젝트
|
|
8
22
|
*/
|
|
@@ -21,6 +35,8 @@ export default class MCSVehicle extends MCSCarrierHolder {
|
|
|
21
35
|
]
|
|
22
36
|
}
|
|
23
37
|
|
|
38
|
+
private lastWaypoint: { NodeId: string; NodeMachine: string } | null = null
|
|
39
|
+
|
|
24
40
|
getLegendFallback(): Legend {
|
|
25
41
|
return LEGEND_VEHICLE
|
|
26
42
|
}
|
|
@@ -77,4 +93,39 @@ export default class MCSVehicle extends MCSCarrierHolder {
|
|
|
77
93
|
super.postrender(ctx)
|
|
78
94
|
// this.renderDirection(ctx)
|
|
79
95
|
}
|
|
96
|
+
|
|
97
|
+
onchangeData(after: Properties, before: Properties): void {
|
|
98
|
+
super.onchangeData(after, before)
|
|
99
|
+
|
|
100
|
+
const { NodeId: beforeNodeId, NodeMachine: beforeNodeMachine } = before.data || {}
|
|
101
|
+
const { NodeId, NodeMachine } = after.data || {}
|
|
102
|
+
|
|
103
|
+
if (
|
|
104
|
+
NodeId === undefined ||
|
|
105
|
+
NodeMachine === undefined ||
|
|
106
|
+
(beforeNodeId === NodeId && beforeNodeMachine === NodeMachine) ||
|
|
107
|
+
(this.lastWaypoint && this.lastWaypoint.NodeId === NodeId && this.lastWaypoint.NodeMachine === NodeMachine)
|
|
108
|
+
) {
|
|
109
|
+
return // not changed
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const afterNode = findNode(this, NodeId, NodeMachine)
|
|
113
|
+
if (!afterNode) {
|
|
114
|
+
console.warn(`Node not found. NodeId: ${NodeId}, NodeMachine: ${NodeMachine}`)
|
|
115
|
+
return
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const beforeNode = this.lastWaypoint
|
|
119
|
+
? findNode(this, this.lastWaypoint.NodeId, this.lastWaypoint.NodeMachine)
|
|
120
|
+
: afterNode
|
|
121
|
+
|
|
122
|
+
// 실제 존재하는 노드 중 가장 최근에 이동한 노드
|
|
123
|
+
this.lastWaypoint = { NodeId, NodeMachine }
|
|
124
|
+
|
|
125
|
+
this.trigger('waypoint', {
|
|
126
|
+
from: beforeNode,
|
|
127
|
+
to: afterNode,
|
|
128
|
+
duration: 5000
|
|
129
|
+
})
|
|
130
|
+
}
|
|
80
131
|
}
|
package/src/node.ts
CHANGED
|
@@ -3,12 +3,24 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { Component, Shape } from '@hatiolab/things-scene'
|
|
6
|
+
import MCSMachine from './mcs-machine'
|
|
6
7
|
|
|
7
8
|
const NATURE = {
|
|
8
9
|
mutable: false,
|
|
9
10
|
resizable: false,
|
|
10
11
|
rotatable: false,
|
|
11
|
-
properties: [
|
|
12
|
+
properties: [
|
|
13
|
+
{
|
|
14
|
+
type: 'string',
|
|
15
|
+
name: 'NodeIDs',
|
|
16
|
+
label: 'node-ids'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: 'string',
|
|
20
|
+
name: 'NodeMachine',
|
|
21
|
+
label: 'node-machine'
|
|
22
|
+
}
|
|
23
|
+
]
|
|
12
24
|
}
|
|
13
25
|
|
|
14
26
|
export default class Node extends Shape {
|
|
@@ -65,6 +77,18 @@ export default class Node extends Shape {
|
|
|
65
77
|
})
|
|
66
78
|
}
|
|
67
79
|
|
|
80
|
+
get nodeMachine() {
|
|
81
|
+
if (this.state.NodeMachine) {
|
|
82
|
+
return this.state.NodeMachine
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const parent = this.parent
|
|
86
|
+
|
|
87
|
+
if (parent && parent instanceof MCSMachine) {
|
|
88
|
+
return parent.state.id
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
68
92
|
contains(x, y) {
|
|
69
93
|
var { cx, cy } = this.state
|
|
70
94
|
|
package/src/oht-line.ts
CHANGED