% \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 % % -------------------------------------------------------------------- % \fi