% Copyright 2008 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.ee}
\usetikzlibrary{arrows}

\usepgflibrary{shapes.gates.ee.IEC}


%
% When this lib is loaded, all symbols default to IEC
%

\tikzset{
  circuit ee IEC/.style=
  {
    circuit ee,
    set resistor graphic              = resistor IEC graphic,
    set inductor graphic              = inductor IEC graphic,
    set capacitor graphic             = capacitor IEC graphic,
    set contact graphic               = contact IEC graphic,
    set ground graphic                = ground IEC graphic,
    set battery graphic               = battery IEC graphic,
    set diode graphic                 = diode IEC graphic,
    set Zener diode graphic           = Zener diode IEC graphic,
    set tunnel diode graphic          = tunnel diode IEC graphic,
    set backward diode graphic        = backward diode IEC graphic,
    set Schottky diode graphic        = Schottky diode IEC graphic,
    set breakdown diode graphic       = breakdown diode IEC graphic,
    set bulb graphic                  = bulb IEC graphic,
    set voltage source graphic        = voltage source IEC graphic,
    set current source graphic        = current source IEC graphic,
    set make contact graphic          = make contact IEC graphic,
    set break contact graphic         = break contact IEC graphic,
  }
}


%
% Resistors
%

\tikzset{
  resistor IEC graphic/.style={
    circuit symbol open,
    circuit symbol size=width 4 height 1,
    shape=rectangle ee,
    transform shape
  },
  var resistor IEC graphic/.style={
    circuit symbol lines,
    circuit symbol size=width 4.8 height 0.8,
    shape=var resistor IEC,
    transform shape,
    outer sep=0pt,
    cap=round
  }
}



%
% Inductors
%

\tikzset{
  inductor IEC graphic/.style={
    circuit symbol lines,
    circuit symbol size=width 4 height .5,
    transform shape,
    shape=inductor IEC,
    outer sep=0pt,
    cap=round
  },
  var inductor IEC graphic/.style={
    circuit symbol filled,
    circuit symbol size=width 4 height 1,
    transform shape,
    shape=rectangle ee
  }
}



%
% Capacitors
%

\tikzset{
  capacitor IEC graphic/.style={
    circuit symbol lines,
    circuit symbol size=width .5 height 2,
    transform shape,
    shape=capacitor IEC
  }
}



%
% Ground
%

\tikzset{
  ground IEC graphic/.style={
    circuit symbol lines,
    circuit symbol size=width .75 height 2,
    transform shape,
    shape=ground IEC
  }
}




%
% Battery
%

\tikzset{
  battery IEC graphic/.style={
    circuit symbol lines,
    circuit symbol size=width .5 height 2.5,
    transform shape,
    shape=battery IEC,
    transform shape
  }
}



%
% Diodes
%

\tikzset{
  %
  % normal diode
  %
  diode IEC graphic/.style={
    circuit symbol open,
    circuit symbol size=width 1.25 height 1.25,
    transform shape,
    shape=generic diode IEC,
    /pgf/generic diode IEC/before background={
      \pgfpathmoveto{\pgfqpoint{0pt}{-1pt}}
      \pgfpathlineto{\pgfqpoint{0pt}{1pt}}
      \pgfusepathqstroke
    },
  },
  var diode IEC graphic/.style={
    diode IEC graphic,
    circuit symbol filled
  }
}

\tikzset{
  %
  % Zener diode
  %
  Zener diode IEC graphic/.style={
    diode IEC graphic,
    /pgf/generic diode IEC/before background={
      \pgfpathmoveto{\pgfqpoint{-.5pt}{-1pt}}
      \pgfpathlineto{\pgfqpoint{0pt}{-1pt}}
      \pgfpathlineto{\pgfqpoint{0pt}{1pt}}
      \pgfusepathqstroke
    },
  },
  var Zener diode IEC graphic/.style={
    Zener diode IEC graphic,
    circuit symbol filled
  }
}

\tikzset{
  %
  % Schottky diode
  %
  Schottky diode IEC graphic/.style={
    diode IEC graphic,
    /pgf/generic diode IEC/before background={
      \pgfpathmoveto{\pgfqpoint{-.4pt}{-.6pt}}
      \pgfpathlineto{\pgfqpoint{-.4pt}{-1pt}}
      \pgfpathlineto{\pgfqpoint{0pt}{-1pt}}
      \pgfpathlineto{\pgfqpoint{0pt}{1pt}}
      \pgfpathlineto{\pgfqpoint{.4pt}{1pt}}
      \pgfpathlineto{\pgfqpoint{.4pt}{.6pt}}
      \pgfusepathqstroke
    },
  },
  var Schottky diode IEC graphic/.style={
    Schottky diode IEC graphic,
    circuit symbol filled
  }
}

\tikzset{
  %
  % tunnel diode
  %
  tunnel diode IEC graphic/.style={
    diode IEC graphic,
    /pgf/generic diode IEC/before background={
      \pgfpathmoveto{\pgfqpoint{-.5pt}{-1pt}}
      \pgfpathlineto{\pgfqpoint{0pt}{-1pt}}
      \pgfpathlineto{\pgfqpoint{0pt}{1pt}}
      \pgfpathlineto{\pgfqpoint{-.5pt}{1pt}}
      \pgfusepathqstroke
    },
  },
  var tunnel diode IEC graphic/.style={
    tunnel diode IEC graphic,
    circuit symbol filled
  }
}

\tikzset{
  % 
  % backward diode
  %
  backward diode IEC graphic/.style={
    diode IEC graphic,
    /pgf/generic diode IEC/before background={
      \pgfpathmoveto{\pgfqpoint{-.5pt}{-1pt}}
      \pgfpathlineto{\pgfqpoint{.5pt}{-1pt}}
      \pgfpathmoveto{\pgfqpoint{0pt}{-1pt}}
      \pgfpathlineto{\pgfqpoint{0pt}{1pt}}
      \pgfpathmoveto{\pgfqpoint{-.5pt}{1pt}}
      \pgfpathlineto{\pgfqpoint{.5pt}{1pt}}
      \pgfusepathqstroke
    },
  },
  var backward diode IEC graphic/.style={
    backward diode IEC graphic,
    circuit symbol filled
  }
}


\tikzset{
  %
  % breakdown diode
  %
  breakdown diode IEC graphic/.style={
    circuit symbol open,
    circuit symbol size=width 2.5 height 1.25,
    transform shape,
    shape=breakdown diode IEC,
  },
  var breakdown diode IEC graphic/.style={
    breakdown diode IEC graphic,
    circuit symbol filled
  }
}



%
% Contacts
%

\tikzset{
  contact IEC graphic/.style={
    circuit symbol filled,
    circuit symbol size=width .5 height .5,
    shape=circle ee,
    outer sep=.25\pgflinewidth
  },
%  connection IEC graphic/.style={
%    circuit symbol open,
%    circuit symbol size=width 1 height 1,
%    shape=circle ee,
%    outer sep=.25\pgflinewidth
%  }
}


%
% Bulbs
%

\tikzset{
  bulb IEC graphic/.style={
    circuit symbol lines,
    circuit symbol size=width 1.5 height 1.5,
    shape=generic circle IEC,
    /pgf/generic circle IEC/before background={
      \pgfpathmoveto{\pgfpointpolar{-135}{1pt}}
      \pgfpathlineto{\pgfpointpolar{45}{1pt}}
      \pgfpathmoveto{\pgfpointpolar{-45}{1pt}}
      \pgfpathlineto{\pgfpointpolar{135}{1pt}}
      \pgfusepathqstroke
    },
    transform shape
  }
}


%
% Current and voltage sources
%

\tikzset{
  current source IEC graphic/.style={
    circuit symbol lines,
    circuit symbol size=width 2 height 2,
    shape=generic circle IEC,
    /pgf/generic circle IEC/before background={
      \pgfpathmoveto{\pgfqpoint{0pt}{-1pt}}
      \pgfpathlineto{\pgfqpoint{0pt}{1pt}}
      \pgfusepathqstroke
    },
    transform shape
  },
  voltage source IEC graphic/.style={
    circuit symbol lines,
    circuit symbol size=width 2 height 2,
    shape=generic circle IEC,
    /pgf/generic circle IEC/before background={
      \pgfpathmoveto{\pgfqpoint{-1pt}{0pt}}
      \pgfpathlineto{\pgfqpoint{1pt}{0pt}}
      \pgfusepathqstroke
    },
    transform shape
  }
}



%
% Contacts
%

\tikzset{
  make contact IEC graphic/.style={
    circuit symbol wires,
    circuit symbol size=width 2 height 1,
    transform shape,
    shape=make contact IEC,
    outer sep=0pt,
    cap=round
  },
  var make contact IEC graphic/.style={
    circuit symbol wires,
    circuit symbol size=width 2.4 height 1,
    transform shape,
    shape=var make contact IEC,
    outer sep=0pt,
    cap=round
  }
}


\tikzset{
  break contact IEC graphic/.style={
    circuit symbol wires,
    circuit symbol size=width 2 height 1,
    transform shape,
    shape=break contact IEC,
    outer sep=0pt,
    cap=round
  },
}




\endinput

