summaryrefslogtreecommitdiff
path: root/graphics/pgf/base/tex/pgflibraryshapes.gates.ee.code.tex
blob: c8f95ff4bfe3c6f86f1a2dfeefebb40939b92229 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
% Copyright 2018 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.



%
% Base shapes
%
% These shapes are identical to the shapes without "ee", only an "input"
% and an "output" anchor have been added at the left and right end.

\pgfdeclareshape{rectangle ee}
{%
  \inheritsavedanchors[from=rectangle]%
  \inheritanchorborder[from=rectangle]%
  \inheritanchor[from=rectangle]{north}%
  \inheritanchor[from=rectangle]{north west}%
  \inheritanchor[from=rectangle]{north east}%
  \inheritanchor[from=rectangle]{center}%
  \inheritanchor[from=rectangle]{west}%
  \inheritanchor[from=rectangle]{east}%
  \inheritanchor[from=rectangle]{mid}%
  \inheritanchor[from=rectangle]{mid west}%
  \inheritanchor[from=rectangle]{mid east}%
  \inheritanchor[from=rectangle]{base}%
  \inheritanchor[from=rectangle]{base west}%
  \inheritanchor[from=rectangle]{base east}%
  \inheritanchor[from=rectangle]{south}%
  \inheritanchor[from=rectangle]{south west}%
  \inheritanchor[from=rectangle]{south east}%
  \inheritbackgroundpath[from=rectangle]%
  % New:
  \anchor{input}{
    \pgf@process{\northeast}%
    \pgf@ya=.5\pgf@y%
    \pgf@process{\southwest}%
    \pgf@y=.5\pgf@y%
    \advance\pgf@y by \pgf@ya%
  }%
  \anchor{output}{%
    \pgf@process{\southwest}%
    \pgf@ya=.5\pgf@y%
    \pgf@process{\northeast}%
    \pgf@y=.5\pgf@y%
    \advance\pgf@y by \pgf@ya%
  }%
}%

\pgfdeclareshape{circle ee}
{%
  \inheritsavedanchors[from=circle]%
  \inheritanchorborder[from=circle]%
  \inheritanchor[from=circle]{north}%
  \inheritanchor[from=circle]{north west}%
  \inheritanchor[from=circle]{north east}%
  \inheritanchor[from=circle]{center}%
  \inheritanchor[from=circle]{west}%
  \inheritanchor[from=circle]{east}%
  \inheritanchor[from=circle]{mid}%
  \inheritanchor[from=circle]{mid west}%
  \inheritanchor[from=circle]{mid east}%
  \inheritanchor[from=circle]{base}%
  \inheritanchor[from=circle]{base west}%
  \inheritanchor[from=circle]{base east}%
  \inheritanchor[from=circle]{south}%
  \inheritanchor[from=circle]{south west}%
  \inheritanchor[from=circle]{south east}%
  \inheritbackgroundpath[from=circle]%
  % New:
  \anchor{input}{\centerpoint\advance\pgf@x by-\radius}%
  \anchor{output}{\centerpoint\advance\pgf@x by\radius}%
}%



%
% Current direction indicator. This shape uses the current setting of
% the current direction arrow tip for the arrow. The shape is a
% rectangle around the arrow tip.
%

\pgfdeclareshape{direction ee}
{%
  \savedanchor\northeast{
    \pgf@x=0pt%
    % Height is given by minimum height/2
    \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/minimum height}}%
    \pgf@y=.5\pgf@y
  }%
  \savedanchor\southwest{
    % Left border is given by left extend
    \pgfarrowtotallength{\pgfkeysvalueof{/pgf/direction ee arrow}}%
    \pgf@x=-\pgf@x%
    % Height is given by minimum height/2
    \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/minimum height}}%
    \pgf@y=-.5\pgf@y
  }%

  \inheritanchor[from=rectangle ee]{center}%
  \inheritanchor[from=rectangle ee]{north}%
  \inheritanchor[from=rectangle ee]{south}%
  \inheritanchor[from=rectangle ee]{east}%
  \inheritanchor[from=rectangle ee]{west}%
  \inheritanchor[from=rectangle ee]{north east}%
  \inheritanchor[from=rectangle ee]{north west}%
  \inheritanchor[from=rectangle ee]{south east}%
  \inheritanchor[from=rectangle ee]{south west}%
  \inheritanchor[from=rectangle ee]{input}%
  \inheritanchor[from=rectangle ee]{output}%
  \inheritanchorborder[from=rectangle ee]%
  \nodeparts{}% no text

  \behindbackgroundpath{
    \pgf@process{\southwest}
    \pgf@xa=\pgf@x
    \pgf@process{\northeast}
    \pgf@xb=\pgf@x
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}}
    \pgfusepathqstroke
  }%

  \beforebackgroundpath{
    {
      \pgfsys@beginscope
      \pgfarrowdraw{\pgfkeysvalueof{/pgf/direction ee arrow}}%
      \pgfsys@endscope
    }
  }%
}%

\pgfkeys{
  /pgf/direction ee arrow/.initial=direction ee,
}%



% Special arrow for ee directions:

\pgfarrowsdeclare{direction ee}{direction ee}
{%
  \pgfmathsetlength\pgfutil@tempdima{\pgfgetarrowoptions{direction ee}}%
  \pgfutil@tempdima=.5\pgfutil@tempdima
  \pgfarrowsleftextend{+-\pgfutil@tempdima}
  \pgfarrowsrightextend{+\pgfutil@tempdima}
}
{
  \pgfmathsetlength\pgfutil@tempdima{\pgfgetarrowoptions{direction ee}}%
  \pgfsetdash{}{+0pt}
  \pgfsetroundjoin
  \pgfpathmoveto{\pgfqpoint{-0.5\pgfutil@tempdima}{0.38268343237\pgfutil@tempdima}}
  \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0\pgfutil@tempdima}}
  \pgfpathlineto{\pgfqpoint{-0.5\pgfutil@tempdima}{-0.38268343237\pgfutil@tempdima}}
  \pgfpathclose
  \pgfusepathqfillstroke
}%

\pgfsetarrowoptions{direction ee}{4pt}%





\endinput