I want to draw the shapes of airspaces according to the german VFR map style and I have problems with the restricted areas, ED-R44 in this picture:
(source: flightplanner.de)
I already found out how to do the airspace A and B,C,D but the fill mechanism doesn't transpose to the hatch pattern I am looking for:
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{patterns}
\tikzstyle{EDR}=[draw=red,line width=1pt,preaction={clip, postaction={pattern=north west lines, pattern color=red}}]
\tikzstyle{D}=[draw=blue,line width=1pt,preaction={clip, postaction={draw=blue,opacity=0.5,line width=12pt}}]
\begin{document}
\begin{tikzpicture}
\draw[EDR] (1,0) -- (4.5,1.5) -- (4,4) -- (1,3.5) -- (2.5,2) -- cycle;
\node at (6,2) {$\rightarrow$};
\draw[EDR] (8,0) rectangle (12,4);
\draw[fill=white,draw=none] (8.5,0.5) rectangle (11.5,3.5);
\draw[D] (13,0) rectangle (17,4);
\end{tikzpicture}
\end{document}
The problem is, that the white fill doesn't work for arbitraray polygons, but I am unable to think of a way for preaction, postaction or decoration, to make it work.
Best Answer
NEW ANSWER BASED ON YOUR OWN ANSWER: This avoids the white filling. UPDATE: One single style does the job. (I also did the blue contour.)
ORIGINAL ANSWER: Some very similar question has been answered here. Using the code written there allowed me to write a command
\DrawBorder
, which I believe does what you want. Note, however, that the present version works for polygons only. (EDIT: Added the BCD style, cleaned up the code and added explanations.)DISCLAIMER: It does not yet work with arbitrarily crazy angles (much larger than 270 degrees). Dealing with those will either require brute force, i.e. some fair amount of work, or some clever idea. I plan to revisit this task once I know that this is the way to go.