| 1 |
% \iffalse |
| 2 |
% -------------------------------------------------------------------- |
| 3 |
%<*hex> |
| 4 |
% \fi |
| 5 |
% |
| 6 |
% \subsubsection{Towns} |
| 7 |
% \label{sec:impl:hex:town} |
| 8 |
% |
| 9 |
% Similar to above, we define a namespace and family for towns. First |
| 10 |
% thing is the graphics style for towns. |
| 11 |
% |
| 12 |
% \begin{macrocode} |
| 13 |
\tikzset{% |
| 14 |
hex/town/.style={ |
| 15 |
scale line widths, |
| 16 |
solid, |
| 17 |
thin, |
| 18 |
fill=pgfstrokecolor, |
| 19 |
color=pgfstrokecolor}, |
| 20 |
hex/town name/.style={ |
| 21 |
transform shape, |
| 22 |
shape=rectangle, |
| 23 |
above right=.1, |
| 24 |
color=pgfstrokecolor, |
| 25 |
font=\sffamily\fontsize{11}{13}\selectfont} |
| 26 |
} |
| 27 |
% \end{macrocode} |
| 28 |
% |
| 29 |
% Next is the namespace for dealing with towns. |
| 30 |
% |
| 31 |
% \begin{macrocode} |
| 32 |
\tikzset{% |
| 33 |
/hex/town/.search also={/tikz},% |
| 34 |
/hex/town/.cd, |
| 35 |
pic/.store in=\hex@c@pic, |
| 36 |
type/.store in=\hex@c@pic, |
| 37 |
place/.store in=\hex@c@pos, |
| 38 |
location/.store in=\hex@c@pos, |
| 39 |
name/.store in=\hex@c@name, |
| 40 |
village/.style={pic=hex/town/village}, |
| 41 |
town/.style={pic=hex/town/town}, |
| 42 |
city/.style={pic=hex/town/city} |
| 43 |
} |
| 44 |
% \end{macrocode} |
| 45 |
% |
| 46 |
% And some \spec{pic}tures for making the towns. |
| 47 |
% |
| 48 |
% \begin{macrocode} |
| 49 |
\tikzset{% |
| 50 |
hex/town/village/.pic={\path[fill,solid,pic actions] circle(.1);}, |
| 51 |
hex/town/town/.pic={\path[fill,solid,pic actions] circle(.2);}, |
| 52 |
hex/town/city/.pic={% |
| 53 |
\path[fill,solid,pic actions] circle(.25); |
| 54 |
\path[draw,solid,pic actions] circle(.35);} |
| 55 |
} |
| 56 |
% \end{macrocode} |
| 57 |
% |
| 58 |
% \begin{Macro}{\hex@do@town} |
| 59 |
% |
| 60 |
% The macro to make the towns. This uses same tricks as above. |
| 61 |
% |
| 62 |
% \begin{macrocode} |
| 63 |
\def\hex@c@nameparse{% |
| 64 |
\@ifnextchar[{\hex@c@namep@rse}{\hex@c@namep@rse[]}%] |
| 65 |
} |
| 66 |
\def\hex@c@namep@rse[#1]#2\endhex@c@nameparse{% |
| 67 |
\def\hex@c@node{node[shape=rectangle,hex/town name,#1]{#2}}} |
| 68 |
|
| 69 |
\def\hex@do@town{% |
| 70 |
\edef\hex@c@tmp{[ |
| 71 |
/hex/town/.cd,% |
| 72 |
town,% |
| 73 |
/tikz/hex/town,% |
| 74 |
/tikz/every hex town/.try, |
| 75 |
\hex@town]} |
| 76 |
\expandafter\scope\hex@c@tmp% |
| 77 |
\ifx\hex@c@pic\empty\else% |
| 78 |
\@ifundefined{hex@c@pos}{\let\hex@c@pos\empty}{} |
| 79 |
\@ifundefined{hex@c@name}{\let\hex@c@name\empty}{} |
| 80 |
\expandafter\hex@c@nameparse\hex@c@name\endhex@c@nameparse% |
| 81 |
\ifx\hex@c@pos\empty\def\hex@c@pos{(0,0)}\fi |
| 82 |
\hex@dbg{2}{Town: |
| 83 |
^^J text=\hex@c@name |
| 84 |
^^J pic=\hex@c@pic |
| 85 |
^^J place=\hex@c@pos |
| 86 |
^^J node=\hex@c@node |
| 87 |
} |
| 88 |
\filldraw \hex@c@pos pic{\hex@c@pic} \hex@c@node; |
| 89 |
\fi% |
| 90 |
\endscope% |
| 91 |
} |
| 92 |
% \end{macrocode} |
| 93 |
% \end{Macro} |
| 94 |
% \iffalse |
| 95 |
%</hex> |
| 96 |
% -------------------------------------------------------------------- |
| 97 |
% \fi |