Tikz UML 相对定位问题

Tikz UML 相对定位问题

我尝试使用 tikz-uml 包来绘制状态图。我在状态定位方面遇到了很大麻烦。如果状态中有文本(例如在 state0 中),则似乎该状态的锚点已损坏。如果没有文本,它会按预期工作。另一个问题是父状态的大小。如果子状态中有文本,它就不适合子状态的大小。我希望有人能帮助我。

    \documentclass[a4paper,11pt, svgnames]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{Z:/Latex_lib/TikzUml/tikzuml-v1.0-2016-03-29/tikz-uml}


\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\begin{document}

\resizebox{\textwidth}{!}{
\begin{tikzpicture}
\begin{umlstate}[ x=0, y=0, name=swing]{swing}

%   \umlbasicstate[x=0, anchor= west, name=state0,  fill=white, 
%   %entry={vorgabe Getriebestellung},
%   ]{0}

    \begin{umlstate}[x=0, anchor= west, name=state0,  fill=white, 
    entry={vorgabe Getriebestellung},   
    ]{0}
    %\umlstatetext{test\\ lkjasdfklasd}
    \end{umlstate}

    \umlbasicstate[right=1.5cm of state0-body.east, anchor=west,
    name=state1,  fill=white]{1}
    \umlbasicstate[right=2.8cm of state1-body.east, anchor=west, name=state2,  fill=white,
    %entry = {servo\\ deaktivieren},
    %exit = {servo\\ aktivieren}
    ]{2}    


    \umlstatedecision [below right=2cm and 2cm of state1-body.south east, anchor = west, name=decision]

    \umltrans [anchor1=east, anchor2=west ]{state0}{state1}
    \umlVHtrans [anchor1 = south]{state1}{decision}
    \umlVHtrans[anchor2=east, arg={einstellung nicht erreicht}, text width = 1.2cm, pos=1.6]{decision}{state1}  
    \umlHVtrans [anchor2=-50, arg={einstellung erreicht}, text width = 1cm, pos=0.3]{decision}{state2}


\end{umlstate}

\umltrans[recursive=-150|-60|1cm, recursive direction=bottom to bottom]{swing}{swing}

\umlbasicstate[left=1cm of swing-body.south west, anchor=south east, name=lifterDown]{lifter down}
\umlbasicstate[right=1cm of swing-body.south east, anchor=south west, name=lifterUp]{lifter up}
\umlHVtrans [anchor1=east, anchor2=north, arg={Arm heben}, text width = 1cm,pos=0.6 ]{state2}{lifterUp}
\umlVHtrans [anchor1=north, anchor2=west, arg={unterer Endpunkt erreicht}, text width = 1cm,pos=1.4  ]{lifterDown}{state0}

\node [coordinate, left=0.5cm of lifterDown.west](in1){};
\node [coordinate, below=0.5cm of lifterDown.south](out1){};
\umltrans [anchor2=west ]{in1}{lifterDown}
\umltrans [anchor1=south]{lifterDown}{out1}

\node [coordinate, right=0.5cm of lifterUp.east](in2){};
\node [coordinate, below=0.5cm of lifterUp.south](out2){};
\umltrans [anchor2=east ]{in2}{lifterUp}
\umltrans [anchor1=south]{lifterUp}{out2}

\end{tikzpicture}
}
\end{document}

相关内容