% !TeX spellcheck = en_US
% !TeX root = tikz-ext-manual.tex
% Copyright 2022 by Qrrbrbirlbel
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Free Documentation License.
%
\section{Shape: Circle Arrow}
\begin{pgflibrary}{ext.shapes.circlearrow}
  A circular shape named |circle arrow| that has an arc as its background path that can have an arrow tip.
  \inspiration{ShapeCircleArrow-Q}{ShapeCircleArrow-A}
\end{pgflibrary}
\begin{ext_shape}{circle arrow}
  This shape is an arrow whose path is an arc -- defined very similar to the |arc|%
  \indexPathOperationO{arc} path operation -- that can possibly be customized with
  arrow tips.
  
  \begin{key}{/\pgfext/circle arrow start angle=\meta{start angle} (initially \{\})}\keycompat{pgf}
  Sets the start angle.
  \end{key}
  \begin{key}{/\pgfext/circle arrow end angle=\meta{end angle} (initially \{\})}\keycompat{pgf}
  Sets the end angle.
  \end{key}
  \begin{key}{/\pgfext/circle arrow delta angle=\meta{delta angle} (initially \{\})}\keycompat{pgf}
  Sets the delta angle.
  \end{key}
  \begin{key}{/\pgfext/circle arrow arrows=%
    \meta{start arrow tip specification}-\meta{end arrow tip specification} (initially -)}\keycompat{pgf}
  The specification will be forwarded to |\pgfsetarrows|\indexCommandO{\pgfsetarrows}.
  \end{key}
  
  A few handful styles are pre-defined.
  \begin{key}{/\pgfext/circle arrow turn left north}\keycompat{pgf}
  Sets |circle arrow start angle = 100|, |circle arrow delta angle = 340|
  and |circle arrow arrows = ->|.
  \end{key}
  \begin{key}{/\pgfext/circle arrow turn left east}\keycompat{pgf}
  As above but |circle arrow start angle = 10|.
  \end{key}
  \begin{key}{/\pgfext/circle arrow turn left west}\keycompat{pgf}
  As above but |circle arrow start angle = 280|.
  \end{key}
  \begin{key}{/\pgfext/circle arrow turn left south}\keycompat{pgf}
  As above but |circle arrow start angle = 190|.
  \end{key}
  \begin{key}{/\pgfext/circle arrow turn right north}\keycompat{pgf}
  Sets |circle arrow start angle = 100|, |circle arrow delta angle = 340|
  and |circle arrow arrows = <-|.
  \end{key}
  \begin{key}{/\pgfext/circle arrow turn right east}\keycompat{pgf}
  As above but |circle arrow start angle = 10|.
  \end{key}
  \begin{key}{/\pgfext/circle arrow turn right west}\keycompat{pgf}
  As above but |circle arrow start angle = 280|.
  \end{key}
  \begin{key}{/\pgfext/circle arrow turn right south}\keycompat{pgf}
  As above but |circle arrow start angle = 190|.
  \end{key}

\begingroup
\catcode`\|=12
\catcode`\&=\active
\begin{codeexample}[preamble=\usetikzlibrary{ext.shapes.circlearrow,matrix}]
\begin{tikzpicture}
\matrix[matrix of nodes, draw=none, row sep=1em, column sep=1em,
  every node/.style={draw=gray, shape=ext_circle arrow, ultra thick, inner sep=1em}
] (m) {
  |[ext/circle arrow turn left north]|  & |[ext/circle arrow turn left east]|   \\
  |[ext/circle arrow turn left west]|   & |[ext/circle arrow turn left south]|  \\
  |[ext/circle arrow turn right north]| & |[ext/circle arrow turn right east]|  \\
  |[ext/circle arrow turn right west]|  & |[ext/circle arrow turn right south]| \\
};
\end{tikzpicture}
\end{codeexample}
\endgroup
\begin{codeexample}[preamble=\usetikzlibrary{ext.shapes.circlearrow},width=16cm]
\begin{tikzpicture}\Huge
\node[name=s, shape=ext_circle arrow,
  ext/circle arrow turn left west, shape example]
  {Circle Arrow\vrule width 1pt height 2cm};
\foreach \anchor/\placement in
  {north west/above left, north/above,
   north east/above right,
   west/left, center/above, east/right,
   mid west/right, mid/above, mid east/left,
   base west/left, base/below, base east/right,
   south west/below left, south/below,
   south east/below right,
   text/left, 10/right, 130/above}
   \draw[shift=(s.\anchor)] plot[mark=x] coordinates{(0,0)}
     node[\placement] {\scriptsize\texttt{(s.\anchor)}};
\end{tikzpicture}
\end{codeexample}
\end{ext_shape}
\endinput