我怎样才能使生命线更清晰、更明显?如果我打印图表,它就不太明显。另一种可能性是,如果我将所有线条的颜色改为黑色。但我认为这是默认的。欢迎所有想法和方法。
这是我的 tex 文件:
\documentclass[a4paper,12pt,onecolumn,oneside, parskip=full]{article}
\usepackage[left=4cm,top=2cm,right=3cm,bottom=2cm]{geometry}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{tikz-uml}
\usepackage{tikzscale}
\begin{document}
Sequencediagram is shown in figure 1.
\begin{figure}[!h]
\centering
\resizebox{\linewidth}{!}{\includegraphics{seq_workflow.tikz}}
\caption[sequencediagram]{sequencediagram}
\vspace{-0.2cm}
\end{figure}
\end{document}
这是我的图表文件:
\begin{tikzpicture}
\begin{umlseqdiag}
\umlactor[no ddots, x=0, y=0, scale=0.5, fill={white}]{user}
\umlbasicobject[x=3, fill={green}]{object1}
\umlobject[x=6, no ddots, fill={green}]{object2}
\umlbasicobject[x=11, fill={green}]{object3}
\umlbasicobject[x=17, fill={green}]{object4}
\umlactor[no ddots, x=19, y=0, scale=0.5, fill={white}]{user2}
\begin{umlcall}[dt=8, op=\shortstack{do something}, type=synchron, return=ready]{user}{object1}
\begin{umlcall}[dt=4, op=\shortstack{message}, type=synchron, return=received, padding=3]{object1}{object4}
\end{umlcall}
\begin{umlcall}[op=\shortstack{message}, type=synchron, return=received, padding=3]{object1}{object2}
\end{umlcall}
\end{umlcall}
\begin{umlcall}[op=new entry, type=asynchron]{object2}{object2}
\end{umlcall}
\begin{umlcall}[dt=30, op=request, type=synchron, return=entry, padding=3]{user2}{object3}
\begin{umlcall}[dt=4, op=request, type=synchron, return=response]{object3}{object2}
\begin{umlcall}[dt=4, op=request, type=asynchron]{object2}{object2}
\end{umlcall}
\end{umlcall}
\end{umlcall}
\umlsdnode[dt=23]{user}
\umlsdnode[dt=23]{object1}
\umlsdnode[dt=3]{object2}
\umlsdnode[dt=32]{object4}
\end{umlseqdiag}
\end{tikzpicture}
答案1
我找到了一个解决方案。现在我可以打印更好的图表版本了。我更改了 tikz-uml.sty 中的第 3854 行(我添加了一个参数:非常厚)旧块:
{%
% draw lifelines of each object
\begin{pgfonlayer}{lifelines}%
\foreach \id in \tikzumlIdList {%
\draw (\csname tikzumlLastChild@\id \endcsname)+(0,-2.5ex) node[inner sep=0, name=end-\id] {};%
\draw[dotted] (\id) -- (end-\id);%
}%
\end{pgfonlayer}%
\end{scope}%
}%
改变的区块:
{%
% draw lifelines of each object
\begin{pgfonlayer}{lifelines}%
\foreach \id in \tikzumlIdList {%
\draw (\csname tikzumlLastChild@\id \endcsname)+(0,-2.5ex) node[inner sep=0, name=end-\id] {};%
\draw[very thick, dotted] (\id) -- (end-\id);%
}%
\end{pgfonlayer}%
\end{scope}%
}%
@cfr:如果我加载图片时没有它,latex 就无法使用 \includegraphics 读取 tikz 文件。打印后的图片有点小,但我必须使用 A4 作为纸张尺寸。谢谢大家的建议。