% \subsection{Das Paket \texttt{relaycircuit}}
%	 Die ausführliche Beschreibung des Pakets ist in der
%	 Paketbeschreibung (\ref{paket:relaycircuit}) zu finden.
%
%  Beginn der Definition, Voraussetzung der \LaTeXe{} Version und die
%  eigene Identifizierung
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{relaycircuit}[2014/11/18 v0.5 %
                               Relais-Schaltungen mit TikZ]
%    \end{macrocode}
% Einbinden der geforderten Pakete
%    \begin{macrocode}
\RequirePackage{tikz}
\RequirePackage[siunitx,european,nooldvoltagedirection]{circuitikz}
\usetikzlibrary{arrows,shadows,shapes.misc,scopes}
%    \end{macrocode}
%
% \subsubsection{TikZ-Definitionen}
%
%    \begin{macrocode}
\pgfdeclareshape{ruhe relais}{
	  \savedanchor\northwest{
			\pgf@y = 0.7cm
			\pgf@x = -1cm
	  }
	  \savedanchor\left{%
	  	\pgf@y=0pt
	  }
	  \savedanchor\inEingabe{%
			\pgf@y= 0.7cm
			\pgf@x= -0.7cm
	  }
		\anchor{eingabe}{
			\inEingabe
		}
		\anchor{anschluss}{
			\inEingabe
			\pgf@x= -\pgf@x
		}
		\anchor{ausgabe} {
			\inEingabe
			\pgf@x= -\pgf@x
			\pgf@y= -\pgf@y
		}
  	\anchor{center}{
			\northwest
			\pgf@y=0pt
			\pgf@x=-.8\pgf@x
	  }
	  \anchor{east}{
	  	\left
	  	\pgf@x=-.8\pgf@x
	  }
	  \anchor{west}{
	  	\left
	  }
	  \anchor{south}{
		\northwest
		\pgf@x=0pt
		\pgf@y=-\pgf@y
	  }
	  \anchor{north}{
		\northwest
		\pgf@x=0pt
	  }
	  \anchor{south west}{
		\northwest
		\pgf@y=-\pgf@y
	  }
	  \anchor{north east}{
		\northwest
		\pgf@x=-\pgf@x
	  }
	  \anchor{north west}{
		\northwest
	  }
	  \anchor{south east}{
		\northwest
		\pgf@x=-\pgf@x
		\pgf@y=-\pgf@y
	  }

	  \backgroundpath{

			%Eingabe und Erdung
 			\pgfpathmoveto{\pgfpoint{-0.7cm}{0.7cm}}
			\pgfpathlineto{\pgfpoint{-0.7cm}{-0.6cm}}
			\pgfpathmoveto{\pgfpoint{-0.8cm}{-0.6cm}}
			\pgfpathlineto{\pgfpoint{-0.6cm}{-0.6cm}}

			%Anschluss
 			\pgfpathmoveto{\pgfpoint{0.7cm}{0.7cm}}
			\pgfpathlineto{\pgfpoint{0.7cm}{0.3cm}}
			\pgfpathlineto{\pgfpoint{0.6cm}{-0.35cm}}
			%Ausgabe
 			\pgfpathmoveto{\pgfpoint{0.7cm}{-0.7cm}}
			\pgfpathlineto{\pgfpoint{0.7cm}{-0.3cm}}
			\pgfpathlineto{\pgfpoint{0.6cm}{-0.3cm}}

			\pgfusepath{stroke}

			\pgfsetdash{{2pt}{2pt}}{1pt}
 			\pgfpathmoveto{\pgfpoint{-0.7cm}{0cm}}
			\pgfpathlineto{\pgfpoint{0.65cm}{0cm}}

			\pgfusepath{stroke}
			\pgfsetdash{}{0pt}

			\pgfusepath{draw}

			%Kasten
			\pgfsetlinewidth{2\pgflinewidth}
			\pgfpathrectanglecorners{\pgfpoint{1cm}{0.5cm}%
                                    }{\pgfpoint{-1cm}{-0.5cm}}

			\pgfusepath{draw}

			\pgftext[base,y=-0.4cm]{RK}
	  }
}

\pgfdeclareshape{arbeits relais}{
		\inheritsavedanchors[from=ruhe relais]
		\inheritanchor[from=ruhe relais]{center}
		\inheritanchor[from=ruhe relais]{north}
		\inheritanchor[from=ruhe relais]{south}
		\inheritanchor[from=ruhe relais]{west}
		\inheritanchor[from=ruhe relais]{east}
		\inheritanchor[from=ruhe relais]{north west}
		\inheritanchor[from=ruhe relais]{south west}
		\inheritanchor[from=ruhe relais]{north east}
		\inheritanchor[from=ruhe relais]{south east}
		\inheritanchor[from=ruhe relais]{eingabe}
		\inheritanchor[from=ruhe relais]{ausgabe}
		\inheritanchor[from=ruhe relais]{anschluss}

	  \backgroundpath{

			%Eingabe und Erdung
 			\pgfpathmoveto{\pgfpoint{-0.7cm}{0.7cm}}
			\pgfpathlineto{\pgfpoint{-0.7cm}{-0.6cm}}
			\pgfpathmoveto{\pgfpoint{-0.8cm}{-0.6cm}}
			\pgfpathlineto{\pgfpoint{-0.6cm}{-0.6cm}}

			%Anschluss
 			\pgfpathmoveto{\pgfpoint{0.7cm}{0.7cm}}
			\pgfpathlineto{\pgfpoint{0.7cm}{0.3cm}}
			\pgfpathlineto{\pgfpoint{0.95cm}{-0.35cm}}
			%Ausgabe
 			\pgfpathmoveto{\pgfpoint{0.7cm}{-0.7cm}}
			\pgfpathlineto{\pgfpoint{0.7cm}{-0.3cm}}
			\pgfpathlineto{\pgfpoint{0.8cm}{-0.3cm}}

			\pgfusepath{stroke}

			\pgfsetdash{{2pt}{2pt}}{1pt}
 			\pgfpathmoveto{\pgfpoint{-0.7cm}{0cm}}
			\pgfpathlineto{\pgfpoint{0.825cm}{0cm}}

			\pgfusepath{stroke}
			\pgfsetdash{}{0pt}

			\pgfusepath{draw}

			%Kasten
			\pgfsetlinewidth{2\pgflinewidth}
			\pgfpathrectanglecorners{\pgfpoint{1cm}{0.5cm}}%
                                    {\pgfpoint{-1cm}{-0.5cm}}

			\pgfusepath{draw}

			\pgftext[base,y=-0.4cm]{AK}
	  }
}

%    \end{macrocode}
%
% Ende des Pakets \texttt{relaycircuit}
