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.tex51
1 files changed, 32 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
index 38dee46769c..2af7aaa9e78 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
@@ -47,29 +47,33 @@
%% Generic bipole path
\def\pgf@circ@bipole@path#1#2{
- \pgfextra{
+
+\pgfextra{
\ctikzset{bipole/kind = #1}
- \edef\pgf@temp{\pgfkeysvalueof{/tikz/circuitikz/bipole/name}}
+ \edef\pgf@temp{\ctikzvalof{bipole/name}}
\def\pgf@circ@temp{}
\ifx\pgf@temp\pgf@circ@temp % if it has not a name
\pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
\ctikzset{bipole/name = #2\pgf@circ@rand} % create it
\fi
-
- \def\pgf@temp{open}
- \def\pgf@circ@temp{#1}
+ \pgfsyssoftpath@getcurrentpath{\myp@th}%% save current path to extend after calculation of correct start/end coordinates
}
- (\tikztostart) coordinate (\ctikzvalof{bipole/name}start)
+ (\tikztostart) coordinate (\ctikzvalof{bipole/name}start)%necessary to get correct coordinates in the case of relativ start/end or constructions like ((node1)-|(node2))
(\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}
+ \edef\pgf@circ@direction{\pgfmathresult}%Calculate direction(angle) of path
+ \pgfsyssoftpath@setcurrentpath{\myp@th}
}
-
- ($(\tikztostart) ! .5 ! (\tikztotarget)$)
+ \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}}
+ \ifx\pgf@temp\pgf@circ@temp % if it is an open
+ \else
+ --($(\ctikzvalof{bipole/name}start) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}end)$) %ugly workaround to get correct linejoins(node breaks path?)
+ \fi
+ ($(\tikztostart) ! .5 ! (\tikztotarget)$)%%positio of middle node
node[#1shape, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value}, xscale=\ctikzvalof{invert value}]
(\ctikzvalof{bipole/name}) {}
\ifpgf@circuit@bipole@inverted
@@ -89,33 +93,40 @@
coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.right)
\fi
\fi
+ \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}}
\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!
- (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.strokepathstart)
+ (\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)
+ (\ctikzvalof{bipole/name}start.center) -- (\ctikzvalof{bipole/name}end.center)
\fi
\else
- (\ctikzvalof{bipole/name}start.center) --(anchorstartnode)
+ (\ctikzvalof{bipole/name}start.center) -- (anchorstartnode)
(anchorendnode) -- (\ctikzvalof{bipole/name}end.center)
-
\fi
\fi
-
+ \drawpoles
\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
+ \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}}
+ \ifx\pgf@temp\pgf@circ@temp % if it is an open
+ (\ctikzvalof{bipole/name}end)%Move to end of path
+ \else
+ ($(\ctikzvalof{bipole/name}end) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}start)$) -- (\ctikzvalof{bipole/name}end)%ugly workaround to get correct linejoins(node breaks path?)
+ %tikztostart and tikztotarget could not be used, because it would break if target coordinate is something like (node1-|node2)
+
+ \fi
% reset
\pgfextra{
\pgfcircresetpath
}
- (\tikztotarget) \tikztonodes % e si continua
+ \tikztonodes%draw pending nodes an path
}
@@ -133,7 +144,8 @@
\def\pgf@circ@vcapacitor@path#1{\pgf@circ@bipole@path{vcapacitor}{#1}}
\def\pgf@circ@piezoelectric@path#1{\pgf@circ@bipole@path{piezoelectric}{#1}}
\def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}}
-\def\pgf@circ@battery1@path#1{\pgf@circ@bipole@path{battery1}{#1}}
+\def\pgf@circ@batteryone@path#1{\pgf@circ@bipole@path{battery1}{#1}}
+\def\pgf@circ@batterytwo@path#1{\pgf@circ@bipole@path{battery2}{#1}}
\def\pgf@circ@europeaninductor@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}}
\def\pgf@circ@americaninductor@path#1{\pgf@circ@bipole@path{americaninductor}{#1}}
\def\pgf@circ@cuteinductor@path#1{\pgf@circ@bipole@path{cuteinductor}{#1}}
@@ -285,7 +297,8 @@
\compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcapacitor@path, l=#1}}
\compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piezoelectric@path, l=#1}}
\compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
-\compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery1@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batteryone@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
+\compattikzset{battery2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batterytwo@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
\compattikzset{inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductor@path, l=#1}}
\compattikzset{gf surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}}
\compattikzset{american gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americangfsurgearrester@path, l=#1}}
@@ -662,4 +675,4 @@
\pgf@circ@definetranspath{pigbt}
\pgf@circ@definetranspath{nigbt}
\pgf@circ@definetranspath{Lpigbt}
-\pgf@circ@definetranspath{Lnigbt} \ No newline at end of file
+\pgf@circ@definetranspath{Lnigbt}