This commit is contained in:
Horldsence
2026-09-13 10:27:09 +08:00
parent b810ec7777
commit 82311a47cc
52 changed files with 2563 additions and 1278 deletions
+65
View File
@@ -0,0 +1,65 @@
function fig_flow_overall()
%FIG_FLOW_OVERALL 四层主线:题面抽象(L0)、在线三层(L1)、四问主线(L2)、三条闭环(L3)。
% 仅保留分层框图与层标签,图内不放任何说明性文字。
S = fig_style();
D = load_data(S, 'flow_overall');
H = geom_helpers();
fig = figure('Color', 'w', 'Visible', 'off');
ax = axes(fig, 'Position', [0.02 0.06 0.96 0.90], ...
'XLim', [0 100], 'YLim', [0 100], 'Visible', 'off');
hold(ax, 'on');
n = numel(D.tags);
x_tag = 7; % 层标签中心
x_lo = 15; x_hi = 99; % 框体水平范围
box_gap = 2.2; % 框间距(放箭头)
pad = 1.4; % 框内左右留白
band_h = 14; % 层高
band_gap = 6.5;
y_top = 96;
% 统一字号:逐行按量得的文本宽度试算,保证一排框加间距放得下
fs = ax.FontSize;
while fs > 8
need_max = 0;
for b = 1:n
labels = D.labels{b};
m = numel(labels);
need = sum(cellfun(@(s) H.text_width(ax, s, fs), labels)) ...
+ 2 * pad * m + box_gap * (m - 1);
need_max = max(need_max, need);
end
if need_max <= x_hi - x_lo
break;
end
fs = fs - 0.5;
end
for b = 1:n
labels = D.labels{b};
m = numel(labels);
tw = cellfun(@(s) H.text_width(ax, s, fs), labels);
avail = (x_hi - x_lo) - box_gap * (m - 1);
w = (tw + 2 * pad) * avail / sum(tw + 2 * pad);
y = y_top - band_h - (b - 1) * (band_h + band_gap);
color = pick_color(S, D.colors{b});
text(ax, x_tag, y + band_h / 2, D.tags{b}, 'FontSize', fs + 1, ...
'HorizontalAlignment', 'center', 'VerticalAlignment', 'middle');
x = x_lo;
for i = 1:m
rectangle(ax, 'Position', [x, y, w(i), band_h], 'FaceColor', 'w', ...
'EdgeColor', color, 'LineWidth', 1.1);
text(ax, x + w(i) / 2, y + band_h / 2, labels{i}, 'FontSize', fs, ...
'HorizontalAlignment', 'center', 'VerticalAlignment', 'middle', ...
'Interpreter', 'none');
if i < m
H.arrow(ax, [x + w(i) + 0.25, y + band_h / 2], ...
[x + w(i) + box_gap - 0.25, y + band_h / 2], color);
end
x = x + w(i) + box_gap;
end
end
hold(ax, 'off');
fig_save(fig, S, 'flow-overall-architecture.png');
end