--**********************
--  EHSD
--  STEERING MODE PAGE
--  TACAN BASIC DATA
--**********************
-- TACAN (RECEIVING)
local	tcn_bearing_deg				= CreateElement "ceStringPoly"
		tcn_bearing_deg.name		= "tcn_bearing_deg"
		tcn_bearing_deg.material	= mpcd_tpod_font
		tcn_bearing_deg.init_pos	= { -0.85,  0.80, 0}
		tcn_bearing_deg.alignment	= "LeftCenter"
		tcn_bearing_deg.formats		= {"%03d;"}
		tcn_bearing_deg.stringdefs	= MPCD_large_font_size
		tcn_bearing_deg.controllers	= {{"EHSD_NAV_Mode"}, {"nav_tcn_brg"}}
Add_MPCD_VIDEO_Element(tcn_bearing_deg)

local	tcn_range_nm				= CreateElement "ceStringPoly"
		tcn_range_nm.name			= "tcn_range_nm"
		tcn_range_nm.material		= mpcd_tpod_font
		tcn_range_nm.init_pos		= { -0.30,  0.80, 0}
		tcn_range_nm.alignment		= "RightCenter"
		tcn_range_nm.formats		= {"%1.1f"}
		tcn_range_nm.stringdefs		= MPCD_large_font_size
		tcn_range_nm.controllers	= {{"EHSD_NAV_Mode"}, {"nav_tcn_rng"}}
Add_MPCD_VIDEO_Element(tcn_range_nm)

local	tcn_time_to_go				= CreateElement "ceStringPoly"
		tcn_time_to_go.name			= "tcn_time_to_go"
		tcn_time_to_go.material		= mpcd_tpod_font
		tcn_time_to_go.init_pos		= { -0.60,  0.70, 0}
		tcn_time_to_go.alignment	= "CenterCenter"
		tcn_time_to_go.formats		= {"%d:%02d"}
		tcn_time_to_go.stringdefs	= MPCD_large_font_size
		tcn_time_to_go.controllers	= {{"EHSD_NAV_Mode"}, {"nav_tcn_ttg"}}
Add_MPCD_VIDEO_Element(tcn_time_to_go)

-- NEEDLE
local	tcn_ptr_head_c				= create_mpcd_textured_box( 50, 828, 88, 873, nil, 1280)
		tcn_ptr_head_c.name			= "tcn_ptr_head_c"
		tcn_ptr_head_c.init_pos		= {0, 0, 0}
		tcn_ptr_head_c.controllers	= {{"EHSD_NAV_Mode"}, {"EHSD_MAP_EHSI"}, {"EHSD_CR_Centered"}, {"nav_tcn_prst"}, {"nav_tcn_brg_ptr"}}
Add_MPCD_VIDEO_Element(tcn_ptr_head_c)

local	tcn_ptr_tail_c				= create_mpcd_textured_box( 133, 962, 141, 1007, nil, 1409)
		tcn_ptr_tail_c.name			= "tcn_ptr_tail_c"
		tcn_ptr_tail_c.init_pos		= {0, 0, 0}
		tcn_ptr_tail_c.controllers	= {{"EHSD_NAV_Mode"}, {"EHSD_MAP_EHSI"}, {"EHSD_CR_Centered"}, {"nav_tcn_prst"}, {"nav_tcn_rad_ptr"}}
Add_MPCD_VIDEO_Element(tcn_ptr_tail_c)

local	tcn_ptr_head_d					= create_mpcd_textured_box( 50, 828, 88, 873, nil, 1535, 3)
		tcn_ptr_head_d.name				= "tcn_ptr_head_d"
		tcn_ptr_head_d.init_pos			= {0, 0, 0}
		tcn_ptr_head_d.parent_element	= MPCD_center.name
		tcn_ptr_head_d.controllers		= {{"EHSD_NAV_Mode"}, {"EHSD_MAP_EHSI"}, {"EHSD_CR_Decentered"}, {"nav_tcn_prst"}, {"nav_tcn_brg_ptr"}}
Add_MPCD_VIDEO_Element(tcn_ptr_head_d)

local	tcn_ptr_tail_d					= create_mpcd_textured_box( 133, 962, 141, 1007, nil, 1669, 3)
		tcn_ptr_tail_d.name				= "tcn_ptr_tail_d"
		tcn_ptr_tail_d.init_pos			= {0, 0, 0}
		tcn_ptr_tail_d.parent_element	= MPCD_center.name
		tcn_ptr_tail_d.controllers		= {{"EHSD_NAV_Mode"}, {"EHSD_MAP_EHSI"}, {"EHSD_CR_Decentered"}, {"nav_tcn_prst"}, {"nav_tcn_rad_ptr"}}
Add_MPCD_VIDEO_Element(tcn_ptr_tail_d)

-- SYMBOLS
local EHSD_Scale = 0.5 * GetScale()
local	tcn_loc_symbol					= create_mpcd_textured_box( 35, 958, 84, 1002, nil, nil, 3)
		tcn_loc_symbol.name				= "tcn_loc_symbol"
		tcn_loc_symbol.init_pos			= {0, 0, 0}
		tcn_loc_symbol.parent_element	= MPCD_center.name
		tcn_loc_symbol.controllers		= {{"EHSD_NAV_Mode"}, {"nav_tcn_prst"}, {"nav_tcn_pos", EHSD_Scale}}
Add_MPCD_VIDEO_Element(tcn_loc_symbol)

local	tcn_crs_line_bg					= CreateElement "ceSimpleLineObject"
		tcn_crs_line_bg.name			= "tcn_crs_line_bg"
		tcn_crs_line_bg.material   		= mpcd_ehsd_lines_bg
		tcn_crs_line_bg.width       	= 0.007
		tcn_crs_line_bg.init_pos		= {0, 0, 0}
		tcn_crs_line_bg.parent_element	= tcn_loc_symbol.name
		tcn_crs_line_bg.controllers		= {{"nav_wpt_crs_line", mpcd_steering_modes["EHSD_STR_TCN"]}}
Add_MPCD_VIDEO_Element(tcn_crs_line_bg)

local	tcn_crs_arrow_bg 				= CreateElement "ceSimpleLineObject"
		tcn_crs_arrow_bg.name 			= "tcn_crs_arrow_bg"
		tcn_crs_arrow_bg.material		= mpcd_ehsd_lines_bg
		tcn_crs_arrow_bg.width			= 0.007
		tcn_crs_arrow_bg.init_pos		= {0, 0, 0}
		tcn_crs_arrow_bg.parent_element	= tcn_loc_symbol.name
		tcn_crs_arrow_bg.controllers	= {{"nav_crs_arrow", mpcd_steering_modes["EHSD_STR_TCN"]}}
Add_MPCD_VIDEO_Element(tcn_crs_arrow_bg)

local	tcn_crs_line					= CreateElement "ceSimpleLineObject"
		tcn_crs_line.name				= "tcn_crs_line"
		tcn_crs_line.material   		= mpcd_ehsd_lines_fg
		tcn_crs_line.width       		= 0.005
		tcn_crs_line.init_pos			= {0, 0, 0}
		tcn_crs_line.parent_element		= tcn_loc_symbol.name
		tcn_crs_line.controllers		= {{"nav_wpt_crs_line", mpcd_steering_modes["EHSD_STR_TCN"]}}
Add_MPCD_VIDEO_Element(tcn_crs_line)

local	tcn_crs_arrow 					= CreateElement "ceSimpleLineObject"
		tcn_crs_arrow.name 				= "tcn_crs_arrow"
		tcn_crs_arrow.material			= mpcd_ehsd_lines_fg
		tcn_crs_arrow.width				= 0.005
		tcn_crs_arrow.init_pos			= {0, 0, 0}
		tcn_crs_arrow.parent_element	= tcn_loc_symbol.name
		tcn_crs_arrow.controllers		= {{"nav_crs_arrow", mpcd_steering_modes["EHSD_STR_TCN"]}}
Add_MPCD_VIDEO_Element(tcn_crs_arrow)

local	tcn_os_loc_symbol					= create_mpcd_textured_box( 34, 900, 83, 944, nil, nil, 3)
		tcn_os_loc_symbol.name				= "tcn_os_loc_symbol"
		tcn_os_loc_symbol.init_pos			= {0, 0, 0}
		tcn_os_loc_symbol.parent_element	= MPCD_center.name
		tcn_os_loc_symbol.controllers		= {{"EHSD_NAV_Mode"}, {"nav_tcn_os_prst"}, {"nav_tcn_os_pos", EHSD_Scale}}
Add_MPCD_VIDEO_Element(tcn_os_loc_symbol)

local	tos_crs_line_bg					= CreateElement "ceSimpleLineObject"
		tos_crs_line_bg.name			= "tos_crs_line_bg"
		tos_crs_line_bg.material   		= mpcd_ehsd_lines_bg
		tos_crs_line_bg.width       	= 0.007
		tos_crs_line_bg.init_pos		= {0, 0, 0}
		tos_crs_line_bg.parent_element	= tcn_os_loc_symbol.name
		tos_crs_line_bg.controllers		= {{"nav_wpt_crs_line", mpcd_steering_modes["EHSD_STR_TOS"]}}
Add_MPCD_VIDEO_Element(tos_crs_line_bg)

local	tos_crs_arrow_bg				= CreateElement "ceSimpleLineObject"
		tos_crs_arrow_bg.name			= "tos_crs_arrow_bg"
		tos_crs_arrow_bg.material		= mpcd_ehsd_lines_bg
		tos_crs_arrow_bg.width			= 0.007
		tos_crs_arrow_bg.init_pos		= {0, 0, 0}
		tos_crs_arrow_bg.parent_element	= tcn_os_loc_symbol.name
		tos_crs_arrow_bg.controllers	= {{"nav_crs_arrow", mpcd_steering_modes["EHSD_STR_TOS"]}}
Add_MPCD_VIDEO_Element(tos_crs_arrow_bg)

local	tos_crs_line					= CreateElement "ceSimpleLineObject"
		tos_crs_line.name				= "tos_crs_line"
		tos_crs_line.material   		= mpcd_ehsd_lines_fg
		tos_crs_line.width       		= 0.005
		tos_crs_line.init_pos			= {0, 0, 0}
		tos_crs_line.parent_element		= tcn_os_loc_symbol.name
		tos_crs_line.controllers		= {{"nav_wpt_crs_line", mpcd_steering_modes["EHSD_STR_TOS"]}}
Add_MPCD_VIDEO_Element(tos_crs_line)

local	tos_crs_arrow					= CreateElement "ceSimpleLineObject"
		tos_crs_arrow.name				= "tos_crs_arrow"
		tos_crs_arrow.material			= mpcd_ehsd_lines_fg
		tos_crs_arrow.width				= 0.005
		tos_crs_arrow.init_pos			= {0, 0, 0}
		tos_crs_arrow.parent_element	= tcn_os_loc_symbol.name
		tos_crs_arrow.controllers        = {{"nav_crs_arrow", mpcd_steering_modes["EHSD_STR_TOS"]}}
Add_MPCD_VIDEO_Element(tos_crs_arrow)

-- COURSE LINE TICKS
for i = 1,10 do --Max tick marks in any mode
	local 	tcn_crs_line_tick_bg				= CreateElement "ceSimpleLineObject"
			tcn_crs_line_tick_bg.name			= "tcn_crs_line_tick_bg_" .. string.format("%02d", i)
			tcn_crs_line_tick_bg.material 		= mpcd_ehsd_lines_bg
			tcn_crs_line_tick_bg.width			= 0.007
			tcn_crs_line_tick_bg.init_pos 		= {0, 0, 0}
			tcn_crs_line_tick_bg.parent_element = tcn_loc_symbol.name;
			tcn_crs_line_tick_bg.controllers 	= {{"nav_crs_tick", mpcd_steering_modes["EHSD_STR_TCN"], i}}
	Add_MPCD_VIDEO_Element(tcn_crs_line_tick_bg)
	
	local 	tcn_crs_line_tick				= CreateElement "ceSimpleLineObject"
			tcn_crs_line_tick.name			= "tcn_crs_line_tick_" .. string.format("%02d", i)
			tcn_crs_line_tick.material 		= mpcd_ehsd_lines_fg
			tcn_crs_line_tick.width			= 0.005
			tcn_crs_line_tick.init_pos 		= {0, 0, 0}
			tcn_crs_line_tick.parent_element = tcn_loc_symbol.name;
			tcn_crs_line_tick.controllers 	= {{"nav_crs_tick", mpcd_steering_modes["EHSD_STR_TCN"], i}}
	Add_MPCD_VIDEO_Element(tcn_crs_line_tick)
	
	local 	tos_crs_line_tick_bg				= CreateElement "ceSimpleLineObject"
			tos_crs_line_tick_bg.name			= "tos_crs_line_tick_bg_" .. string.format("%02d", i)
			tos_crs_line_tick_bg.material 		= mpcd_ehsd_lines_bg
			tos_crs_line_tick_bg.width			= 0.007
			tos_crs_line_tick_bg.init_pos 		= {0, 0, 0}
			tos_crs_line_tick_bg.parent_element = tcn_os_loc_symbol.name;
			tos_crs_line_tick_bg.controllers 	= {{"nav_crs_tick", mpcd_steering_modes["EHSD_STR_TOS"], i}}
	Add_MPCD_VIDEO_Element(tos_crs_line_tick_bg)
	
	local 	tos_crs_line_tick				= CreateElement "ceSimpleLineObject"
			tos_crs_line_tick.name			= "tos_crs_line_tick_" .. string.format("%02d", i)
			tos_crs_line_tick.material 		= mpcd_ehsd_lines_fg
			tos_crs_line_tick.width			= 0.005
			tos_crs_line_tick.init_pos 		= {0, 0, 0}
			tos_crs_line_tick.parent_element = tcn_os_loc_symbol.name;
			tos_crs_line_tick.controllers 	= {{"nav_crs_tick", mpcd_steering_modes["EHSD_STR_TOS"], i}}
	Add_MPCD_VIDEO_Element(tos_crs_line_tick)
end