![pgf-umlsd:围绕右对齐调用的 sdblock(多线程)](https://linux22.com/image/416583/pgf-umlsd%EF%BC%9A%E5%9B%B4%E7%BB%95%E5%8F%B3%E5%AF%B9%E9%BD%90%E8%B0%83%E7%94%A8%E7%9A%84%20sdblock%EF%BC%88%E5%A4%9A%E7%BA%BF%E7%A8%8B%EF%BC%89.png)
我有这段文本片段......
\documentclass{article}
\usepackage{pgf-umlsd}
\usepackage[a1paper,portrait]{geometry}
\usepackage{float}
\begin{document}
\section{Use Case 1: Imbalance Settlement and Resistors}
\begin{figure}[H]
\centering
\begin{sequencediagram}
\tikzstyle{inststyle}+=[bottom color=white, top color=white]
\newthread{ecp}{:ECP}{}
\newinst[1]{eap}{:EAP}{}
\newinst[1]{stream}{:STREAM}{}
%\newinst[1]{db}{:DATABASE}{}
\newinst[1]{spf}{:SPF}{}
\tikzstyle{inststyle}+=[bottom color=white, top color=white]
\newinst[1]{rtu}{:RTU}{}
\newthread{operator}{:OPERATOR}{}
\begin{sdblock}{loop}{[for each PTU]}
\begin{sdblock}{loop}{[continuous]}
\begin{call}{ecp}{getSPF}{stream}{SPF}
\begin{call}{stream}{getSPF}{spf}{SPF}
\end{call}
\postlevel
\end{call}
\prelevel \prelevel
setthreadbias{east}
\begin{call}{operator}{getSPF}{stream}{SPF}
\postlevel
\end{call}
\end{sdblock}
\end{sdblock}
\end{sequencediagram}
\end{figure}
\end{document}
问题:如何将 sdblock(或者另一个方块)放置在红色方块的位置?
答案1
pgf-umlsd
创建根据级别命名的各种节点。您可以使用这些节点以及一些手动调整来制作这样的框。例如,如果您添加,\usetikzlibrary{fit}
您可以使用
\node [fit=(cf1)(rt1),draw,red,very thick,inner ysep=2mm,yshift=1.5mm] {};
或者没有任何库:
\draw [red, very thick] ([shift={(10pt,11pt)}]cf1.north west) rectangle ([shift={(-10pt,-2pt)}]rt1.south east);
在 之前添加其中任一项\end{sequencediagram}
。
对于两个不同事物之间的 ,你会得到称为、和的call
节点,其中是一个整数。对于回到同一事物的 ,你会得到称为、和的节点。cfN
ctN
rfN
rtN
N
call
scN
scbN
sceN
sctN
\documentclass[border=5mm]{standalone}
\usepackage{pgf-umlsd}
\usetikzlibrary{fit}
\begin{document}
\begin{sequencediagram}
\tikzstyle{inststyle}+=[bottom color=white, top color=white]
\newthread{ecp}{:ECP}{}
\newinst[1]{eap}{:EAP}{}
\newinst[1]{stream}{:STREAM}{}
%\newinst[1]{db}{:DATABASE}{}
\newinst[1]{spf}{:SPF}{}
\tikzstyle{inststyle}+=[bottom color=white, top color=white]
\newinst[1]{rtu}{:RTU}{}
\newthread{operator}{:OPERATOR}{}
\begin{sdblock}{loop}{[for each PTU]}
\begin{sdblock}{loop}{[continuous]}
\begin{call}{ecp}{getSPF}{stream}{SPF}
\begin{call}{stream}{getSPF}{spf}{SPF}
\end{call}
\postlevel
\end{call}
\prelevel \prelevel
setthreadbias{east}
\begin{call}{operator}{getSPF}{stream}{SPF}
\postlevel
\end{call}
\end{sdblock}
\end{sdblock}
\node [fit=(cf1)(rt1),draw,red,very thick,inner ysep=2mm,yshift=1.5mm] {};
%\draw [red, very thick] ([shift={(10pt,11pt)}]cf1.north west) rectangle ([shift={(-10pt,-2pt)}]rt1.south east);
\end{sequencediagram}
\end{document}