
% Copyright 2019 by Till Tantau and others Wibrow
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.

\usetikzlibrary{circuits}%
\usepgflibrary{shapes.gates.ee}%


%
% Setting up an ee circuit
%
\tikzset{
  circuit ee/.style={
    circuit,
    every circuit ee/.try
  }
}%


%
% The default symbols (you need to load a sublib to install the actual rendering).
%

\tikzset{
  circuit declare symbol = resistor,
  circuit declare symbol = inductor,
  circuit declare symbol = capacitor,
  circuit declare symbol = contact,
  circuit declare symbol = ground,
  circuit declare symbol = battery,
  circuit declare symbol = diode,
  circuit declare symbol = Zener diode,
  circuit declare symbol = Schottky diode,
  circuit declare symbol = tunnel diode,
  circuit declare symbol = backward diode,
  circuit declare symbol = breakdown diode,
  circuit declare symbol = bulb,
  circuit declare symbol = current source,
  circuit declare symbol = voltage source,
  circuit declare symbol = current direction,
  circuit declare symbol = current direction',
  circuit declare symbol = make contact,
  circuit declare symbol = break contact,
  circuit declare symbol = amperemeter,
  circuit declare symbol = voltmeter,
  circuit declare symbol = ohmmeter,
  circuit declare symbol = ac source,
  circuit declare symbol = dc source,
  %
  set current direction graphic  = current direction ee graphic,
  set current direction' graphic = current direction' ee graphic,
}%


%
% The default labels
%

\tikzset{
  circuit declare unit={ampere}{A},
  circuit declare unit={volt}{V},
  circuit declare unit={ohm}{\Omega},
  circuit declare unit={siemens}{S},
  circuit declare unit={henry}{H},
  circuit declare unit={farad}{F},
  circuit declare unit={coulomb}{C},
  circuit declare unit={voltampere}{VA},
  circuit declare unit={watt}{W},
  circuit declare unit={hertz}{Hz},
}%



%
% The direction and arrow settings
%

\tikzset{
  % These styles should set the end-arrow.
  %
  % This arrow will generally be used to indicate current directions in a circuit:
  current direction arrow/.style = {
    /utils/exec={\pgfsetarrowoptions{direction ee}{1.3065*.5*\the\tikzcircuitssizeunit+1.3065*.3*\the\pgflinewidth}},
    >=direction ee,
    direction ee arrow = direction ee,
  }
}%




\tikzset{
  current direction ee graphic/.style = {
    shape=direction ee,
    circuit symbol filled,
    current direction arrow,
    minimum width  = .5*\the\tikzcircuitssizeunit+.3*\the\pgflinewidth,
    minimum height = .5*\the\tikzcircuitssizeunit+.3*\the\pgflinewidth,
    transform shape
  },
  current direction' ee graphic/.style = {
    current direction ee graphic,
    rotate=180
  }
}%



%
% Annotations
%

\tikzset{
  circuit declare annotation={direction info}{.5\tikzcircuitssizeunit}
  {
    (-1.25\tikzcircuitssizeunit,.3333\tikzcircuitssizeunit) edge[line to] (1.25\tikzcircuitssizeunit,.3333\tikzcircuitssizeunit)
  },
  circuit declare annotation={light emitting}{1.75\tikzcircuitssizeunit}
  {
    (-.2\tikzcircuitssizeunit,.65\tikzcircuitssizeunit) edge[line to] ++(45:1.25\tikzcircuitssizeunit)
    (.2\tikzcircuitssizeunit,.25\tikzcircuitssizeunit) edge[line to] ++(45:1.25\tikzcircuitssizeunit)
  },
  circuit declare annotation={light dependent}{1.75\tikzcircuitssizeunit}
  {
    [shift=(135:1.25\tikzcircuitssizeunit)]
    (.2\tikzcircuitssizeunit,.65\tikzcircuitssizeunit) edge[line to] ++(-45:1.25\tikzcircuitssizeunit)
    (-.2\tikzcircuitssizeunit,.25\tikzcircuitssizeunit) edge[line to] ++(-45:1.25\tikzcircuitssizeunit)
  },
  circuit declare annotation={adjustable}{1.5\tikzcircuitssizeunit}
  {
    [shift=(\tikzlastnode.center)]
    (-1.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) edge[line to] (1.5\tikzcircuitssizeunit,1.5\tikzcircuitssizeunit)
  },
  circuit declare annotation={adjustable'}{1.5\tikzcircuitssizeunit}
  {
    [shift=(\tikzlastnode.center)]
    (-1.5\tikzcircuitssizeunit,1.5\tikzcircuitssizeunit) edge[line to] (1.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit)
  }
}%


\endinput
