35 lines
1.2 KiB
Matlab
35 lines
1.2 KiB
Matlab
function fig_steps_state_machine()
|
|
%FIG_STEPS_STATE_MACHINE 会话状态机:IDLE → 倒计时 → OPEN → CLOSED。
|
|
% 只画状态框与迁移箭头,图内不放任何说明性文字。
|
|
|
|
S = fig_style();
|
|
D = load_data(S, 'steps_state_machine');
|
|
H = geom_helpers();
|
|
fig = figure('Color', 'w', 'Visible', 'off', 'Position', [100 100 900 240]);
|
|
ax = axes(fig, 'Position', [0.02 0.10 0.96 0.80], ...
|
|
'XLim', [0 100], 'YLim', [0 100], 'Visible', 'off');
|
|
hold(ax, 'on');
|
|
|
|
n = numel(D.labels);
|
|
w = 21;
|
|
gap = 4.0;
|
|
x0 = (100 - (n * w + (n - 1) * gap)) / 2;
|
|
y0 = 25;
|
|
h = 50;
|
|
for i = 1:n
|
|
x = x0 + (i - 1) * (w + gap);
|
|
color = pick_color(S, D.edges{i});
|
|
rectangle(ax, 'Position', [x, y0, w, h], 'FaceColor', 'w', ...
|
|
'EdgeColor', color, 'LineWidth', 1.2);
|
|
text(ax, x + w / 2, y0 + h / 2, D.labels{i}, ...
|
|
'HorizontalAlignment', 'center', 'VerticalAlignment', 'middle', ...
|
|
'Interpreter', 'none');
|
|
if i < n
|
|
H.arrow(ax, [x + w + 0.5, y0 + h / 2], ...
|
|
[x + w + gap - 0.5, y0 + h / 2], color);
|
|
end
|
|
end
|
|
hold(ax, 'off');
|
|
fig_save(fig, S, 'steps-state-machine.png');
|
|
end
|