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
|
% \iffalse
% --------------------------------------------------------------------
%<*hex>
% \fi
%
% \subsubsection{Towns}
% \label{sec:impl:hex:town}
%
% Similar to above, we define a namespace and family for towns. First
% thing is the graphics style for towns.
%
% \begin{macrocode}
\tikzset{%
hex/town/.style={
scale line widths,
solid,
thin,
fill=pgfstrokecolor,
color=pgfstrokecolor},
hex/town name/.style={
transform shape,
shape=rectangle,
above right=.1,
color=pgfstrokecolor,
font=\sffamily\fontsize{11}{13}\selectfont}
}
% \end{macrocode}
%
% Next is the namespace for dealing with towns.
%
% \begin{macrocode}
\tikzset{%
/hex/town/.search also={/tikz},%
/hex/town/.cd,
pic/.store in=\hex@c@pic,
type/.store in=\hex@c@pic,
place/.store in=\hex@c@pos,
location/.store in=\hex@c@pos,
name/.store in=\hex@c@name,
village/.style={pic=hex/town/village},
town/.style={pic=hex/town/town},
city/.style={pic=hex/town/city}
}
% \end{macrocode}
%
% And some \spec{pic}tures for making the towns.
%
% \begin{macrocode}
\tikzset{%
hex/town/village/.pic={\path[fill,solid,pic actions] circle(.1);},
hex/town/town/.pic={\path[fill,solid,pic actions] circle(.2);},
hex/town/city/.pic={%
\path[fill,solid,pic actions] circle(.25);
\path[draw,solid,pic actions] circle(.35);}
}
% \end{macrocode}
%
% \begin{Macro}{\hex@do@town}
%
% The macro to make the towns. This uses same tricks as above.
%
% \begin{macrocode}
\def\hex@c@nameparse{%
\@ifnextchar[{\hex@c@namep@rse}{\hex@c@namep@rse[]}%]
}
\def\hex@c@namep@rse[#1]#2\endhex@c@nameparse{%
\def\hex@c@node{node[shape=rectangle,hex/town name,#1]{#2}}}
\def\hex@do@town{%
\edef\hex@c@tmp{[
/hex/town/.cd,%
town,%
/tikz/hex/town,%
/tikz/every hex town/.try,
\hex@town]}
\expandafter\scope\hex@c@tmp%
\ifx\hex@c@pic\empty\else%
\@ifundefined{hex@c@pos}{\let\hex@c@pos\empty}{}
\@ifundefined{hex@c@name}{\let\hex@c@name\empty}{}
\expandafter\hex@c@nameparse\hex@c@name\endhex@c@nameparse%
\ifx\hex@c@pos\empty\def\hex@c@pos{(0,0)}\fi
\hex@dbg{2}{Town:
^^J text=\hex@c@name
^^J pic=\hex@c@pic
^^J place=\hex@c@pos
^^J node=\hex@c@node
}
\filldraw \hex@c@pos pic{\hex@c@pic} \hex@c@node;
\fi%
\endscope%
}
% \end{macrocode}
% \end{Macro}
% \iffalse
%</hex>
% --------------------------------------------------------------------
% \fi
|