tikz-uml: UML 객체를 자신의 차선 아래에 배치하는 방법은 무엇입니까?

tikz-uml: UML 객체를 자신의 차선 아래에 배치하는 방법은 무엇입니까?

다음 코드가 있습니다.

\documentclass[a4paper]{article}

%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

%% Useful packages
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tikz} % For graphics
\usepackage{pgfplots}
\usepackage{xcolor}
\usetikzlibrary{matrix,arrows,calc,positioning,shapes,decorations.pathreplacing}
\usepackage{graphicx}
\usepackage{tikz-uml}

\title{Your Paper}
\author{You}
\begin{document}
\maketitle
\section{Introduction}

Diagram below:

\small\begin{tikzpicture} 

  \begin{umlseqdiag} 
    \umlactor{User} 
    \umlobject{Proxy} 
    \umlobject[x=7]{Entry station}
    \umlobject[x=10]{Dst station}  

    \begin{umlcall}[op=retrieve(token),return=pkt-info]{User}{Proxy}
      \begin{umlcall}[op=RReq,return=success]{Proxy}{Entry station}
      \end{umlcall}
      \begin{umlcall}[op=RReq,return=success]{Entry station}{Dst station}
      \end{umlcall}
      \begin{umlcallself}[op=lookup,return=pkt-info]{Dst station} 
      \end{umlcallself}
      \begin{umlcall}[op=RRes,return=success]{Dst station}{Entry station}
      \end{umlcall}
      \begin{umlcall}[op=RRes,return=success]{Entry station}{Proxy}
      \end{umlcall}
    \end{umlcall}

    \begin{umlfragment}[type=loop, label=$\forall p_k$, inner ysep=1]
      \begin{umlcall}[dt=7, op=retrieve(token $p_k$),return=fragment $p_k$]{User}{Proxy}
        \umlcreatecall[x=7]{Proxy}{Station}
        \begin{umlcall}[op=RRes,return=success]{Proxy}{Station}
        \end{umlcall}
      \end{umlcall}
    \end{umlfragment}

    \begin{umlcallself}[dt=5, op=aggregate($p_k$), return=packet $p$]{User} 
    \end{umlcallself}
  \end{umlseqdiag} 

\end{tikzpicture} 
\end{document} 

다음을 방출합니다.여기에 이미지 설명을 입력하세요

문제는 object 에 있습니다 Station. 실제로는 create 호출을 원하지 않습니다. 나는 그 차선을 객체용으로 거기에 배치하고 사용하고 싶습니다 Station. 그게 전부입니다. 나는 create전화가 일어나는 것을 원하지 않습니다 .

가능하지 않다면 적어도 라벨을 표시하는 대신 create다른 것을 표시하도록 라벨을 변경하려면 어떻게 해야 합니까?

답변1

해당 노드의 텍스트는 패키지 코드(최신 버전의 4622행)에 직접 기록되며 재정의할 수 있는 일부 매크로로 표시되지 않습니다.

그러나 의 도움을 받아 의 xpatch정의를 패치하여 원하는 대로 정의하고 재정의할 수 있는 매크로 등 \umlcreatecall으로 {create}바꿀 수 있습니다. {\CreateTxt}아래에서는 처음에 으로 정의 하고 다이어그램에서 \newcommand{\CreateTxt}{create}으로 다시 정의했습니다 .\renewcommand

graphicx관련 없는 참고 사항: 실제로는 필요하지 않은 두 번 로드합니다 . 그리고 둘 다 graphicxxcolor의해 로드되므로 tikz명시적으로 추가할 필요는 없습니다. tikz차례로 와 에 의해 로드되므로 pgfplots존재 tikz-uml하는 것 중 하나를 사용하면 .. 요점을 알 수 있습니다.

코드 출력

\documentclass[a4paper]{article}

%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

%% Useful packages
\usepackage{amsmath}
\usepackage{tikz-uml}
\usepackage{xpatch}

\newcommand\CreateTxt{create}
% in the macro \umlcreatecall, replace "{create}" with "{\CreateTxt}":
\xpatchcmd{\umlcreatecall}{{create}}{{\CreateTxt}}{}{}

\begin{document}

\begin{tikzpicture} 
\small

  \begin{umlseqdiag} 
    \umlactor{User} 
    \umlobject{Proxy} 
    \umlobject[x=7]{Entry station}
    \umlobject[x=10]{Dst station}  

    \begin{umlcall}[op=retrieve(token),return=pkt-info]{User}{Proxy}
      \begin{umlcall}[op=RReq,return=success]{Proxy}{Entry station}
      \end{umlcall}
      \begin{umlcall}[op=RReq,return=success]{Entry station}{Dst station}
      \end{umlcall}
      \begin{umlcallself}[op=lookup,return=pkt-info]{Dst station} 
      \end{umlcallself}
      \begin{umlcall}[op=RRes,return=success]{Dst station}{Entry station}
      \end{umlcall}
      \begin{umlcall}[op=RRes,return=success]{Entry station}{Proxy}
      \end{umlcall}
    \end{umlcall}

    \begin{umlfragment}[type=loop, label=$\forall p_k$, inner ysep=1]
      \begin{umlcall}[dt=7, op=retrieve(token $p_k$),return=fragment $p_k$]{User}{Proxy}
        % redefine \CreateTxt to be empty
        \renewcommand\CreateTxt{}
        \umlcreatecall[x=7]{Proxy}{Station}
        \begin{umlcall}[op=RRes,return=success]{Proxy}{Station}
        \end{umlcall}
      \end{umlcall}
    \end{umlfragment}

    \begin{umlcallself}[dt=5, op=aggregate($p_k$), return=packet $p$]{User} 
    \end{umlcallself}
  \end{umlseqdiag} 

\end{tikzpicture} 
\end{document}

관련 정보