# Draw label in black, with white highlight so that it is easier to read.
#
begin highlightlabel name
	font "Helvetica-Bold", 3, "outlinewidth=1"
	color "white"
	clearpath
	move 0, 0
	label name
	font "Helvetica-Bold", 3
	color "black"
	label name
end

begin warehouse name, inventory

	# Draw stacks of 3D boxes showing inventory level at warehouse.
	#
	let x = 0
	let y = 0
	while inventory > 0
	do
		clearpath
		box3d x * 2, y, x * 2 + 2, y + 2
		color "yellow"
		fill
		color "black"
		linestyle 0.1, "round", "round"
		stroke

		let inventory = inventory - 1
		let x = x + 1
		if x == 5
		then
			let x = 0
			let y = y + 2
		endif
	done

	# Show warehouse name under boxes.
	#
	clearpath
	move -4, -3
	highlightlabel name
end

newpage "eps", "mapview4.eps", 60, 60, "background=lightpink lineantialiasing=true isolatinfonts=Helvetica-Bold"

# Import freight rail line network in Munich
#
clearpath
dataset "textfile", "muc_freight.dat", "comment=#"
worlds 11, 48, 11.5, 48.5
while Mapyrus.fetch.more
do
	fetch
	let nCoords = $1

	# Add all coordinates for this line to path.
	#
	fetch
	move $1, $2

	let i = 1
	while i < nCoords
	do
		fetch
		draw $1, $2
		let i = i + 1
	done
done

color "#000000"
linestyle 0.8
stroke
color "#aaaaaa"
linestyle 0.8, 'butt', 'bevel', 0, 2, 2
stroke

# Display symbols showing inventory levels at warehouses.
# In a real application, this information would be read from a database.
#
clearpath
move 11.115, 48.251
warehouse "Pasing", 2
clearpath
move 11.188, 48.376
warehouse "Oberschlei\337heim", 19
clearpath
move 11.357, 48.298
warehouse "Feldkirchen", 7

# Add key at bottom left of page showing how many units one box represents.
#
worlds 0, 0, Mapyrus.page.width, Mapyrus.page.height
clearpath
move 7, 7
warehouse "bedeutet 1000 Kasten", 1
