summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex')
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex89
1 files changed, 60 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
index 4a7a2c113aa..38dee46769c 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
@@ -1,6 +1,6 @@
\pgf@circ@Rlen = \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
-
+\def\pgf@circ@direction{0.0}
% Names
\ctikzset{name/.style = { n=#1 } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@
@@ -15,10 +15,27 @@
\ctikzset{mirrored/false/.code = {\ctikzsetvalof{mirror value}{1}} }
\ctikzset{mirror/.style = {/tikz/circuitikz/mirrored=true}}
+% Invert node along path
+\ctikzset{inverted/.is choice}
+\ctikzset{invert value/.initial=1}
+\ctikzset{inverted/true/.code = {\ctikzsetvalof{invert value}{-1}\pgf@circuit@bipole@invertedtrue}}
+\ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf@circuit@bipole@invertedfalse}}
+\ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}}
+\newif\ifpgf@circuit@bipole@inverted
+\ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted}
+
+
+\newif\ifpgf@circuit@bipole@voltage@backward
+\ctikzset{bipole/voltage/direction/.is choice}
+\ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
+\ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
+
+
+
% Initialize paths
\def\pgfcircresetpath{
- \ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90,
- bipole/reversed=false, bipole/kind=,
+ \ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90, ,bipole/annotation/name=, bipole/annotation/position=-90,
+ bipole/inverted=false, bipole/kind=,
bipole/voltage/direction=backward, bipole/voltage/label/name=, bipole/voltage/position=below,
bipole/nodes/left=none, bipole/nodes/right=none, bipole/is voltage=false,bipole/is voltageoutsideofsymbol=false,bipole/is strokedsymbol=false,
bipole/is current=false, bipole/current/label/name=, bipole/current/x position=after,
@@ -43,41 +60,54 @@
\def\pgf@temp{open}
\def\pgf@circ@temp{#1}
}
- \ifpgf@circuit@bipole@reversed
- (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {}
- (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {}
- \else
- (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}start) {}
- (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}end) {}
- \fi
- \pgfextra{
- \pgf@circ@slope{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
- {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
- \edef\pgf@circ@direction{\pgfmathresult}
- }
- ($(\tikztostart) ! .5 ! (\tikztotarget)$)
- node[#1shape, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value}]
+
+ (\tikztostart) coordinate (\ctikzvalof{bipole/name}start)
+ (\tikztotarget) coordinate (\ctikzvalof{bipole/name}end)
+ \pgfextra{
+ \pgf@circ@slope{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
+ {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
+ \edef\pgf@circ@direction{\pgfmathresult}
+ }
+
+ ($(\tikztostart) ! .5 ! (\tikztotarget)$)
+ node[#1shape, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value}, xscale=\ctikzvalof{invert value}]
(\ctikzvalof{bipole/name}) {}
+ \ifpgf@circuit@bipole@inverted
+ \ifcsname pgf@anchor@#1shape@pathstart\endcsname%if special path-anchors are defined, use them!
+ coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathend)
+ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathstart)
+ \else
+ coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.right)
+ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.left)
+ \fi
+ \else
+ \ifcsname pgf@anchor@#1shape@pathstart\endcsname%if special path-anchors are defined, use them!
+ coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart)
+ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathend)
+ \else
+ coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.left)
+ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.right)
+ \fi
+ \fi
\ifx\pgf@temp\pgf@circ@temp % if it is an open
\else
\ifpgf@circuit@bipole@strokedsymbol%draw line thrue symbol(e.g. diodes)
- \ifcsname pgf@anchor@#1shape@strokepathstart\endcsname%if special path-anchors are defined, use them!
+ \ifcsname pgf@anchor@#1shape@strokepathstart\endcsname%if special path-anchors are defined, use them!
(\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.strokepathstart)
(\ctikzvalof{bipole/name}.strokepathend) -- (\ctikzvalof{bipole/name}end.center)
\else
(\ctikzvalof{bipole/name}start.center)--(\ctikzvalof{bipole/name}end.center)
\fi
- \else
- \ifcsname pgf@anchor@#1shape@pathstart\endcsname%if special path-anchors are defined, use them!
- (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.pathstart)
- (\ctikzvalof{bipole/name}.pathend) -- (\ctikzvalof{bipole/name}end.center)
- \else
- (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left)
- (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center)
- \fi
+ \else
+ (\ctikzvalof{bipole/name}start.center) --(anchorstartnode)
+ (anchorendnode) -- (\ctikzvalof{bipole/name}end.center)
+
\fi
\fi
- \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabel\fi
+
+
+ \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi
+ \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi
\drawpoles
\pgf@circ@ifkeyempty{bipole/voltage/label/name}\else\pgf@circ@drawvoltage\fi
\pgf@circ@ifkeyempty{bipole/current/label/name}\else\pgf@circ@drawcurrent\fi
@@ -90,7 +120,6 @@
%% Path definitions
-
\def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi}
\def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi}
\def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi}
@@ -579,7 +608,7 @@
\ctikzset{bipole/name = trans\pgf@circ@rand} % create it
\fi
}
- \ifpgf@circuit@bipole@reversed
+ \ifpgf@circuit@bipole@inverted
(\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {}
(\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {}
\else
@@ -595,6 +624,8 @@
($(\tikztostart) ! .5 ! (\tikztotarget)$)
node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}]
(\ctikzvalof{bipole/name}) {} node {\ctikzvalof{bipole/label/name}}
+ node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}]
+ (\ctikzvalof{bipole/name}) {} node {\ctikzvalof{bipole/value/name}}
\ifcsname pgf@anchor@#1@pathstart\endcsname%if special path-anchors are defined, use them!
(\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.pathstart)
(\ctikzvalof{bipole/name}.pathend) -- (\ctikzvalof{bipole/name}end.center)