layout extra_lines
	# C��digos metapost para defini����o de s��mbolos extra
	code metapost

		def l_u_walkway_metalic(expr P) =
			picture walkway_image;

			walkway_image := image(l_u_walkway_main(P));
			thdraw walkway_image withcolor (0.71, 0.71, 0.71);
		enddef;

		def l_u_walkway_soil(expr P) =
			picture walkway_image;

			walkway_image := image(l_u_walkway_main(P));
			thdraw walkway_image withcolor  (0.7, 0.49, 0);
		enddef;

		def l_u_walkway_stone(expr P) =
			picture walkway_image;

			walkway_image := image(l_u_walkway_main(P));
			thdraw walkway_image withcolor (0.32, 0.32, 0.32);
		enddef;

		def l_u_walkway_wood(expr P) =
			picture walkway_image;

			walkway_image := image(l_u_walkway_main(P));
			thdraw walkway_image withcolor (0.45, 0.22, 0);
		enddef;

		def l_u_walkway(expr P) =
			l_u_walkway_main(P);
		enddef;

		def l_u_walkway_main(expr P) =
			pair tick[], d[], p[];

			T := identity;

			cursor := 0;
			totalLength := arclength P;
			elementSize := adjust_step(totalLength, 0.2u); % symbol length nudged to be multiple of path length
			distance := 0.1u;

			pickup PenD;
			forever:
				t1 := arctime (cursor + elementSize * 1/5) of P;
				t2 := arctime (cursor + elementSize * 4/5) of P;

				p1 := point t1 of P;
				p2 := point t2 of P;

				d1 := unitvector(thdir(P,t1)) * distance;
				d2 := unitvector(thdir(P,t2)) * distance;

				tick1 := p1 + (d1 rotated 90);
				tick2 := p2 + (d2 rotated 90);
				tick3 := p1 + (d1 rotated -90);
				tick4 := p2 + (d2 rotated -90);

				thdraw tick1 -- tick2;
				thdraw tick3 -- tick4;

				cursor := cursor + elementSize;
				exitif cursor > totalLength - (elementSize / 2);
			endfor;
		enddef;

		def l_u_abyssentrance(expr P) =
			path myTick, myT;

			T := identity;

			cursor := 0;
			totalLength := arclength P;
			elementSize := adjust_step(totalLength, 0.5u); % symbol length nudged to be multiple of path length
			myTick := (0,0.1u) -- (0,-0.1u);
			myT := (0,0) -- (0,-0.1u);
			pickup PenD;
			forever:
				t1 := arctime (cursor + elementSize * 1/8) of P;
				t2 := arctime (cursor + elementSize * 2/8) of P;
				t3 := arctime (cursor + elementSize * 4/8) of P;
				t4 := arctime (cursor + elementSize * 6/8) of P;
				t5 := arctime (cursor + elementSize * 7/8) of P;

				thdraw myTick rotated angle(thdir(P,t1)) shifted (point t1 of P);
				thdraw (subpath (t2,t4) of P);
				thdraw myT rotated (180+angle(thdir(P,t3))) shifted (point t3 of P);
				thdraw myTick rotated angle(thdir(P,t5)) shifted (point t5 of P);

				cursor := cursor + elementSize;
				exitif cursor > totalLength - (elementSize / 2);
			endfor;
		enddef;

		def l_u_dripline(expr P) =
			path myTick;

			T := identity;

			cursor := 0;
			totalLength := arclength P;
			elementSize := adjust_step(totalLength, 0.5u); % symbol length nudged to be multiple of path length
			myTick := (0,0.1u) -- (0,-0.1u);
			pickup PenD;
			forever:
				t1 := arctime (cursor + elementSize * 1/8) of P;
				t2 := arctime (cursor + elementSize * 2/8) of P;
				t3 := arctime (cursor + elementSize * 4/8) of P;
				t4 := arctime (cursor + elementSize * 6/8) of P;
				t5 := arctime (cursor + elementSize * 7/8) of P;

				thdraw myTick rotated angle(thdir(P,t1)) shifted (point t1 of P);
				thdraw (subpath (t2,t4) of P);
				thdraw myTick rotated angle(thdir(P,t5)) shifted (point t5 of P);

				cursor := cursor + elementSize;
				exitif cursor > totalLength - (elementSize / 2);
			endfor;
		enddef;

		def l_u_fault(expr P) =
			path myDot;
			pair Ppb, Pdb, Pvb, Ppe, Pde, Pve;

			T := identity;

			pickup PenA;
			thdraw P;

			cursor := 0;
			totalLength := arclength P;
			elementSize := adjust_step(totalLength, 0.5u); % symbol length nudged to be multiple of path length
			myDot := (0,-0.05u) -- (0,0.05u);
			pickup PenC;
			distance := 0.2u;
			forever:
				t0 := arctime (cursor + elementSize * 1/8) of P;
				t1 := arctime (cursor + elementSize * 5/8) of P;
				t2 := arctime (cursor + elementSize * 7/8) of P;

				Ppb := (point t0 of P);
				Pdb := unitvector(thdir(P,t0));
				Pvb := Pdb rotated -90;
				Ppe := (point t1 of P);
				Pde := unitvector(thdir(P,t1));
				Pve := Pde rotated -90;

				if cursor > 0:
					thdraw (Ppb - distance * Pvb) -- (Ppe - distance * Pve);
				fi;

				thdraw myDot rotated (angle(thdir(P,t2))+90) shifted (point t2 of P + distance * unitvector(thdir(P,t2) rotated 90));

				cursor := cursor + elementSize;
				exitif cursor > totalLength - (elementSize / 2);
			endfor;
		enddef;

		def l_u_joint(expr P) =
			T := identity;

			cursor := 0;
			totalLength := arclength P;
			elementSize := adjust_step(totalLength, u); % symbol length nudged to be multiple of path length
			pickup PenC;
			forever:
				t0 := arctime (cursor + elementSize * 3/22) of P;
				t1 := arctime (cursor + elementSize * 10/22) of P;
				t2 := arctime (cursor + elementSize * 16/22) of P;
				t3 := arctime (cursor + elementSize * 19/22) of P;

				thdraw (subpath (t0,t1) of P);
				thdraw (subpath (t2,t3) of P);

				cursor := cursor + elementSize;
				exitif cursor > totalLength - (elementSize / 2);
			endfor;
		enddef;

		def l_u_lowceiling(expr P) =
			path myT;

			T := identity;

			cursor := 0;
			totalLength := arclength P;
			elementSize := adjust_step(totalLength, 0.5u); % symbol length nudged to be multiple of path length
			myT := (0,0) -- (0,-0.1u);
			pickup PenD;
			forever:
				t1 := arctime (cursor + elementSize * 1/7) of P;
				t2 := arctime (cursor + elementSize * 3/7) of P;
				t3 := arctime (cursor + elementSize * 4/7) of P;
				t4 := arctime (cursor + elementSize * 6/7) of P;

				thdraw (subpath (t1,t4) of P);
				thdraw myT rotated (180+angle(thdir(P,t2))) shifted (point t2 of P);
				thdraw myT rotated (180+angle(thdir(P,t3))) shifted (point t3 of P);

				cursor := cursor + elementSize;
				exitif cursor > totalLength - (elementSize / 2);
			endfor;
		enddef;

		def l_u_pitchimney(expr P) =
			path myTsmall, myTlarge;

			T := identity;

			cursor := 0;
			totalLength := arclength P;
			elementSize := adjust_step(totalLength, 0.5u); % symbol length nudged to be multiple of path length
			myTsmall := (0,0) -- (0,-0.1u);
			myTlarge := (0,0) -- (0,-0.175u);
			pickup PenD;
			forever:
				t1 := arctime (cursor + elementSize * 1/6) of P;
				t2 := arctime (cursor + elementSize * 2/6) of P;
				t3 := arctime (cursor + elementSize * 3/6) of P;
				t4 := arctime (cursor + elementSize * 4/6) of P;
				t5 := arctime (cursor + elementSize * 5/6) of P;

				thdraw (subpath (t1,t5) of P);

				thdraw myTsmall rotated (180+angle(thdir(P,t2))) shifted (point t2 of P);
				thdraw myTlarge rotated (180+angle(thdir(P,t3))) shifted (point t3 of P);
				thdraw myTsmall rotated (180+angle(thdir(P,t4))) shifted (point t4 of P);

				cursor := cursor + elementSize;
				exitif cursor > totalLength - (elementSize / 2);
			endfor;
		enddef;

	endcode
	
endlayout

text en "line u:walkway_metalic" "walkway metalic"
text pt "line u:walkway_metalic" "passarela met��lica"

text en "line u:walkway_soil" "walkway soil"
text pt "line u:walkway_soil" "passarela de terra"

text en "line u:walkway_stone" "walkway stone"
text pt "line u:walkway_stone" "passarela em pedra"

text en "line u:walkway_wood" "walkway wood"
text pt "line u:walkway_wood" "passarela de madeira"

text en "line u:walkway" "walkway"
text pt "line u:walkway" "passarela"

text en "line u:pitchimney" "pit/chimney"
text pt "line u:pitchimney" "po��o e chamin��"

text en "line u:lowceiling" "low ceiling"
text pt "line u:lowceiling" "teto baixo"

text en "line u:joint" "joint"
text pt "line u:joint" "fratura"

text en "line u:fault" "fault"
text pt "line u:fault" "falha"

text en "line u:dripline" "dripline"
text pt "line u:dripline" "linha de gotejamento"

text en "line u:abyssentrance" "abyss entrance"
text pt "line u:abyssentrance" "entrada em abismo"
