16

In the example below I'd like to have angled edges which just go vertically and horizontally. My aim is to get the edges like in this image (the rounded edges are not a must) BPMN image:

Here is my minimal working example:

\documentclass{article}

\usepackage{tikz}

\usetikzlibrary{arrows,positioning, shapes.symbols,shapes.callouts,patterns}


\begin{document}
\begin{tikzpicture}[
    pre/.style={<-,shorten <=1pt,>=stealth',semithick},
    post/.style={->,shorten >=1pt,>=stealth',semithick}
    ]

\node[draw](start){start};

\node[draw, right=of start] (split) {+}
            edge[pre](start);

\node[draw, right=of split](pricedb){PriceDB}
    edge[pre](split);

\node[draw, below=of pricedb](stockdb){StockDB}
    edge[pre](split);

\node[draw, above=of pricedb](orderpage){OrderPage}
    edge[pre](split);   

\node[draw,right=of pricedb](join){+}
    edge[pre](pricedb)
    edge[pre](stockdb)
    edge[pre](orderpage);

\node[draw, right=of join](invoice){invoiceservice}
    edge[pre](join);

\node(silent)[right=of invoice]{}
    edge[<-,shorten <=1pt,>=stealth',semithick, dashed](invoice);
\end{tikzpicture}
\end{document}
DodoFXP
  • 457

2 Answers2

18

with draw it's simple

\documentclass{article}

\usepackage{tikz}

\usetikzlibrary{arrows,positioning, shapes.symbols,shapes.callouts,patterns}


\begin{document}
\begin{tikzpicture}[
    pre/.style={=stealth',semithick},
    post/.style={->,shorten >=1pt,>=stealth',semithick}
    ]

\node[draw](start){start};

\node[draw, right=of start] (split) {+}
            edge[pre](start);

\node[draw, right=of split](pricedb){PriceDB}
    edge[pre](split);

\node[draw, below=of pricedb](stockdb){StockDB};
\node[draw, above=of pricedb](orderpage){OrderPage};   
\node[draw,right=of pricedb](join){+}
    edge[pre](pricedb);
\node[draw, right=of join](invoice){invoiceservice}
    edge[pre](join);

 \draw[post,rounded corners=5pt] (orderpage)-|(join)  ;   
 \draw[post,rounded corners=5pt] (stockdb)-|(join)  ;   
 \draw[post,rounded corners=5pt] (split) |- (orderpage);
  \draw[post,rounded corners=5pt] (split) |- (stockdb);

\node(silent)[right=of invoice]{}
    edge[=stealth',semithick, dashed](invoice);
\end{tikzpicture}
\end{document}

liens

rpapa
  • 12,350
8

Actually you can do that with edge instead of \draw: Just add

\tikzset{
    -|/.style={to path={-| (\tikztotarget)}},
    |-/.style={to path={|- (\tikztotarget)}},
}

somewhere, then you can use edge[-|] and edge[|-]. (Of course you can replace them with other names like “hv” or “vh” for “horizontal-vertical” etc, if you still want to use the -|/|- arrow heads somewhere.)

Your code will then look like this:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows,positioning,shapes.symbols,shapes.callouts,patterns}


\begin{document}    
\tikzset{
    -|/.style={to path={-| (\tikztotarget)}},
    |-/.style={to path={|- (\tikztotarget)}},
}

\begin{tikzpicture}[
        pre/.style={<-,shorten <=1pt,>=stealth',semithick},
        post/.style={->,shorten >=1pt,>=stealth',semithick}
    ]

    \node[draw](start){start};

    \node[draw, right=of start] (split) {+}
        edge[pre](start);

    \node[draw, right=of split](pricedb){PriceDB}
        edge[pre](split);

    \node[draw, below=of pricedb](stockdb){StockDB}
        edge[pre,-|](split);

    \node[draw, above=of pricedb](orderpage){OrderPage}
        edge[pre,-|](split);

    \node[draw,right=of pricedb](join){+}
        edge[pre](pricedb)
        edge[pre,|-](stockdb)
        edge[pre,|-](orderpage);

    \node[draw, right=of join](invoice){invoiceservice}
        edge[pre](join);

    \node(silent)[right=of invoice]{}
        edge[<-,shorten <=1pt,>=stealth',semithick, dashed](invoice);
\end{tikzpicture}
\end{document}
Scz
  • 1,633