@aj-shadow/z-abs-complayer-markup-client 0.0.0-aj-beta.221
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/.gitattributes +26 -0
- package/LICENSE.txt +96 -0
- package/README.md +5 -0
- package/npm-shrinkwrap.json +13 -0
- package/package.json +10 -0
- package/project/client/_build/Bundle-CompLayer-Markup-client.bld +40 -0
- package/project/client/_build/Client-CompLayer-Markup-client-jsx.bld +10 -0
- package/project/client/_build/Client-CompLayer-Markup-client.bld +10 -0
- package/project/client/_build/Client-css-CompLayer-Markup-bundle.bld +9 -0
- package/project/client/_build/z-abs-complayer-markup-client.prj +36 -0
- package/project/client/actions/action-style.js +17 -0
- package/project/client/actions/data-action-style.js +13 -0
- package/project/client/css/markup_addressing.css +30 -0
- package/project/client/css/markup_flowchart.css +53 -0
- package/project/client/css/markup_general.css +4 -0
- package/project/client/css/markup_image.css +10 -0
- package/project/client/css/markup_license.css +107 -0
- package/project/client/css/markup_login.css +201 -0
- package/project/client/css/markup_node_diagram.css +51 -0
- package/project/client/css/markup_sequence_diagram.css +6 -0
- package/project/client/css/markup_state.css +5 -0
- package/project/client/css/markup_table.css +57 -0
- package/project/client/css/markup_tc.css +32 -0
- package/project/client/css/markup_ts.css +36 -0
- package/project/client/data/addresses/data-addresses-client-address-global.js +20 -0
- package/project/client/data/addresses/data-addresses-client-address-local.js +20 -0
- package/project/client/data/addresses/data-addresses-client-interface-global.js +17 -0
- package/project/client/data/addresses/data-addresses-client-interface-local.js +17 -0
- package/project/client/data/addresses/data-addresses-dns-global.js +18 -0
- package/project/client/data/addresses/data-addresses-dns-local.js +19 -0
- package/project/client/data/addresses/data-addresses-dst-global.js +20 -0
- package/project/client/data/addresses/data-addresses-dst-local.js +20 -0
- package/project/client/data/addresses/data-addresses-network-interface-global.js +17 -0
- package/project/client/data/addresses/data-addresses-network-interface-local.js +17 -0
- package/project/client/data/addresses/data-addresses-ports-global.js +18 -0
- package/project/client/data/addresses/data-addresses-ports-local.js +18 -0
- package/project/client/data/addresses/data-addresses-server-address-global.js +20 -0
- package/project/client/data/addresses/data-addresses-server-address-local.js +20 -0
- package/project/client/data/addresses/data-addresses-server-interface-global.js +17 -0
- package/project/client/data/addresses/data-addresses-server-interface-local.js +17 -0
- package/project/client/data/addresses/data-addresses-src-global.js +21 -0
- package/project/client/data/addresses/data-addresses-src-local.js +21 -0
- package/project/client/data/addresses/data-addresses-srv-global.js +20 -0
- package/project/client/data/addresses/data-addresses-srv-local.js +20 -0
- package/project/client/data/addresses/data-addresses-sut-address-global.js +20 -0
- package/project/client/data/addresses/data-addresses-sut-address-local.js +20 -0
- package/project/client/data/addresses/data-addresses-sut-interface-global.js +19 -0
- package/project/client/data/addresses/data-addresses-sut-interface-local.js +19 -0
- package/project/client/data/data-chart/data-chart-axis.js +13 -0
- package/project/client/data/data-chart/data-chart-grid.js +14 -0
- package/project/client/data/data-chart/data-chart-line/data-chart-line-config.js +17 -0
- package/project/client/data/data-chart/data-chart-line/data-chart-line.js +41 -0
- package/project/client/data/data-config.js +14 -0
- package/project/client/data/data-constructor.js +18 -0
- package/project/client/data/data-content/data-content-audio-global.js +18 -0
- package/project/client/data/data-content/data-content-audio-local.js +18 -0
- package/project/client/data/data-content/data-content-documents-global.js +18 -0
- package/project/client/data/data-content/data-content-documents-local.js +18 -0
- package/project/client/data/data-content/data-content-image-global.js +21 -0
- package/project/client/data/data-content/data-content-image-local.js +21 -0
- package/project/client/data/data-content/data-content-other-global.js +20 -0
- package/project/client/data/data-content/data-content-other-local.js +20 -0
- package/project/client/data/data-content/data-content-text-global.js +20 -0
- package/project/client/data/data-content/data-content-text-local.js +20 -0
- package/project/client/data/data-content/data-content-video-global.js +20 -0
- package/project/client/data/data-content/data-content-video-local.js +20 -0
- package/project/client/data/data-data.js +28 -0
- package/project/client/data/data-dependencies/data-dependencies.js +17 -0
- package/project/client/data/data-documentation/data-documentation-navigation.js +15 -0
- package/project/client/data/data-documentation/data-documentation.js +20 -0
- package/project/client/data/data-flowchart/data-flowchart-block.js +33 -0
- package/project/client/data/data-flowchart/data-flowchart-connection.js +17 -0
- package/project/client/data/data-flowchart/data-flowchart.js +30 -0
- package/project/client/data/data-html/data-html-anchor.js +12 -0
- package/project/client/data/data-html/data-html-br.js +11 -0
- package/project/client/data/data-html/data-html-button.js +15 -0
- package/project/client/data/data-html/data-html-log-start.js +12 -0
- package/project/client/data/data-html/data-html-log-stop.js +13 -0
- package/project/client/data/data-html/data-html-log.js +16 -0
- package/project/client/data/data-html/data-html-toolbar.js +19 -0
- package/project/client/data/data-image/data-image.js +20 -0
- package/project/client/data/data-lab/data-lab-interface-client.js +19 -0
- package/project/client/data/data-lab/data-lab-interface-server.js +19 -0
- package/project/client/data/data-lab/data-lab-interface-sut.js +20 -0
- package/project/client/data/data-lab/data-lab-network.js +31 -0
- package/project/client/data/data-lab/data-lab.js +21 -0
- package/project/client/data/data-licenses/data-licenses.js +16 -0
- package/project/client/data/data-node-diagram/data-node-diagram-config.js +21 -0
- package/project/client/data/data-node-diagram/data-node-diagram-connection.js +18 -0
- package/project/client/data/data-node-diagram/data-node-diagram-group.js +16 -0
- package/project/client/data/data-node-diagram/data-node-diagram-node.js +22 -0
- package/project/client/data/data-node-diagram/data-node-diagram.js +47 -0
- package/project/client/data/data-repos/data-repos-content-local.js +15 -0
- package/project/client/data/data-repos/data-repos-data-local.js +15 -0
- package/project/client/data/data-sequence-diagram/data-sequence-diagram-config.js +22 -0
- package/project/client/data/data-sequence-diagram/data-sequence-diagram-message.js +17 -0
- package/project/client/data/data-sequence-diagram/data-sequence-diagram-node.js +11 -0
- package/project/client/data/data-sequence-diagram/data-sequence-diagram.js +32 -0
- package/project/client/data/data-state-machine/data-state-machine-config.js +17 -0
- package/project/client/data/data-state-machine/data-state-machine-state.js +29 -0
- package/project/client/data/data-state-machine/data-state-machine-transition.js +18 -0
- package/project/client/data/data-state-machine/data-state-machine.js +37 -0
- package/project/client/data/data-system-under-test/data-system-under-test-instances.js +15 -0
- package/project/client/data/data-system-under-test/data-system-under-test-nodes.js +18 -0
- package/project/client/data/data-table/data-table-config.js +21 -0
- package/project/client/data/data-table-key-value.js +56 -0
- package/project/client/data/data-test-case/data-actor.js +282 -0
- package/project/client/data/data-test-case/data-test-case-settings.js +49 -0
- package/project/client/data/data-test-case/data-test-case.js +19 -0
- package/project/client/data/data-test-case/data-test-data-iteration.js +54 -0
- package/project/client/data/data-test-case/data-test-data-test-case.js +16 -0
- package/project/client/data/data-test-case/data-verification-test-case.js +24 -0
- package/project/client/data/data-test-data/data-test-data-environment-global.js +18 -0
- package/project/client/data/data-test-data/data-test-data-environment-local.js +18 -0
- package/project/client/data/data-test-data/data-test-data-environment-static.js +16 -0
- package/project/client/data/data-test-data/data-test-data-general-global.js +18 -0
- package/project/client/data/data-test-data/data-test-data-general-local.js +18 -0
- package/project/client/data/data-test-data/data-test-data-output-global.js +18 -0
- package/project/client/data/data-test-data/data-test-data-output-local.js +18 -0
- package/project/client/data/data-test-data/data-test-data-system-global.js +18 -0
- package/project/client/data/data-test-data/data-test-data-system-local.js +18 -0
- package/project/client/data/data-test-suite/data-test-suite-abstraction.js +72 -0
- package/project/client/data/data-test-suite/data-test-suite.js +15 -0
- package/project/client/data/data-tree/data-tree-node.js +17 -0
- package/project/client/data/data-tree/data-tree.js +13 -0
- package/project/client/markup/markup-addresses/markup-addresses-client-address.js +31 -0
- package/project/client/markup/markup-addresses/markup-addresses-client-interface.js +31 -0
- package/project/client/markup/markup-addresses/markup-addresses-dns.js +32 -0
- package/project/client/markup/markup-addresses/markup-addresses-dst.js +31 -0
- package/project/client/markup/markup-addresses/markup-addresses-network-interface.js +31 -0
- package/project/client/markup/markup-addresses/markup-addresses-ports.js +31 -0
- package/project/client/markup/markup-addresses/markup-addresses-server-address.js +31 -0
- package/project/client/markup/markup-addresses/markup-addresses-server-interface.js +31 -0
- package/project/client/markup/markup-addresses/markup-addresses-src.js +31 -0
- package/project/client/markup/markup-addresses/markup-addresses-srv.js +31 -0
- package/project/client/markup/markup-addresses/markup-addresses-sut-address.js +31 -0
- package/project/client/markup/markup-addresses/markup-addresses-sut-interface.js +31 -0
- package/project/client/markup/markup-chart/markup-chart-line.js +92 -0
- package/project/client/markup/markup-content/markup-content-audio.js +31 -0
- package/project/client/markup/markup-content/markup-content-documents.js +31 -0
- package/project/client/markup/markup-content/markup-content-image.js +31 -0
- package/project/client/markup/markup-content/markup-content-other.js +31 -0
- package/project/client/markup/markup-content/markup-content-text.js +31 -0
- package/project/client/markup/markup-content/markup-content-video.js +31 -0
- package/project/client/markup/markup-dependencies/markup-dependencies.js +30 -0
- package/project/client/markup/markup-documentation/markup-documentation-anchor.js +37 -0
- package/project/client/markup/markup-documentation/markup-documentation-api-status.js +67 -0
- package/project/client/markup/markup-documentation/markup-documentation-code.js +20 -0
- package/project/client/markup/markup-documentation/markup-documentation-div.js +34 -0
- package/project/client/markup/markup-documentation/markup-documentation-documentation-status.js +67 -0
- package/project/client/markup/markup-documentation/markup-documentation-embed.js +23 -0
- package/project/client/markup/markup-documentation/markup-documentation-html.js +139 -0
- package/project/client/markup/markup-documentation/markup-documentation-ie.js +21 -0
- package/project/client/markup/markup-documentation/markup-documentation-image.js +46 -0
- package/project/client/markup/markup-documentation/markup-documentation-lab.js +19 -0
- package/project/client/markup/markup-documentation/markup-documentation-local-note.js +33 -0
- package/project/client/markup/markup-documentation/markup-documentation-navigation.js +109 -0
- package/project/client/markup/markup-documentation/markup-documentation-page.js +262 -0
- package/project/client/markup/markup-documentation/markup-documentation-ref.js +28 -0
- package/project/client/markup/markup-documentation/markup-documentation-result.js +21 -0
- package/project/client/markup/markup-documentation/markup-documentation-state-machine.js +194 -0
- package/project/client/markup/markup-documentation/markup-documentation.js +74 -0
- package/project/client/markup/markup-flowchart.js +264 -0
- package/project/client/markup/markup-lab.js +116 -0
- package/project/client/markup/markup-licenses/markup-licenses.js +29 -0
- package/project/client/markup/markup-node-diagram.js +435 -0
- package/project/client/markup/markup-parse-helper.js +26 -0
- package/project/client/markup/markup-pattern-config.js +53 -0
- package/project/client/markup/markup-pattern-data.js +50 -0
- package/project/client/markup/markup-pattern-function.js +47 -0
- package/project/client/markup/markup-repos/markup-repos.js +31 -0
- package/project/client/markup/markup-sequence-diagram.js +466 -0
- package/project/client/markup/markup-system-under-test/markup-system-under-test-instances.js +29 -0
- package/project/client/markup/markup-system-under-test/markup-system-under-test-nodes.js +30 -0
- package/project/client/markup/markup-table-key-value-parse.js +25 -0
- package/project/client/markup/markup-table-key-value-stringify.js +91 -0
- package/project/client/markup/markup-table-key-value.js +18 -0
- package/project/client/markup/markup-table-name-value.js +101 -0
- package/project/client/markup/markup-table.js +85 -0
- package/project/client/markup/markup-tables-parser.js +122 -0
- package/project/client/markup/markup-test-case/markup-test-case.js +67 -0
- package/project/client/markup/markup-test-data/markup-test-data-environment.js +31 -0
- package/project/client/markup/markup-test-data/markup-test-data-general.js +31 -0
- package/project/client/markup/markup-test-data/markup-test-data-output.js +31 -0
- package/project/client/markup/markup-test-data/markup-test-data-system.js +31 -0
- package/project/client/markup/markup-test-suite/markup-test-suite.js +40 -0
- package/project/client/react-components/helper/line-data.js +16 -0
- package/project/client/react-components/helper/line-object.js +22 -0
- package/project/client/react-components/helper/scroll-data.js +74 -0
- package/project/client/react-components/markup/component-chart/component-image-chart-line.jsx +203 -0
- package/project/client/react-components/markup/component-code.jsx +50 -0
- package/project/client/react-components/markup/component-document.jsx +105 -0
- package/project/client/react-components/markup/component-documentation-anchor.jsx +47 -0
- package/project/client/react-components/markup/component-embed.jsx +48 -0
- package/project/client/react-components/markup/component-image-flowchart.jsx +389 -0
- package/project/client/react-components/markup/component-image-image.jsx +32 -0
- package/project/client/react-components/markup/component-image-lab.jsx +696 -0
- package/project/client/react-components/markup/component-image-node-diagram.jsx +506 -0
- package/project/client/react-components/markup/component-image-result.jsx +22 -0
- package/project/client/react-components/markup/component-image-sequence-diagram.jsx +645 -0
- package/project/client/react-components/markup/component-image-state-machine.jsx +633 -0
- package/project/client/react-components/markup/component-image-table.jsx +96 -0
- package/project/client/react-components/markup/component-local-note.jsx +99 -0
- package/project/client/react-components/markup/component-markup-remarkable.jsx +79 -0
- package/project/client/react-components/markup/component-markup.jsx +1036 -0
- package/project/client/react-components/markup/component-table-data-table.jsx +146 -0
- package/project/client/stores/style-store.js +96 -0
- package/project/z-abs-complayer-markup-client.tree +239 -0
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
import ReactComponentBase from 'z-abs-corelayer-client/client/react-component/react-component-base';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export default class ComponentImageStateMachine extends ReactComponentBase {
|
|
9
|
+
constructor(props) {
|
|
10
|
+
super(props);
|
|
11
|
+
this.BIAS = new Map([
|
|
12
|
+
['state', {x:0, y:-0, textHX:0, textHY:-5, textVX:0, textVY:0}]
|
|
13
|
+
]);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
shouldUpdate(nextProps, nextState) {
|
|
17
|
+
return !this.shallowCompare(this.props, nextProps);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
renderTitle(title, x) {
|
|
21
|
+
if(0 !== title) {
|
|
22
|
+
return (
|
|
23
|
+
<text x={x} y={ComponentImageStateMachine.TITLE_TOP}
|
|
24
|
+
textAnchor="middle" style={{fontSize:ComponentImageStateMachine.TITLE_FONT_SIZE,fontWeight:'bold'}}>
|
|
25
|
+
{title}
|
|
26
|
+
</text>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
renderState(state, titleHeight) {
|
|
32
|
+
const bias = this.BIAS.get('state');
|
|
33
|
+
const left = ComponentImageStateMachine.BIAS_X + state.xIndex * (ComponentImageStateMachine.STATE_WIDTH + ComponentImageStateMachine.STATE_DIST_WIDTH);
|
|
34
|
+
const top = titleHeight + ComponentImageStateMachine.BIAS_Y + state.yIndex * (ComponentImageStateMachine.STATE_HEIGHT + ComponentImageStateMachine.STATE_DIST_HEIGHT);
|
|
35
|
+
return (
|
|
36
|
+
<g key={`state_${state.xIndex}_${state.yIndex}`}>
|
|
37
|
+
<rect className="markup_state" x={left - bias.x} y={top - bias.y} height={ComponentImageStateMachine.STATE_HEIGHT} width={ComponentImageStateMachine.STATE_WIDTH} rx="15" ry="15" />
|
|
38
|
+
<text x={left + ComponentImageStateMachine.STATE_WIDTH_HALF} y={top + (ComponentImageStateMachine.STATE_FONT_SIZE + ComponentImageStateMachine.STATE_HEIGHT) / 2} textAnchor="middle" style={{fontSize:ComponentImageStateMachine.STATE_FONT_SIZE,fontWeight:'bold'}}>
|
|
39
|
+
{state.name}
|
|
40
|
+
</text>
|
|
41
|
+
</g>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
renderStates(stateRows, titleHeight) {
|
|
46
|
+
const svgStates = stateRows.map((states, yIndex) => {
|
|
47
|
+
return states.map((state) => {
|
|
48
|
+
if(state.name && !state.comment) {
|
|
49
|
+
return this.renderState(state, titleHeight);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
return (
|
|
54
|
+
<g>
|
|
55
|
+
{svgStates}
|
|
56
|
+
</g>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static staticRenderCurve(xStart, yStart, xStop, yStop, positionData, transition, key) {
|
|
61
|
+
const q = ComponentImageStateMachine._q2(xStart, xStop, yStart, yStop, positionData.topDirX, positionData.topDirY);
|
|
62
|
+
const d = ['M', xStart, yStart, 'Q', q.xt, q.yt, xStop, yStop].join(' ');
|
|
63
|
+
return (
|
|
64
|
+
<g key={key}>
|
|
65
|
+
{/*<path className={`markup_state_${transition.type}`} d={d} />*/}
|
|
66
|
+
<line x1={xStart} y1={yStart} x2={xStop} y2={yStop} stroke="black" strokeWidth="1" fill="orange" />
|
|
67
|
+
{/*<line x1={q.xb} y1={q.yb} x2={q.xt} y2={q.yt} stroke="black" strokeWidth="1" fill="orange" />
|
|
68
|
+
<line x1={xStart} y1={yStart} x2={q.xt} y2={q.yt} stroke="black" strokeWidth="1" fill="orange" />
|
|
69
|
+
<line x1={xStop} y1={yStop} x2={q.xt} y2={q.yt} stroke="black" strokeWidth="1" fill="orange" />*/}
|
|
70
|
+
<circle cx={xStart} cy={yStart} r="2" stroke="black" strokeWidth="1" fill="red" />
|
|
71
|
+
<circle cx={q.xb} cy={q.yb} r="2" stroke="black" strokeWidth="1" fill="yellow" />
|
|
72
|
+
{/*<circle cx={q.xm} cy={q.ym} r="2" stroke="black" strokeWidth="1" fill="green" />
|
|
73
|
+
<circle cx={q.xt} cy={q.yt} r="2" stroke="black" strokeWidth="1" fill="blue" />*/}
|
|
74
|
+
<circle cx={xStop} cy={yStop} r="2" stroke="black" strokeWidth="1" fill="red" />
|
|
75
|
+
</g>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
static renderTransitionXEqYEq(fromState, toState, currentOut, currentIn, outPoint, inPoint, transition, titleHeight) {
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static renderTransitionDiffSteps1Y(fromState, toState, currentOut, currentIn, outPoint, inPoint, positionData, transition, titleHeight) {
|
|
84
|
+
const xm1 = outPoint.x + ComponentImageStateMachine.STATE_DIST_WIDTH_THIRD ;
|
|
85
|
+
const ym1 = outPoint.y + positionData.yDiff * ComponentImageStateMachine.STATE_DIST_HEIGHT_THIRD;
|
|
86
|
+
const xm2 = xm1 + ComponentImageStateMachine.STATE_DIST_WIDTH_THIRD ;
|
|
87
|
+
const ym2 = ym1 + positionData.yDiff * ComponentImageStateMachine.STATE_DIST_HEIGHT_THIRD;
|
|
88
|
+
const q1 = ComponentImageStateMachine._q3(outPoint.x, xm1, outPoint.y, ym1, 1);
|
|
89
|
+
const q2 = ComponentImageStateMachine._q3(xm2, xm1, ym2, ym1, -1);
|
|
90
|
+
const d1 = ['M', outPoint.x, outPoint.y, 'Q', q1.xt, q1.yt, xm1, ym1].join(' ');
|
|
91
|
+
const d2 = ['M', xm2, ym2, 'Q', q2.xt, q2.yt, xm1, ym1].join(' ');
|
|
92
|
+
|
|
93
|
+
const xmIn1 = inPoint.x - ComponentImageStateMachine.STATE_DIST_WIDTH_THIRD ;
|
|
94
|
+
const ymIn1 = inPoint.y - positionData.yDiff * ComponentImageStateMachine.STATE_DIST_HEIGHT_THIRD;
|
|
95
|
+
const xmIn2 = xmIn1 - ComponentImageStateMachine.STATE_DIST_WIDTH_THIRD ;
|
|
96
|
+
const ymIn2 = ymIn1 - positionData.yDiff * ComponentImageStateMachine.STATE_DIST_HEIGHT_THIRD;
|
|
97
|
+
let qIn1;
|
|
98
|
+
let qIn2;
|
|
99
|
+
let dIn1;
|
|
100
|
+
let dIn2;
|
|
101
|
+
if(1 === positionData.yDiff) {
|
|
102
|
+
qIn1 = ComponentImageStateMachine._q3(inPoint.x, xmIn1, inPoint.y, ymIn1, -1);
|
|
103
|
+
qIn2 = ComponentImageStateMachine._q3(xmIn2, xmIn1, ymIn2, ymIn1, 1);
|
|
104
|
+
dIn1 = ['M', xmIn1, ymIn1, 'Q', qIn1.xt, qIn1.yt, inPoint.x, inPoint.y].join(' ');
|
|
105
|
+
dIn2 = ['M', xmIn2, ymIn2, 'Q', qIn2.xt, qIn2.yt, xmIn1, ymIn1].join(' ');
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
qIn1 = ComponentImageStateMachine._q3(inPoint.x, xmIn1, inPoint.y, ymIn1, -1);
|
|
109
|
+
qIn2 = ComponentImageStateMachine._q3(xmIn2, xmIn1, ymIn2, ymIn1, 1);
|
|
110
|
+
dIn1 = ['M', xmIn1, ymIn1, 'Q', qIn1.xt, qIn1.yt, inPoint.x, inPoint.y].join(' ');
|
|
111
|
+
dIn2 = ['M', xmIn2, ymIn2, 'Q', qIn2.xt, qIn2.yt, xmIn1, ymIn1].join(' ');
|
|
112
|
+
}
|
|
113
|
+
const qM1 = ComponentImageStateMachine._q3(xm2, xmIn2, ym2, ymIn2, 1);
|
|
114
|
+
const dM1 = ['M', xm2, ym2, 'Q', qM1.xt, qM1.yt, xmIn2, ymIn2].join(' ');
|
|
115
|
+
|
|
116
|
+
/*
|
|
117
|
+
|
|
118
|
+
const angle = ComponentImageStateMachine._angleQuadraticBezier(q2.xt, q2.yt, inPoint.x, inPoint.y, positionData);
|
|
119
|
+
const translateArrow = `translate(${inPoint.x}, ${inPoint.y}) rotate(${angle * 180 / Math.PI})`;
|
|
120
|
+
*/
|
|
121
|
+
return (
|
|
122
|
+
<g key={`key_${fromState.xIndex}_${fromState.yIndex}_${toState.xIndex}_${toState.yIndex}_${currentOut}_${currentIn}`}>
|
|
123
|
+
<path className={`d1 markup_state_${transition.type}`} d={d1} />
|
|
124
|
+
<path className={`d2 markup_state_${transition.type}`} d={d2} />
|
|
125
|
+
<path className={`dIn1 markup_state_${transition.type}`} d={dIn1} />
|
|
126
|
+
<path className={`dIn2 markup_state_${transition.type}`} d={dIn2} />
|
|
127
|
+
<path className={`dM1 markup_state_${transition.type}`} d={dM1} />
|
|
128
|
+
{/*<polygon points={ComponentImageStateMachine.ARROW} transform={translateArrow} />*/}
|
|
129
|
+
{/*<line x1={outPoint.x} y1={outPoint.y} x2={xm1} y2={ym1} stroke="black" strokeWidth="1" fill="orange" />
|
|
130
|
+
{/*<rect x={outPoint.x} y={outPoint.y} width={xm1 - outPoint.x} height={ym1 - outPoint.y} stroke="black" strokeWidth="1" fill="none" />*/}
|
|
131
|
+
|
|
132
|
+
<circle cx={outPoint.x} cy={outPoint.y} r="2" stroke="black" strokeWidth="1" fill="red" />
|
|
133
|
+
{/*<circle cx={q1.xb} cy={q1.yb} r="2" stroke="black" strokeWidth="1" fill="yellow" />
|
|
134
|
+
<circle cx={q1.xt} cy={q1.yt} r="2" stroke="black" strokeWidth="1" fill="blue" />
|
|
135
|
+
<circle cx={xm1} cy={ym1} r="2" stroke="black" strokeWidth="1" fill="red" />*/}
|
|
136
|
+
|
|
137
|
+
{/*<rect x={xm1} y={ym1} width={xm2 - xm1} height={ym2 - ym1} stroke="black" strokeWidth="1" fill="none" />*/}
|
|
138
|
+
{/*<circle cx={q2.xb} cy={q2.yb} r="2" stroke="black" strokeWidth="1" fill="yellow" />
|
|
139
|
+
<circle cx={q2.xt} cy={q2.yt} r="2" stroke="black" strokeWidth="1" fill="blue" />*/}
|
|
140
|
+
|
|
141
|
+
{/*<line x1={xm1} y1={ym1} x2={q2.xt} y2={q2.yt} stroke="black" strokeWidth="1" fill="orange" />
|
|
142
|
+
<line x1={inPoint.x} y1={inPoint.y} x2={q2.xt} y2={q2.yt} stroke="black" strokeWidth="1" fill="orange" />*/}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
<text x={xm1} y={ym1 - 6} textAnchor="middle" style={{fontSize:'10px',fontWeight:'bold'}}>
|
|
146
|
+
{transition.data}
|
|
147
|
+
</text>
|
|
148
|
+
</g>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
static renderTransitionDiffStepsMY(fromState, toState, currentOut, currentIn, outPoint, inPoint, positionData, transition, titleHeight) {
|
|
153
|
+
const xm1 = outPoint.x + ComponentImageStateMachine.STATE_DIST_WIDTH_THIRD;
|
|
154
|
+
const ym1 = outPoint.y + ComponentImageStateMachine.STATE_DIST_HEIGHT_THIRD;
|
|
155
|
+
const xm2 = xm1 + ComponentImageStateMachine.STATE_DIST_WIDTH_THIRD ;
|
|
156
|
+
const ym2 = ym1 + ComponentImageStateMachine.STATE_DIST_HEIGHT_THIRD;
|
|
157
|
+
const q1 = ComponentImageStateMachine._q3(outPoint.x, xm1, outPoint.y, ym1, 1);
|
|
158
|
+
const q2 = ComponentImageStateMachine._q3(xm2, xm1, ym2, ym1, -1);
|
|
159
|
+
const d1 = ['M', outPoint.x, outPoint.y, 'Q', q1.xt, q1.yt, xm1, ym1].join(' ');
|
|
160
|
+
const d2 = ['M', xm2, ym2, 'Q', q2.xt, q2.yt, xm1, ym1].join(' ');
|
|
161
|
+
|
|
162
|
+
const xmIn1 = inPoint.x - ComponentImageStateMachine.STATE_DIST_WIDTH_THIRD ;
|
|
163
|
+
const ymIn1 = inPoint.y - ComponentImageStateMachine.STATE_DIST_HEIGHT_THIRD;
|
|
164
|
+
const qIn1 = ComponentImageStateMachine._q3(inPoint.x, xmIn1, inPoint.y, ymIn1, -1);
|
|
165
|
+
const dIn1 = ['M', xmIn1, ymIn1, 'Q', qIn1.xt, qIn1.yt, inPoint.x, inPoint.y].join(' ');
|
|
166
|
+
|
|
167
|
+
const xmM1 = xmIn1 - 2 * ComponentImageStateMachine.STATE_DIST_WIDTH_THIRD ;
|
|
168
|
+
const ymM1 = ym1 + 2 * ComponentImageStateMachine.STATE_DIST_HEIGHT_THIRD;
|
|
169
|
+
const xmM3 = xmIn1 - ComponentImageStateMachine.STATE_DIST_WIDTH_THIRD ;
|
|
170
|
+
const ymM3 = ym1 + ComponentImageStateMachine.STATE_DIST_HEIGHT;
|
|
171
|
+
|
|
172
|
+
const qM1 = ComponentImageStateMachine._q3(xm2, xmM1, ym2, ymM1, 1);
|
|
173
|
+
const dM1 = ['M', xm2, ym2, 'Q', qM1.xt, qM1.yt, xmM1, ymM1].join(' ');
|
|
174
|
+
|
|
175
|
+
// const qM2 = ComponentImageStateMachine._q3(xmM3, xmM1, ymM1, ymM3, -1);
|
|
176
|
+
// const dM2 = ['M', xmM1, ymM1, 'Q', qM2.xt, qM2.yt, xmM3, ymM3].join(' ');
|
|
177
|
+
|
|
178
|
+
// const qM3 = ComponentImageStateMachine._q2(xmM3, xmIn1, ymM3, ymIn1, positionData.topDirX, positionData.topDirY);
|
|
179
|
+
// const dM3 = ['M', xmM3, ymM3, 'Q', qM3.xt, qM3.yt, xmIn1, ymIn1].join(' ');
|
|
180
|
+
const qM3 = ComponentImageStateMachine._q2(xmM1, xmIn1, ymM1, ymIn1, positionData.topDirX, positionData.topDirY);
|
|
181
|
+
const dM3 = ['M', xmM1, ymM1, 'Q', qM3.xt, qM3.yt, xmIn1, ymIn1].join(' ');
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<g key={`key_${fromState.xIndex}_${fromState.yIndex}_${toState.xIndex}_${toState.yIndex}_${currentOut}_${currentIn}`}>
|
|
185
|
+
<path className={`d1 markup_state_${transition.type}`} d={d1} />
|
|
186
|
+
<path className={`d2 markup_state_${transition.type}`} d={d2} />
|
|
187
|
+
<path className={`dIn1 markup_state_${transition.type}`} d={dIn1} />
|
|
188
|
+
{/*<path className={`dM2 markup_state_${transition.type}`} d={dM2} />*/}
|
|
189
|
+
<path className={`dM1 markup_state_${transition.type}`} d={dM1} />
|
|
190
|
+
<path className={`dM3 markup_state_${transition.type}`} d={dM3} />
|
|
191
|
+
{/*<path className={`markup_state_${transition.type}`} d={dM2} />*/}
|
|
192
|
+
{/*<polygon points={ComponentImageStateMachine.ARROW} transform={translateArrow} />*/}
|
|
193
|
+
{/*<line x1={outPoint.x} y1={outPoint.y} x2={xm1} y2={ym1} stroke="black" strokeWidth="1" fill="orange" />
|
|
194
|
+
{/*<rect x={outPoint.x} y={outPoint.y} width={xm1 - outPoint.x} height={ym1 - outPoint.y} stroke="black" strokeWidth="1" fill="none" />*/}
|
|
195
|
+
|
|
196
|
+
<circle cx={outPoint.x} cy={outPoint.y} r="2" stroke="black" strokeWidth="1" fill="red" />
|
|
197
|
+
{/*<circle cx={q1.xb} cy={q1.yb} r="2" stroke="black" strokeWidth="1" fill="yellow" />
|
|
198
|
+
<circle cx={q1.xt} cy={q1.yt} r="2" stroke="black" strokeWidth="1" fill="blue" />
|
|
199
|
+
<circle cx={xm1} cy={ym1} r="2" stroke="black" strokeWidth="1" fill="red" />*/}
|
|
200
|
+
|
|
201
|
+
{/*<rect x={xm1} y={ym1} width={xm2 - xm1} height={ym2 - ym1} stroke="black" strokeWidth="1" fill="none" />*/}
|
|
202
|
+
{/*<circle cx={q2.xb} cy={q2.yb} r="2" stroke="black" strokeWidth="1" fill="yellow" />
|
|
203
|
+
<circle cx={q2.xt} cy={q2.yt} r="2" stroke="black" strokeWidth="1" fill="blue" />*/}
|
|
204
|
+
|
|
205
|
+
{/*<line x1={xm1} y1={ym1} x2={q2.xt} y2={q2.yt} stroke="black" strokeWidth="1" fill="orange" />
|
|
206
|
+
<line x1={inPoint.x} y1={inPoint.y} x2={q2.xt} y2={q2.yt} stroke="black" strokeWidth="1" fill="orange" />*/}
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
<text x={xm1} y={ym1 - 6} textAnchor="middle" style={{fontSize:'10px',fontWeight:'bold'}}>
|
|
210
|
+
{transition.data}
|
|
211
|
+
</text>
|
|
212
|
+
</g>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
static renderTransitionDiffStep(fromState, toState, currentOut, currentIn, outPoint, inPoint, positionData, transition, titleHeight) {
|
|
217
|
+
const xm = inPoint.x + (outPoint.x - inPoint.x) / 2 ;
|
|
218
|
+
const ym = outPoint.y + (inPoint.y - outPoint.y) / 2;
|
|
219
|
+
|
|
220
|
+
const q1 = ComponentImageStateMachine._q2(outPoint.x, xm, outPoint.y, ym, positionData.topDirX, positionData.topDirY);
|
|
221
|
+
const q2 = ComponentImageStateMachine._q2(xm, inPoint.x, ym, inPoint.y, positionData.topDirX2, positionData.topDirY2);
|
|
222
|
+
|
|
223
|
+
const d1 = ['M', outPoint.x, outPoint.y, 'Q', q1.xt, q1.yt, xm, ym].join(' ');
|
|
224
|
+
const d2 = ['M', xm, ym, 'Q', q2.xt, q2.yt, inPoint.x, inPoint.y].join(' ');
|
|
225
|
+
|
|
226
|
+
const angle = ComponentImageStateMachine._angleQuadraticBezier(q2.xt, q2.yt, inPoint.x, inPoint.y, positionData);
|
|
227
|
+
const translateArrow = `translate(${inPoint.x}, ${inPoint.y}) rotate(${angle * 180 / Math.PI})`;
|
|
228
|
+
|
|
229
|
+
return (
|
|
230
|
+
<g key={`key_${fromState.xIndex}_${fromState.yIndex}_${toState.xIndex}_${toState.yIndex}_${currentOut}_${currentIn}`}>
|
|
231
|
+
<path className={`markup_state_${transition.type}`} d={d1} />
|
|
232
|
+
<path className={`markup_state_${transition.type}`} d={d2} />
|
|
233
|
+
<polygon points={ComponentImageStateMachine.ARROW} transform={translateArrow} />
|
|
234
|
+
<circle cx={outPoint.x} cy={outPoint.y} r="2" stroke="black" strokeWidth="1" fill="red" />
|
|
235
|
+
|
|
236
|
+
{/*<line x1={xm} y1={ym} x2={inPoint.x} y2={inPoint.y} stroke="black" strokeWidth="1" fill="orange" />
|
|
237
|
+
<line x1={xm} y1={ym} x2={q2.xt} y2={q2.yt} stroke="black" strokeWidth="1" fill="orange" />
|
|
238
|
+
<line x1={inPoint.x} y1={inPoint.y} x2={q2.xt} y2={q2.yt} stroke="black" strokeWidth="1" fill="orange" />*/}
|
|
239
|
+
|
|
240
|
+
{/*<circle cx={xm} cy={ym} r="2" stroke="black" strokeWidth="1" fill="red" />*/}
|
|
241
|
+
{/*<circle cx={q1.xb} cy={,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,q1.yb} r="2" stroke="black" strokeWidth="1" fill="yellow" />
|
|
242
|
+
<circle cx={q1.xm} cy={q1.ym} r="2" stroke="black" strokeWidth="1" fill="green" />
|
|
243
|
+
<circle cx={q1.xt} cy={q1.yt} r="2" stroke="black" strokeWidth="1" fill="blue" />*/}
|
|
244
|
+
|
|
245
|
+
<circle cx={inPoint.x} cy={inPoint.y} r="2" stroke="black" strokeWidth="1" fill="red" />
|
|
246
|
+
{/*<circle cx={q2.xb} cy={q2.yb} r="2" stroke="black" strokeWidth="1" fill="yellow" />
|
|
247
|
+
<circle cx={q2.xm} cy={q2.ym} r="2" stroke="black" strokeWidth="1" fill="green" />
|
|
248
|
+
<circle cx={q2.xt} cy={q2.yt} r="2" stroke="black" strokeWidth="1" fill="blue" />*/}
|
|
249
|
+
|
|
250
|
+
<text x={xm} y={ym - 6} textAnchor="middle" style={{fontSize:'10px',fontWeight:'bold'}}>
|
|
251
|
+
{transition.data}
|
|
252
|
+
</text>
|
|
253
|
+
</g>
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
static renderTransitionDiff(fromState, toState, currentOut, currentIn, outPoint, inPoint, positionData, transition, titleHeight) {
|
|
258
|
+
if(1 === Math.abs(positionData.xDiff)) {
|
|
259
|
+
return ComponentImageStateMachine.renderTransitionDiffStep(fromState, toState, currentOut, currentIn, outPoint, inPoint, positionData, transition, titleHeight);
|
|
260
|
+
}
|
|
261
|
+
else if(1 === Math.abs(positionData.yDiff)) {
|
|
262
|
+
return ComponentImageStateMachine.renderTransitionDiffSteps1Y(fromState, toState, currentOut, currentIn, outPoint, inPoint, positionData, transition, titleHeight);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
return ComponentImageStateMachine.renderTransitionDiffStepsMY(fromState, toState, currentOut, currentIn, outPoint, inPoint, positionData, transition, titleHeight);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
static renderTransitionEqLine(fromState, toState, currentOut, currentIn, outPoint, inPoint, positionData, transition, titleHeight) {
|
|
270
|
+
const q = ComponentImageStateMachine._q1(outPoint.x, inPoint.x, outPoint.y, inPoint.y, positionData.topDirX, positionData.topDirY);
|
|
271
|
+
const d = ['M', outPoint.x, outPoint.y, 'Q', q.xt, q.yt , inPoint.x, inPoint.y].join(' ');
|
|
272
|
+
const angle = ComponentImageStateMachine._angleQuadraticBezier(q.xt, q.yt, inPoint.x, inPoint.y, positionData);
|
|
273
|
+
const translateArrow = `translate(${inPoint.x}, ${inPoint.y}) rotate(${(Math.PI + angle) * 180 / Math.PI})`;
|
|
274
|
+
return (
|
|
275
|
+
<g key={`key_${fromState.xIndex}_${fromState.yIndex}_${toState.xIndex}_${toState.yIndex}_${currentOut}_${currentIn}`}>
|
|
276
|
+
<path className={`markup_state_${transition.type}`} d={d} />
|
|
277
|
+
<polygon points={ComponentImageStateMachine.ARROW} transform={translateArrow} />
|
|
278
|
+
<text x={q.xt} y={q.yt + 5} textAnchor="middle" style={{fontSize:'10px',fontWeight:'bold'}}>
|
|
279
|
+
{transition.data}
|
|
280
|
+
</text>
|
|
281
|
+
<circle cx={outPoint.x} cy={outPoint.y} r="2" stroke="black" strokeWidth="1" fill="red" />
|
|
282
|
+
<circle cx={inPoint.x} cy={inPoint.y} r="2" stroke="black" strokeWidth="1" fill="red" />
|
|
283
|
+
{/*<circle cx={q.xb} cy={q.yb} r="2" stroke="black" strokeWidth="1" fill="yellow" />
|
|
284
|
+
<circle cx={q.xm} cy={q.ym} r="2" stroke="black" strokeWidth="1" fill="green" />
|
|
285
|
+
<circle cx={q.xt} cy={q.yt} r="2" stroke="black" strokeWidth="1" fill="blue" />*/}
|
|
286
|
+
</g>
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
static renderTransitionXGtYGt(fromState, toState, currentOut, currentIn, outPoint, inPoint, transition, titleHeight) {
|
|
291
|
+
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
calculatePoint(position, state, titleHeight) {
|
|
295
|
+
const left = ComponentImageStateMachine.BIAS_X + state.xIndex * (ComponentImageStateMachine.STATE_DIST_WIDTH + ComponentImageStateMachine.STATE_WIDTH);
|
|
296
|
+
const top = titleHeight + ComponentImageStateMachine.BIAS_Y + state.yIndex * (ComponentImageStateMachine.STATE_HEIGHT + ComponentImageStateMachine.STATE_DIST_HEIGHT);
|
|
297
|
+
const bias = this.BIAS.get('state');
|
|
298
|
+
if(ComponentImageStateMachine.RIGHT === position) {
|
|
299
|
+
return {
|
|
300
|
+
x: left + ComponentImageStateMachine.POSITION_X[position] + bias.x,
|
|
301
|
+
y: top + ComponentImageStateMachine.POSITION_Y[position]
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
else if(ComponentImageStateMachine.LEFT === position) {
|
|
305
|
+
return {
|
|
306
|
+
x: left + ComponentImageStateMachine.POSITION_X[position] - bias.x,
|
|
307
|
+
y: top + ComponentImageStateMachine.POSITION_Y[position]
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
else if(ComponentImageStateMachine.TOP === position) {
|
|
311
|
+
return {
|
|
312
|
+
x: left + ComponentImageStateMachine.POSITION_X[position],
|
|
313
|
+
y: top + ComponentImageStateMachine.POSITION_Y[position] - bias.y
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
else if(ComponentImageStateMachine.BOTTOM === position) {
|
|
317
|
+
return {
|
|
318
|
+
x: left + ComponentImageStateMachine.POSITION_X[position],
|
|
319
|
+
y: top + ComponentImageStateMachine.POSITION_Y[position] + bias.y
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
return {
|
|
324
|
+
x: left + ComponentImageStateMachine.POSITION_X[position],
|
|
325
|
+
y: top + ComponentImageStateMachine.POSITION_Y[position]
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
calculatePosition(fromState, toState, rows, columns) {
|
|
331
|
+
const xDiff = toState.xIndex - fromState.xIndex;
|
|
332
|
+
const yDiff = toState.yIndex - fromState.yIndex;
|
|
333
|
+
const diff = [fromState.xIndex - toState.xIndex, fromState.yIndex - toState.yIndex];
|
|
334
|
+
const direction = [xDiff > 0 ? ComponentImageStateMachine.DIRECTION_X_EAST : (xDiff < 0 ? ComponentImageStateMachine.DIRECTION_X_WEST : ComponentImageStateMachine.DIRECTION_X_NONE), yDiff > 0 ? ComponentImageStateMachine.DIRECTION_Y_SOUTH : (yDiff < 0 ? ComponentImageStateMachine.DIRECTION_Y_NORTH : ComponentImageStateMachine.DIRECTION_Y_NONE)];
|
|
335
|
+
const xOrientation = fromState.xIndex < columns / 2 ? ComponentImageStateMachine.ORIENTATION_X_LEFT : ComponentImageStateMachine.ORIENTATION_X_RIGHT;
|
|
336
|
+
const yOrientation = fromState.yIndex < rows / 2 ? ComponentImageStateMachine.ORIENTATION_Y_TOP : ComponentImageStateMachine.ORIENTATION_Y_BOTTOM;
|
|
337
|
+
const positionData = ComponentImageStateMachine.POSITION_LOG[xOrientation][yOrientation][direction[0]][direction[1]];
|
|
338
|
+
return {
|
|
339
|
+
angle: positionData.angle,
|
|
340
|
+
topDirX: positionData.topDirX,
|
|
341
|
+
topDirY: positionData.topDirY,
|
|
342
|
+
topDirX2: positionData.topDirX2,
|
|
343
|
+
topDirY2: positionData.topDirY2,
|
|
344
|
+
from: positionData.from,
|
|
345
|
+
to: positionData.to,
|
|
346
|
+
diff: diff,
|
|
347
|
+
xOrientation: xOrientation,
|
|
348
|
+
yOrientation: yOrientation,
|
|
349
|
+
direction: direction,
|
|
350
|
+
xDiff: xDiff,
|
|
351
|
+
yDiff: yDiff,
|
|
352
|
+
func: positionData.func,
|
|
353
|
+
log: positionData.log
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
renderTransition(fromState, toState, transition, rows, columns, titleHeight) {
|
|
358
|
+
const positionData = this.calculatePosition(fromState, toState, rows, columns);
|
|
359
|
+
const currentOut = fromState.currentOut++;
|
|
360
|
+
const currentIn = toState.currentIn++;
|
|
361
|
+
const outPoint = this.calculatePoint(positionData.from, fromState, titleHeight);
|
|
362
|
+
const inPoint = this.calculatePoint(positionData.to, toState, titleHeight);
|
|
363
|
+
if(positionData && !transition.comment) {
|
|
364
|
+
|
|
365
|
+
}
|
|
366
|
+
if(positionData.func && !transition.comment) {
|
|
367
|
+
return positionData.func(fromState, toState, currentOut, currentIn, outPoint, inPoint, positionData, transition, titleHeight);
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
return null;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
renderTransitions(transitions, stateMap, rows, columns, titleHeight) {
|
|
375
|
+
return transitions.map((transition, index) => {
|
|
376
|
+
if('' !== transition.fromStateName && '' !== transition.toStateName) {
|
|
377
|
+
const fromState = stateMap.get(transition.fromStateName);
|
|
378
|
+
const toState = stateMap.get(transition.toStateName);
|
|
379
|
+
return this.renderTransition(fromState, toState, transition, rows, columns, titleHeight);
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
render() {
|
|
385
|
+
const title = this.props.stateMachine.title;
|
|
386
|
+
const stateRows = this.props.stateMachine.stateRows;
|
|
387
|
+
const transitions = this.props.stateMachine.transitions;
|
|
388
|
+
const rows = stateRows.length;
|
|
389
|
+
let columns = 0;
|
|
390
|
+
const stateMap = new Map();
|
|
391
|
+
stateRows.forEach((states, yIndex) => {
|
|
392
|
+
states.forEach((state, xIndex) => {
|
|
393
|
+
stateMap.set(state.name, {
|
|
394
|
+
xIndex: xIndex,
|
|
395
|
+
yIndex: yIndex,
|
|
396
|
+
in: state.in,
|
|
397
|
+
out: state.out,
|
|
398
|
+
currentIn: 0,
|
|
399
|
+
currentOut: 0,
|
|
400
|
+
type: state.type
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
if(states.length > columns) {
|
|
404
|
+
columns = states.length;
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
const titleHeight = ('' !== title && undefined !== title) ? ComponentImageStateMachine.TITLE_HEIGHT : 0;
|
|
408
|
+
const stateHeight = ComponentImageStateMachine.BIAS_Y + stateRows.length * ComponentImageStateMachine.STATE_HEIGHT + (stateRows.length - 1) * ComponentImageStateMachine.STATE_DIST_HEIGHT;
|
|
409
|
+
const svgHeight = titleHeight + stateHeight + ComponentImageStateMachine.BIAS_X;
|
|
410
|
+
const svgWidth = 2 * ComponentImageStateMachine.BIAS_X + columns * ComponentImageStateMachine.STATE_WIDTH + (columns - 1) * ComponentImageStateMachine.STATE_DIST_WIDTH;
|
|
411
|
+
const viewBox = [0, 0, svgWidth, svgHeight].join(' ');
|
|
412
|
+
return (
|
|
413
|
+
<svg className="markup_state" width={svgWidth} height={svgHeight} viewBox={viewBox} >
|
|
414
|
+
{/* <rect className="markup_state" x={0} y={titleHeight} width={svgWidth} height={svgHeight - titleHeight} /> */}
|
|
415
|
+
{this.renderTitle(title, svgWidth / 2)}
|
|
416
|
+
{this.renderStates(stateRows, titleHeight)}
|
|
417
|
+
{this.renderTransitions(transitions, stateMap, rows, columns, titleHeight)}
|
|
418
|
+
</svg>
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
static _q1(x1, x2, y1, y2, topDirX, topDirY) {
|
|
423
|
+
const hypo = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
|
|
424
|
+
const angle = Math.acos((x2 - x1) / hypo);
|
|
425
|
+
const xb = (Math.max(x1, x2) - Math.min(x1, x2)) / 2 + Math.min(x1, x2);
|
|
426
|
+
const yb = (Math.max(y1, y2) - Math.min(y1, y2)) / 2 + Math.min(y1, y2);
|
|
427
|
+
const sinX = Math.sin(Math.PI - angle);
|
|
428
|
+
const cosY = Math.cos(Math.PI - angle);
|
|
429
|
+
const xt = xb + topDirX * ComponentImageStateMachine.STATE_DIST_WIDTH_TOP * sinX;
|
|
430
|
+
const yt = yb + topDirY * ComponentImageStateMachine.STATE_DIST_HEIGHT_TOP * cosY;
|
|
431
|
+
return {
|
|
432
|
+
xb: xb,
|
|
433
|
+
yb: yb,
|
|
434
|
+
xm: xt - (xt - xb) / 2,
|
|
435
|
+
ym: yt - (yt - yb) / 2,
|
|
436
|
+
xt: xt,
|
|
437
|
+
yt: yt
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
static _q2(x1, x2, y1, y2, topDirX, topDirY) {
|
|
442
|
+
const hypo = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
|
|
443
|
+
const angle = Math.acos((x2 - x1) / hypo);
|
|
444
|
+
const xb = (Math.max(x1, x2) - Math.min(x1, x2)) / 2 + Math.min(x1, x2);
|
|
445
|
+
const yb = (Math.max(y1, y2) - Math.min(y1, y2)) / 2 + Math.min(y1, y2);
|
|
446
|
+
const sinX = Math.sin(Math.PI - angle);
|
|
447
|
+
const cosY = Math.cos(Math.PI - angle);
|
|
448
|
+
const xt = 1 === topDirX ? Math.max(x1, x2) : Math.min(x1, x2);
|
|
449
|
+
const yt = -1 === topDirY ? Math.max(y1, y2) : Math.min(y1, y2);
|
|
450
|
+
return {
|
|
451
|
+
xb: xb,
|
|
452
|
+
yb: yb,
|
|
453
|
+
xm: xt - (xt - xb) / 2,
|
|
454
|
+
ym: yt - (yt - yb) / 2,
|
|
455
|
+
xt: xt,
|
|
456
|
+
yt: yt
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
//
|
|
461
|
+
// /|
|
|
462
|
+
// c / | a
|
|
463
|
+
// / |
|
|
464
|
+
// ____
|
|
465
|
+
//
|
|
466
|
+
// b
|
|
467
|
+
static _q3(x1, x2, y1, y2, dir) {
|
|
468
|
+
const a1 = y2 - y1;
|
|
469
|
+
const b1 = x2 - x1;
|
|
470
|
+
const A = Math.atan(a1 / b1);
|
|
471
|
+
const B = ComponentImageStateMachine.MATH_PI_HALF - A;
|
|
472
|
+
|
|
473
|
+
const cosA = Math.cos(A);
|
|
474
|
+
const sinB = Math.sin(B);
|
|
475
|
+
const cosB = Math.cos(B);
|
|
476
|
+
const b2 = b1 * cosA;
|
|
477
|
+
const a2 = ComponentImageStateMachine.STATE_DIST_TOP_LENGTH / 3;
|
|
478
|
+
const xb = b2 * sinB;
|
|
479
|
+
const yb = b2 * cosB;
|
|
480
|
+
|
|
481
|
+
const b3 = a2 * Math.cos(B);
|
|
482
|
+
const a3 = a2 * Math.sin(A);
|
|
483
|
+
const xt = xb + dir * b3;
|
|
484
|
+
const yt = yb - dir * a3;
|
|
485
|
+
|
|
486
|
+
return {
|
|
487
|
+
xb: x1 + xb,
|
|
488
|
+
yb: y1 + yb,
|
|
489
|
+
xm: xt - (xt - xb) / 2,
|
|
490
|
+
ym: yt - (yt - yb) / 2,
|
|
491
|
+
xt: x1 + xt,
|
|
492
|
+
yt: y1 + yt
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
static _angleQuadraticBezier(xControl, yControl, xStop, yStop, positionData) {
|
|
497
|
+
const a = yStop - yControl;
|
|
498
|
+
const b = xStop - xControl;
|
|
499
|
+
const A = Math.atan(a/b);
|
|
500
|
+
return A + positionData.angle;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
ComponentImageStateMachine.MATH_PI_TO_GRADES = 180 / Math.PI;
|
|
505
|
+
ComponentImageStateMachine.MATH_PI_HALF = Math.PI / 2;
|
|
506
|
+
|
|
507
|
+
ComponentImageStateMachine.TITLE_HEIGHT = 60;
|
|
508
|
+
ComponentImageStateMachine.TITLE_FONT_SIZE = 20;
|
|
509
|
+
ComponentImageStateMachine.TITLE_TOP = ComponentImageStateMachine.TITLE_FONT_SIZE + (ComponentImageStateMachine.TITLE_HEIGHT - ComponentImageStateMachine.TITLE_FONT_SIZE) / 2;
|
|
510
|
+
ComponentImageStateMachine.BIAS_X = 50;
|
|
511
|
+
ComponentImageStateMachine.BIAS_Y = 30;
|
|
512
|
+
ComponentImageStateMachine.STATE_AREA_WIDTH = 180;
|
|
513
|
+
ComponentImageStateMachine.STATE_AREA_HEIGHT = 100;
|
|
514
|
+
ComponentImageStateMachine.STATE_WIDTH = 90;
|
|
515
|
+
ComponentImageStateMachine.STATE_HEIGHT = 40;
|
|
516
|
+
ComponentImageStateMachine.STATE_WIDTH_HALF = ComponentImageStateMachine.STATE_WIDTH / 2;
|
|
517
|
+
ComponentImageStateMachine.STATE_HEIGHT_HALF = ComponentImageStateMachine.STATE_HEIGHT / 2;
|
|
518
|
+
ComponentImageStateMachine.STATE_DIST_WIDTH = ComponentImageStateMachine.STATE_AREA_WIDTH - ComponentImageStateMachine.STATE_WIDTH;
|
|
519
|
+
ComponentImageStateMachine.STATE_DIST_HEIGHT = ComponentImageStateMachine.STATE_AREA_HEIGHT - ComponentImageStateMachine.STATE_HEIGHT;
|
|
520
|
+
ComponentImageStateMachine.STATE_DIST_TOP_LENGTH = Math.sqrt(Math.pow(ComponentImageStateMachine.STATE_WIDTH_HALF, 2), Math.pow(ComponentImageStateMachine.STATE_DIST_HEIGHT_HALF, 2));
|
|
521
|
+
ComponentImageStateMachine.STATE_DIST_WIDTH_HALF = ComponentImageStateMachine.STATE_DIST_WIDTH / 2;
|
|
522
|
+
ComponentImageStateMachine.STATE_DIST_HEIGHT_HALF = ComponentImageStateMachine.STATE_DIST_HEIGHT / 2;
|
|
523
|
+
ComponentImageStateMachine.STATE_DIST_WIDTH_THIRD = ComponentImageStateMachine.STATE_DIST_WIDTH / 3;
|
|
524
|
+
ComponentImageStateMachine.STATE_DIST_HEIGHT_THIRD = ComponentImageStateMachine.STATE_DIST_HEIGHT / 3;
|
|
525
|
+
ComponentImageStateMachine.STATE_DIST_MIN = Math.min(ComponentImageStateMachine.STATE_DIST_WIDTH_HALF, ComponentImageStateMachine.STATE_DIST_HEIGHT_HALF); // TODO: REMOVE
|
|
526
|
+
ComponentImageStateMachine.STATE_DIST_WIDTH_TOP = ComponentImageStateMachine.STATE_DIST_WIDTH * 2 / 5;
|
|
527
|
+
ComponentImageStateMachine.STATE_DIST_HEIGHT_TOP = ComponentImageStateMachine.STATE_DIST_HEIGHT * 2 / 5;
|
|
528
|
+
ComponentImageStateMachine.STATE_FONT_SIZE = 12;
|
|
529
|
+
ComponentImageStateMachine.ARROW = [-10, 3, 0, 0, -10, -3].join(' ');
|
|
530
|
+
ComponentImageStateMachine.HALF_PI = Math.PI / 2;
|
|
531
|
+
|
|
532
|
+
ComponentImageStateMachine.TOP = 0;
|
|
533
|
+
ComponentImageStateMachine.RIGHT = 1;
|
|
534
|
+
ComponentImageStateMachine.BOTTOM = 2;
|
|
535
|
+
ComponentImageStateMachine.LEFT = 3;
|
|
536
|
+
ComponentImageStateMachine.POSITION_X = [ComponentImageStateMachine.STATE_WIDTH_HALF, ComponentImageStateMachine.STATE_WIDTH, ComponentImageStateMachine.STATE_WIDTH_HALF, 0];
|
|
537
|
+
ComponentImageStateMachine.POSITION_Y = [0, ComponentImageStateMachine.STATE_HEIGHT_HALF, ComponentImageStateMachine.STATE_HEIGHT, ComponentImageStateMachine.STATE_HEIGHT_HALF];
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
ComponentImageStateMachine.ORIENTATION_X = 0;
|
|
541
|
+
ComponentImageStateMachine.ORIENTATION_Y = 1;
|
|
542
|
+
ComponentImageStateMachine.ORIENTATION_X_LEFT = 0;
|
|
543
|
+
ComponentImageStateMachine.ORIENTATION_X_RIGHT = 1;
|
|
544
|
+
ComponentImageStateMachine.ORIENTATION_Y_TOP = 0;
|
|
545
|
+
ComponentImageStateMachine.ORIENTATION_Y_BOTTOM = 1;
|
|
546
|
+
ComponentImageStateMachine.ORIENTATION_LOG = [['LEFT_TOP', 'LEFT_BOTTOM'], ['RIGHT_BOTTOM', 'RIGHT_TOP']];
|
|
547
|
+
|
|
548
|
+
ComponentImageStateMachine.DIRECTION_X_NONE = 0;
|
|
549
|
+
ComponentImageStateMachine.DIRECTION_X_WEST = 1;
|
|
550
|
+
ComponentImageStateMachine.DIRECTION_X_EAST = 2;
|
|
551
|
+
ComponentImageStateMachine.DIRECTION_Y_NONE = 0;
|
|
552
|
+
ComponentImageStateMachine.DIRECTION_Y_NORTH = 1;
|
|
553
|
+
ComponentImageStateMachine.DIRECTION_Y_SOUTH = 2;
|
|
554
|
+
ComponentImageStateMachine.DIRECTION_LOG = [['NONE_NONE', 'NONE_NORTH', 'NONE_SOUTH'], ['WEST_NONE', 'WEST_NORTH', 'WEST_SOUTH'], ['EAST_NONE', 'EAST_NORTH', 'EAST_SOUTH']];
|
|
555
|
+
|
|
556
|
+
// ORIENTATION_X
|
|
557
|
+
// ORIENTATION_Y
|
|
558
|
+
// DIRECTION_X
|
|
559
|
+
// DIRECTION_Y
|
|
560
|
+
ComponentImageStateMachine.POSITION_LOG = [
|
|
561
|
+
[
|
|
562
|
+
[
|
|
563
|
+
[
|
|
564
|
+
{log:'LEFT_TOP_NONE_NONE'},
|
|
565
|
+
{log:'LEFT_TOP_NONE_NORTH',from:ComponentImageStateMachine.RIGHT,to:ComponentImageStateMachine.RIGHT,angle:0,topDirX:1,topDirY:1,func:ComponentImageStateMachine.renderTransitionEqLine},
|
|
566
|
+
{log:'LEFT_TOP_NONE_SOUTH',from:ComponentImageStateMachine.LEFT,to:ComponentImageStateMachine.LEFT,angle:Math.PI,topDirX:-1,topDirY:1,func:ComponentImageStateMachine.renderTransitionEqLine},
|
|
567
|
+
],
|
|
568
|
+
[
|
|
569
|
+
{log:'LEFT_TOP_WEST_NONE',from:ComponentImageStateMachine.BOTTOM,to:ComponentImageStateMachine.BOTTOM,angle:0,topDirX:1,topDirY:1,func:ComponentImageStateMachine.renderTransitionEqLine},
|
|
570
|
+
{log:'LEFT_TOP_WEST_NORTH'},
|
|
571
|
+
{log:'LEFT_TOP_WEST_SOUTH'}
|
|
572
|
+
],
|
|
573
|
+
[
|
|
574
|
+
{log:'LEFT_TOP_EAST_NONE',from:ComponentImageStateMachine.TOP,to:ComponentImageStateMachine.TOP,angle:Math.PI,topDirX:1,topDirY:1,func:ComponentImageStateMachine.renderTransitionEqLine},
|
|
575
|
+
{log:'LEFT_TOP_EAST_NORTH',from:ComponentImageStateMachine.RIGHT,to:ComponentImageStateMachine.LEFT,angle:0,topDirX:1,topDirY:-1,topDirX2:-1,topDirY2:1,func:ComponentImageStateMachine.renderTransitionDiff},
|
|
576
|
+
{log:'LEFT_TOP_EAST_SOUTH',from:ComponentImageStateMachine.RIGHT,to:ComponentImageStateMachine.LEFT,angle:0,topDirX:1,topDirY:1,topDirX2:-1,topDirY2:-1,func:ComponentImageStateMachine.renderTransitionDiff}
|
|
577
|
+
]
|
|
578
|
+
],
|
|
579
|
+
[
|
|
580
|
+
[
|
|
581
|
+
{log:'LEFT_BOTTOM_NONE_NONE'},
|
|
582
|
+
{log:'LEFT_BOTTOM_NONE_NORTH',from:ComponentImageStateMachine.RIGHT,to:ComponentImageStateMachine.RIGHT,angle:0,topDirX:1,topDirY:1,func:ComponentImageStateMachine.renderTransitionEqLine},
|
|
583
|
+
{log:'LEFT_BOTTOM_NONE_SOUTH',from:ComponentImageStateMachine.LEFT,to:ComponentImageStateMachine.LEFT,angle:Math.PI,topDirX:-1,topDirY:1,func:ComponentImageStateMachine.renderTransitionEqLine}
|
|
584
|
+
],
|
|
585
|
+
[
|
|
586
|
+
{log:'LEFT_BOTTOM_WEST_NONE',from:ComponentImageStateMachine.TOP,to:ComponentImageStateMachine.TOP,angle:0,topDirX:1,topDirY:-1,func:ComponentImageStateMachine.renderTransitionEqLine},
|
|
587
|
+
{log:'LEFT_BOTTOM_WEST_NORTH'},
|
|
588
|
+
{log:'LEFT_BOTTOM_WEST_SOUTH'}
|
|
589
|
+
],
|
|
590
|
+
[
|
|
591
|
+
{log:'LEFT_BOTTOM_EAST_NONE',from:ComponentImageStateMachine.BOTTOM,to:ComponentImageStateMachine.BOTTOM,angle:Math.PI,topDirX:1,topDirY:-1,func:ComponentImageStateMachine.renderTransitionEqLine},
|
|
592
|
+
{log:'LEFT_BOTTOM_EAST_NORTH',from:ComponentImageStateMachine.RIGHT,to:ComponentImageStateMachine.LEFT,angle:0,topDirX:1,topDirY:-1,topDirX2:-1,topDirY2:1,func:ComponentImageStateMachine.renderTransitionDiff},
|
|
593
|
+
{log:'LEFT_BOTTOM_EAST_SOUTH'}
|
|
594
|
+
]
|
|
595
|
+
]
|
|
596
|
+
],
|
|
597
|
+
[
|
|
598
|
+
[
|
|
599
|
+
[
|
|
600
|
+
{log:'RIGHT_TOP_NONE_NONE'},
|
|
601
|
+
{log:'RIGHT_TOP_NONE_NORTH',from:ComponentImageStateMachine.LEFT,to:ComponentImageStateMachine.LEFT,angle:Math.PI,topDirX:-1,topDirY:1,func:ComponentImageStateMachine.renderTransitionEqLine},
|
|
602
|
+
{log:'RIGHT_TOP_NONE_SOUTH',from:ComponentImageStateMachine.RIGHT,to:ComponentImageStateMachine.RIGHT,angle:0,topDirX:1,topDirY:1,func:ComponentImageStateMachine.renderTransitionEqLine},
|
|
603
|
+
],
|
|
604
|
+
[
|
|
605
|
+
{log:'RIGHT_TOP_WEST_NONE',from:ComponentImageStateMachine.BOTTOM,to:ComponentImageStateMachine.BOTTOM,angle:0,topDirX:1,topDirY:1,func:ComponentImageStateMachine.renderTransitionEqLine},
|
|
606
|
+
{log:'RIGHT_TOP_WEST_NORTH'},
|
|
607
|
+
{log:'RIGHT_TOP_WEST_SOUTH'}
|
|
608
|
+
],
|
|
609
|
+
[
|
|
610
|
+
{log:'RIGHT_TOP_EAST_NONE',from:ComponentImageStateMachine.TOP,to:ComponentImageStateMachine.TOP,angle:Math.PI,topDirX:1,topDirY:1,func:ComponentImageStateMachine.renderTransitionEqLine},
|
|
611
|
+
{log:'RIGHT_TOP_EAST_NORTH'},
|
|
612
|
+
{log:'RIGHT_TOP_EAST_SOUTH',from:ComponentImageStateMachine.RIGHT,to:ComponentImageStateMachine.LEFT,angle:0,topDirX:1,topDirY:1,topDirX2:-1,topDirY2:-1,func:ComponentImageStateMachine.renderTransitionDiff}
|
|
613
|
+
]
|
|
614
|
+
],
|
|
615
|
+
[
|
|
616
|
+
[
|
|
617
|
+
{log:'RIGHT_BOTTOM_NONE_NONE'},
|
|
618
|
+
{log:'RIGHT_BOTTOM_NONE_NORTH',from:ComponentImageStateMachine.LEFT,to:ComponentImageStateMachine.LEFT,angle:Math.PI,topDirX:-1,topDirY:1,func:ComponentImageStateMachine.renderTransitionEqLine},
|
|
619
|
+
{log:'RIGHT_BOTTOM_NONE_SOUTH',from:ComponentImageStateMachine.RIGHT,to:ComponentImageStateMachine.RIGHT,angle:0,topDirX:1,topDirY:1,func:ComponentImageStateMachine.renderTransitionEqLine}
|
|
620
|
+
],
|
|
621
|
+
[
|
|
622
|
+
{log:'RIGHT_BOTTOM_WEST_NONE',from:ComponentImageStateMachine.TOP,to:ComponentImageStateMachine.TOP,angle:0,topDirX:1,topDirY:-1,func:ComponentImageStateMachine.renderTransitionEqLine},
|
|
623
|
+
{log:'RIGHT_BOTTOM_WEST_NORTH'},
|
|
624
|
+
{log:'RIGHT_BOTTOM_WEST_SOUTH'}
|
|
625
|
+
],
|
|
626
|
+
[
|
|
627
|
+
{log:'RIGHT_BOTTOM_EAST_NONE',from:ComponentImageStateMachine.BOTTOM,to:ComponentImageStateMachine.BOTTOM,angle:Math.PI,topDirX:1,topDirY:-1,func:ComponentImageStateMachine.renderTransitionEqLine},
|
|
628
|
+
{log:'RIGHT_BOTTOM_EAST_NORTH'},
|
|
629
|
+
{log:'RIGHT_BOTTOM_EAST_SOUTH'}
|
|
630
|
+
]
|
|
631
|
+
],
|
|
632
|
+
]
|
|
633
|
+
];
|