-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmoreshapes.tex
156 lines (152 loc) · 4.64 KB
/
moreshapes.tex
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A square shaped arrow
% The arrow has been renamed to squarea to avoid conflict with the square arrow
% defined in the CVS version of PGF
\newdimen\arrowsize
\pgfarrowsdeclare{squarea}{squarea}
{
\arrowsize=0.4pt
\advance\arrowsize by.275\pgflinewidth%
\pgfarrowsleftextend{+-\arrowsize}
\advance\arrowsize by.5\pgflinewidth
\pgfarrowsrightextend{+\arrowsize}
}
{
\arrowsize=0.4pt
\advance\arrowsize by.275\pgflinewidth%
\pgfsetdash{}{+0pt}
\pgfsetroundjoin
\pgfpathmoveto{\pgfqpoint{1\arrowsize}{4\arrowsize}}
\pgfpathlineto{\pgfqpoint{-7\arrowsize}{4\arrowsize}}
\pgfpathlineto{\pgfqpoint{-7\arrowsize}{-4\arrowsize}}
\pgfpathlineto{\pgfqpoint{1\arrowsize}{-4\arrowsize}}
\pgfpathclose
\pgfusepathqfillstroke
}
% A open square shaped arrow
\pgfarrowsdeclare{open squarea}{open squarea}%{{-.5bp}{8.5bp}}
{
\arrowsize=0.4pt
\advance\arrowsize by.275\pgflinewidth%
\pgfarrowsleftextend{+-.5\pgflinewidth}
\advance\arrowsize by7\arrowsize
\advance\arrowsize by.5\pgflinewidth
\pgfarrowsrightextend{+\arrowsize}
}
{
\arrowsize=0.4pt
\advance\arrowsize by.275\pgflinewidth%
\pgfsetdash{}{+0pt}
\pgfsetroundjoin
\pgfpathmoveto{\pgfqpoint{8\arrowsize}{4\arrowsize}}
\pgfpathlineto{\pgfqpoint{0\arrowsize}{4\arrowsize}}
\pgfpathlineto{\pgfqpoint{0\arrowsize}{-4\arrowsize}}
\pgfpathlineto{\pgfqpoint{8\arrowsize}{-4\arrowsize}}
\pgfpathclose
\pgfusepathqstroke
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A circle and diamond shape
\makeatletter
\newdimen\tempa
\newdimen\tempb
\pgfdeclareshape{diamond in circle}{
\inheritsavedanchors[from=diamond] % this is a diamond
\inheritsavedanchors[from=circle] % this is a circle
\inheritanchorborder[from=circle]
\inheritanchor[from=circle]{center}
\inheritanchor[from=circle]{radius}
\inheritanchor[from=circle]{north}
\inheritanchor[from=circle]{south}
\inheritanchor[from=circle]{east}
\inheritanchor[from=circle]{west}
\inheritanchor[from=circle]{anchorborder}
\saveddimen\radius{%
%
% Caculate ``height radius''
%
\pgf@ya=.5\ht\pgfnodeparttextbox%
\advance\pgf@ya by.5\dp\pgfnodeparttextbox%
\pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}%
\advance\pgf@ya by\pgf@yb%
%
% Caculate ``width radius''
%
\pgf@xa=.5\wd\pgfnodeparttextbox%
\pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}%
\advance\pgf@xa by\pgf@xb%
%
% Calculate length of radius vector:
%
\pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}%
\ifdim\pgf@x>\pgf@y%
\c@pgf@counta=\pgf@x%
\ifnum\c@pgf@counta=0\relax%
\else%
\divide\c@pgf@counta by 255\relax%
\pgf@xa=16\pgf@xa\relax%
\divide\pgf@xa by\c@pgf@counta%
\pgf@xa=16\pgf@xa\relax%
\fi%
\else%
\c@pgf@counta=\pgf@y%
\ifnum\c@pgf@counta=0\relax%
\else%
\divide\c@pgf@counta by 255\relax%
\pgf@ya=16\pgf@ya\relax%
\divide\pgf@ya by\c@pgf@counta%
\pgf@xa=16\pgf@ya\relax%
\fi%
\fi%
\pgf@x=\pgf@xa%
%
% If necessary, adjust radius so that the size requirements are
% met:
%
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}%
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}%
\ifdim\pgf@x<.5\pgf@xb%
\pgf@x=.5\pgf@xb%
\fi%
\ifdim\pgf@x<.5\pgf@yb%
\pgf@x=.5\pgf@yb%
\fi%
%
% Now, add larger of outer sepearations.
%
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
\ifdim\pgf@xb<\pgf@yb%
\advance\pgf@x by\pgf@yb%
\else%
\advance\pgf@x by\pgf@xb%
\fi%
}
\backgroundpath{
\tempa=\radius
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
\ifdim\pgf@xb<\pgf@yb%
\advance\tempa by-\pgf@yb%
\else%
\advance\tempa by-\pgf@xb%
\fi%
\pgfpathmoveto{\centerpoint\advance\pgf@x by\radius}%
\pgfpathlineto{\centerpoint\advance\pgf@y by\radius}%
\pgfpathlineto{\centerpoint\advance\pgf@x by-\radius}%
\pgfpathlineto{\centerpoint\advance\pgf@y by-\radius}%
\pgfpathclose%
}
\behindbackgroundpath{
\tempa=\radius%
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
\ifdim\pgf@xb<\pgf@yb%
\advance\tempa by-\pgf@yb%
\else%
\advance\tempa by-\pgf@xb%
\fi%
\pgfpathcircle{\centerpoint}{\tempa}%
}
}
\makeatother