}
// $$$ begin - added, VS Renganathan 13 Oct 2K
-#ifdef FIGHTER_HUD
+// #ifdef FIGHTER_HUD
float get_Vx ( void )
{
- float Vxx = current_aircraft.fdm_state->get_V_north_rel_ground();
+ // CLO - 5 Jan 2000 - something needs to get addressed here
+ // float Vxx = current_aircraft.fdm_state->get_V_north_rel_ground();
+ float Vxx = 0;
return (Vxx);
}
float get_Vy ( void )
{
- float Vyy = current_aircraft.fdm_state->get_V_east_rel_ground();
+ // CLO - 5 Jan 2000 - something needs to get addressed here
+ // float Vyy = current_aircraft.fdm_state->get_V_east_rel_ground();
+ float Vyy = 0;
return (Vyy);
}
float get_Vz ( void )
{
- float Vzz = current_aircraft.fdm_state->get_V_down_rel_ground();
+ // CLO - 5 Jan 2000 - something needs to get addressed here
+ // float Vzz = current_aircraft.fdm_state->get_V_down_rel_ground();
+ float Vzz = 0;
return (Vzz);
}
FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
return fdm->get_aux18();
}
-#endif
+// #endif
// $$$ end - added, VS Renganathan 13 Oct 2K
#include <GL/glut.h>
#include <stdlib.h>
#include <string.h>
+#include <fstream.h>
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
+#include <simgear/misc/props.hxx>
//#include <simgear/math/fg_random.h>
//#include <simgear/math/polar3d.hxx>
float HUD_matrix[16];
static float hud_trans_alpha = 0.67f;
+
+//$$$ begin - added, Neetha, 28 Nov 2k
+
+string name;
+int x;
+int y;
+UINT width;
+UINT height;
+float factor;
+float span_units;
+float division_units;
+float minor_division = 0;
+UINT screen_hole;
+UINT lbl_pos;
+bool working;
+string loadfn;
+UINT options;
+float maxValue;
+float minValue;
+float scaling;
+UINT major_divs;
+UINT minor_divs;
+UINT modulator;
+int dp_showing = 0;
+string label_format;
+string prelabel;
+string postlabel;
+int justi;
+int blinking;
+float maxBankAngle;
+float maxSlipAngle;
+UINT gap_width;
+bool latitude;
+bool longitude;
+bool tick_bottom;
+bool tick_top;
+bool tick_right;
+bool tick_left;
+bool cap_bottom;
+bool cap_top;
+bool cap_right;
+bool cap_left;
+float marker_off;
+string type;
+bool enable_pointer;
+string type_pointer;
+bool frl_spot;
+bool target;
+bool vel_vector;
+bool drift;
+bool alpha;
+bool energy;
+bool climb_dive;
+bool glide;
+float glide_slope_val;
+bool worm_energy;
+bool waypoint;
+
+FLTFNPTR load_fn;
+fgLabelJust justification;
+const char *pre_label_string = 0;
+const char *post_label_string = 0;
+
+int readHud( istream &input );
+int readInstrument ( const SGPropertyNode * node);
+static instr_item * readLadder ( const SGPropertyNode * node);
+static instr_item * readCard ( const SGPropertyNode * node);
+static instr_item * readLabel( const SGPropertyNode * node);
+static instr_item * readTBI( const SGPropertyNode * node);
+//$$$ end - added, Neetha, 28 Nov 2k
+
void fgHUDalphaInit( void );
class locRECT {
#define INSTRDEFS 21
-int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
+//$$$ begin - added, Neetha, 28 Nov 2k
+static instr_item *
+readLadder(const SGPropertyNode * node)
{
- instr_item *HIptr;
- // int index;
-
- // $$$ begin - added VS Renganathan
-#ifdef FIGHTER_HUD
- // int off = 400;
- int min_x = 200;
- int max_x = 440;
- // int min_y = 100;
- int max_y = 380;
- int cen_x = 320;
- int cen_y = 240;
- unsigned int text_h = 10;
- unsigned int ladr_w2 = 60;
- int ladr_h2 = 90;
- int ladr_t = 35;
- int compass_w = 120;
- int gap = 10;
-#else
- // $$$ end - added VS Renganathan
-
- // int off = 50;
- int min_x = 25; //off/2;
- int max_x = 615; //640-(off/2);
- // int min_y = off;
- int max_y = 430; //480-off;
- int cen_x = 320;
- int cen_y = 240;
- unsigned int text_h = 10;
- unsigned int ladr_w2 = 60;
- int ladr_h2 = 90;
- int ladr_t = 35;
- int compass_w = 200;
- int gap = 10;
-#endif
-// int font_size = globals->get_options()->get_xsize() / 60;
- int font_size = (globals->get_options()->get_xsize() > 1000) ? LARGE : SMALL;
-
- HUD_style = 1;
-
- FG_LOG( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD" );
-
-// deque < instr_item * > :: iterator first = HUD_deque.begin();
-// deque < instr_item * > :: iterator last = HUD_deque.end();
-// HUD_deque.erase( first, last); // empty the HUD deque
-
- HUD_deque.erase( HUD_deque.begin(), HUD_deque.end()); // empty the HUD deque
-
-// hud->code = 1;
-// hud->status = 0;
-
- // For now lets just hardcode the hud here.
- // In the future, hud information has to come from the same place
- // aircraft information came from.
-
-// fgHUDSetTimeMode( hud, NIGHT );
-// fgHUDSetBrightness( hud, BRT_LIGHT );
-
-// case 0: // TBI
-// int x = 290; /*cen_x-30*/
-// int y = 45; /*off-5*/
-// HIptr = (instr_item *) new fgTBI_instr( x, y, ladr_w2, text_h );
-// $$$ begin - added, VS Renganathan 13 Oct 2K
-#ifdef FIGHTER_HUD
-// case 1: // Artificial Horizon
- HIptr = (instr_item *) new HudLadder( cen_x-ladr_w2, cen_y-ladr_h2,
- 2*ladr_w2, 2*ladr_h2 );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 4: // GYRO COMPASS
- HIptr = (instr_item *) new hud_card( cen_x-(compass_w/2),
- cen_y+8.0, //CENTER_DIAMOND_SIZE
- compass_w,
- 28,
- get_heading,
- HUDS_TOP,
- 360, 0,
- 1.0,
- 10, 1,
- 360,
- 0,
- 25,
- true);
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 10: // Digital KIAS
- HIptr = (instr_item *) new instr_label ( cen_x-190,
- cen_y+25,
- 40,
- 30,
- get_speed,
- "%5.0f",
- NULL,
- " ",
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-// Mach no
- HIptr = (instr_item *) new instr_label ( cen_x-180,
- cen_y+5,
- 40,
- 30,
- get_mach,
- "%5.2f",
- NULL,
- " ",
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-// Pressure Altitude
- HIptr = (instr_item *) new instr_label ( cen_x+110,
- cen_y+25,
- 40,
- 30,
- get_altitude,
- "%5.0f",
- NULL,
- " ",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-// Radio Altitude
- HIptr = (instr_item *) new instr_label ( cen_x+110,
- cen_y+5,
- 40,
- 30,
- get_agl,
- "%5.0f",
- NULL,
- " R",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 2: // AOA
- HIptr = (instr_item *) new hud_card( cen_x-145.0, //min_x +18,
- cen_y-190,
- 28,
- 120,
- get_aoa,
- HUDS_LEFT | HUDS_VERT,
-// HUDS_RIGHT | HUDS_VERT,
- 30.0, -15.0,
- 1.0,
- 10, 2,
- 0,
- 0,
- 60.0,
- true);
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-// case 2: // normal acceleration at cg, g's
- HIptr = (instr_item *) new hud_card( cen_x-185, //min_x +18,
- cen_y-220,
- 18,
- 130,
- get_anzg,
- HUDS_LEFT | HUDS_VERT,
-// HUDS_RIGHT | HUDS_VERT,
- 10.0, -5.0,
- 1.0,
- 2, 1,
- 0,
- 0,
- 20.0,
- true);
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-// case 2: // VSI
- HIptr = (instr_item *) new hud_card( (2*cen_x)-195.0, //min_x +18,
- cen_y-190,
- 28,
- 120,
- get_climb_rate, //fix
-// HUDS_LEFT | HUDS_VERT,
- HUDS_RIGHT | HUDS_VERT,
- 500.0, -500.0,
- 1.0,
- 5, 1,
- 0,
- 0,
- 15.0,
- true);
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-
-// Aux parameter 16 - xposn
- HIptr = (instr_item *) new instr_label ( cen_x+170,
- cen_y+200,
- 40,
- 30,
- get_aux16,
- "%5.1f",
- NULL,
- " pstick",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
+ instr_item *p;
+
+ name = node->getStringValue("name");
+ x = node->getIntValue("x");
+ y = node->getIntValue("y");
+ width = node->getIntValue("width");
+ height = node->getIntValue("height");
+ factor = node->getFloatValue("compression_factor");
+ span_units = node->getFloatValue("span_units");
+ division_units = node->getFloatValue("division_units");
+ screen_hole = node->getIntValue("screen_hole");
+ lbl_pos = node->getIntValue("lbl_pos");
+ frl_spot = node->getBoolValue("enable_frl",false);
+ target = node->getBoolValue("enable_target_spot",false);
+ vel_vector = node->getBoolValue("enable_velocity_vector",false);
+ drift = node->getBoolValue("enable_drift_marker",false);
+ alpha = node->getBoolValue("enable_alpha_bracket",false);
+ energy = node->getBoolValue("enable_energy_marker",false);
+ climb_dive = node->getBoolValue("enable_climb_dive_marker",false);
+ glide = node->getBoolValue("enable_glide_slope_marker",false);
+ glide_slope_val = node->getFloatValue("glide_slope",-4.0);
+ worm_energy = node->getBoolValue("enable_energy_marker",false);
+ waypoint = node->getBoolValue("enable_waypoint_marker",false);
+ working = node->getBoolValue("working");
+
+ FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
+
+
+ p = (instr_item *) new HudLadder( name, x, y,
+ width, height, factor,
+ get_roll, get_pitch,
+ span_units, division_units, minor_division,
+ screen_hole, lbl_pos, frl_spot, target, vel_vector,
+ drift, alpha, energy, climb_dive,
+ glide, glide_slope_val, worm_energy,
+ waypoint, working);
+
+ return p;
+
+} //end readLadder
-// Aux parameter 17 - xposn
- HIptr = (instr_item *) new instr_label ( cen_x+170,
- cen_y+190,
- 40,
- 30,
- get_aux17,
- "%5.1f",
- NULL,
- " rstick",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-
-
-
-
-
-
-// Aux parameter 1 - xposn
- HIptr = (instr_item *) new instr_label ( cen_x+240,
- cen_y+200,
- 40,
- 30,
- get_aux1,
- "%5.0f",
- NULL,
- " m",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// Aux parameter 2 - pla
- HIptr = (instr_item *) new instr_label ( cen_x+240,
- cen_y+190,
- 40,
- 30,
- get_aux9,
- "%5.0f",
- NULL,
- " pla",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// Aux parameter 3 - xtd
- HIptr = (instr_item *) new instr_label ( cen_x+240,
- cen_y+170,
- 40,
- 30,
- get_aux11,
- "%5.1f",
- NULL,
- " xtd",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// Aux parameter 4 - ytd
- HIptr = (instr_item *) new instr_label ( cen_x+240,
- cen_y+160,
- 40,
- 30,
- get_aux12,
- "%5.1f",
- NULL,
- " ytd",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// Aux parameter 5 - nztd
- HIptr = (instr_item *) new instr_label ( cen_x+240,
- cen_y+150,
- 40,
- 30,
- get_aux10,
- "%5.1f",
- NULL,
- " nztd",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// Aux parameter 6 - vvtd
- HIptr = (instr_item *) new instr_label ( cen_x+240,
- cen_y+140,
- 40,
- 30,
- get_aux13,
- "%5.1f",
- NULL,
- " vvtd",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// Aux parameter 7 - vtd
- HIptr = (instr_item *) new instr_label ( cen_x+240,
- cen_y+130,
- 40,
- 30,
- get_aux14,
- "%5.1f",
- NULL,
- " vtd",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// Aux parameter 8 - alftd
- HIptr = (instr_item *) new instr_label ( cen_x+240,
- cen_y+120,
- 40,
- 30,
- get_aux15,
- "%5.1f",
- NULL,
- " alftd",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// Aux parameter 9 - fnr
- HIptr = (instr_item *) new instr_label ( cen_x+240,
- cen_y+100,
- 40,
- 30,
- get_aux8,
- "%5.1f",
- NULL,
- " fnose",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// Aux parameter 10 - Ax
- HIptr = (instr_item *) new instr_label ( cen_x+240,
- cen_y+90,
- 40,
- 30,
- get_Ax,
- "%5.2f",
- NULL,
- " Ax",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-#else
-// $$$ end - added , VS Renganathan 13 Oct 2K
-
- HIptr = (instr_item *) new fgTBI_instr( 290, 45, 60, 10 );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 1: // Artificial Horizon
- HIptr = (instr_item *) new HudLadder( cen_x-ladr_w2, cen_y-ladr_h2,
- 2*ladr_w2, 2*ladr_h2 );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 4: // GYRO COMPASS
- HIptr = (instr_item *) new hud_card( cen_x-(compass_w/2),
- max_y,
- compass_w,
- 28,
- get_heading,
- HUDS_TOP,
- 360, 0,
- 1.0,
- 5, 1,
- 360,
- 0,
- 25,
- true);
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 5: // AMSL
- HIptr = (instr_item *) new hud_card( max_x - 35 -15, // 15 to balance speed card
- cen_y-(compass_w/2),
- 35,
- compass_w,
- get_altitude,
-// HUDS_RIGHT | HUDS_VERT,
- HUDS_LEFT | HUDS_VERT,
- 5000, -1000,
- 1.0,
- 100, 25,
- 0,
- 0,
- 250,
- true);
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 6:
- HIptr = (instr_item *) new guage_instr( cen_x-50, // x
- cen_y + ladr_h2 -20, // y
- 100, // width
- 20, // height
- get_aileronval, // data source
- HUDS_BOTTOM | HUDS_NOTEXT,
- 100.0,
- +1.0,
- -1.0);
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 3: // Radio Altimeter
- HIptr = (instr_item *) new hud_card( cen_x + ladr_w2 + gap + 13 + ladr_t,
- cen_y-75,
- 25,
- 150,
- get_agl,
- HUDS_LEFT | HUDS_VERT,
- 1000, 0,
- 1.0,
- 25, 5,
- 0,
- 0,
- 200.0,
- true);
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 7:
- HIptr = (instr_item *) new guage_instr( cen_x -ladr_w2 -gap -13 -20 -ladr_t,
- cen_y-50, // y
- 20, // width
- 100, // height
- get_elevatorval, // data source
- HUDS_RIGHT | HUDS_VERT | HUDS_NOTEXT,
- -100.0, // Scale data
- +1.0, // Data Range
- -1.0);
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 8:
- HIptr = (instr_item *) new guage_instr( cen_x-50, // x
- cen_y -gap -ladr_w2 -20, //-85 // y
- 100, // width
- 20, // height
- get_rudderval, // data source
- HUDS_TOP | HUDS_NOTEXT,
- 100.0,
- +1.0,
- -1.0);
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 2: // KIAS
- HIptr = (instr_item *) new hud_card( min_x +10 +5, //min_x +18,
- cen_y-(compass_w/2),
- 28,
- compass_w,
- get_speed,
-// HUDS_LEFT | HUDS_VERT,
- HUDS_RIGHT | HUDS_VERT,
- 200.0, 0.0,
- 1.0,
- 10, 5,
- 0,
- 0,
- 50.0,
- true);
+static instr_item *
+readCard(const SGPropertyNode * node)
+{
-
+ instr_item *p;
+
+ name = node->getStringValue("name");
+ x = node->getIntValue("x");
+ y = node->getIntValue("y");
+ width = node->getIntValue("width");
+ height = node->getIntValue("height");
+ loadfn = node->getStringValue("loadfn");
+ options = node->getIntValue("options");
+ maxValue = node->getFloatValue("maxValue");
+ minValue = node->getFloatValue("minValue");
+ scaling = node->getFloatValue("disp_scaling");
+ major_divs = node->getIntValue("major_divs");
+ minor_divs = node->getIntValue("minor_divs");
+ modulator = node->getIntValue("modulator");
+ span_units = node->getFloatValue("value_span");
+ type = node->getStringValue("type");
+ tick_bottom = node->getBoolValue("tick_bottom",false);
+ tick_top = node->getBoolValue("tick_top",false);
+ tick_right = node->getBoolValue("tick_right",false);
+ tick_left = node->getBoolValue("tick_left",false);
+ cap_bottom = node->getBoolValue("cap_bottom",false);
+ cap_top = node->getBoolValue("cap_top",false);
+ cap_right = node->getBoolValue("cap_right",false);
+ cap_left = node->getBoolValue("cap_left",false);
+ marker_off = node->getFloatValue("marker_offset",0.0);
+ enable_pointer = node->getBoolValue("enable_pointer",true);
+ type_pointer = node->getStringValue("pointer_type");
+ working = node->getBoolValue("working");
+
+
+ FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
+
+
+ if(type=="guage")
+ span_units = maxValue - minValue;
+
+ if(loadfn=="anzg")
+ load_fn = get_anzg;
+ else
+ if(loadfn=="heading")
+ load_fn = get_heading;
+ else
+ if(loadfn=="aoa")
+ load_fn = get_aoa;
+ else
+ if(loadfn=="climb")
+ load_fn = get_climb_rate;
+ else
+ if(loadfn=="altitude")
+ load_fn = get_altitude;
+ else
+ if(loadfn=="agl")
+ load_fn = get_agl;
+ else
+ if(loadfn=="speed")
+ load_fn = get_speed;
+ else
+ if(loadfn=="view_direction")
+ load_fn = get_view_direction;
+ else
+ if(loadfn=="aileronval")
+ load_fn = get_aileronval;
+ else
+ if(loadfn=="elevatorval")
+ load_fn = get_elevatorval;
+ else
+ if(loadfn=="rudderval")
+ load_fn = get_rudderval;
+ else
+ if(loadfn=="throttleval")
+ load_fn = get_throttleval;
+
+
+ p = (instr_item *) new hud_card( x,
+ y,
+ width,
+ height,
+ load_fn,
+ options,
+ maxValue, minValue,
+ scaling,
+ major_divs, minor_divs,
+ modulator,
+ dp_showing,
+ span_units,
+ type,
+ tick_bottom,
+ tick_top,
+ tick_right,
+ tick_left,
+ cap_bottom,
+ cap_top,
+ cap_right,
+ cap_left,
+ marker_off,
+ enable_pointer,
+ type_pointer,
+ working);
+ return p;
+}// end readCard
+
+static instr_item *
+readLabel(const SGPropertyNode * node)
+{
+ instr_item *p;
+
+ int font_size = (globals->get_options()->get_xsize() > 1000) ? LARGE : SMALL;
+
+ name = node->getStringValue("name");
+ x = node->getIntValue("x");
+ y = node->getIntValue("y");
+ width = node->getIntValue("width");
+ height = node->getIntValue("height");
+ loadfn = node->getStringValue("data_source");
+ label_format = node->getStringValue("label_format");
+ prelabel = node->getStringValue("pre_label_string");
+ postlabel = node->getStringValue("post_label_string");
+ scaling = node->getFloatValue("scale_data");
+ options = node->getIntValue("options");
+ justi = node->getIntValue("justification");
+ blinking = node->getIntValue("blinking");
+ latitude = node->getBoolValue("latitude",false);
+ longitude = node->getBoolValue("longitude",false);
+ working = node->getBoolValue("working");
+
+
+ FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
+
+
+ if(justi==0)
+ justification = LEFT_JUST;
+ else
+ if(justi==1)
+ justification = CENTER_JUST;
+ else
+ if(justi==2)
+ justification = RIGHT_JUST;
+
+
+ if(prelabel=="NULL")
+ pre_label_string = NULL;
+ else
+ if(prelabel=="blank")
+ pre_label_string = " ";
+ else
+ pre_label_string = prelabel.c_str();
+
+
+ if(postlabel=="blank")
+ post_label_string = " ";
+ else
+ if(postlabel=="NULL")
+ post_label_string = NULL;
+ else
+ if(postlabel=="units")
+ post_label_string = units;
+ else
+ post_label_string = postlabel.c_str();
- HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+ if(loadfn=="aux16")
+ load_fn = get_aux16;
+ else
+ if(loadfn=="aux17")
+ load_fn = get_aux17;
+ else
+ if(loadfn=="aux9")
+ load_fn = get_aux9;
+ else
+ if(loadfn=="aux11")
+ load_fn = get_aux11;
+ else
+ if(loadfn=="aux12")
+ load_fn = get_aux12;
+ else
+ if(loadfn=="aux10")
+ load_fn = get_aux10;
+ else
+ if(loadfn=="aux13")
+ load_fn = get_aux13;
+ else
+ if(loadfn=="aux14")
+ load_fn = get_aux14;
+ else
+ if(loadfn=="aux15")
+ load_fn = get_aux15;
+ else
+ if(loadfn=="aux8")
+ load_fn = get_aux8;
+ else
+ if(loadfn=="ax")
+ load_fn = get_Ax;
+ else
+ if(loadfn=="speed")
+ load_fn = get_speed;
+ else
+ if(loadfn=="mach")
+ load_fn = get_mach;
+ else
+ if(loadfn=="altitude")
+ load_fn = get_altitude;
+ else
+ if(loadfn=="agl")
+ load_fn = get_agl;
+ else
+ if(loadfn=="framerate")
+ load_fn = get_frame_rate;
+ else
+ if(loadfn=="heading")
+ load_fn = get_heading;
+ else
+ if(loadfn=="fov")
+ load_fn = get_fov;
+ else
+ if(loadfn=="vfc_tris_culled")
+ load_fn = get_vfc_tris_culled;
+ else
+ if(loadfn=="vfc_tris_drawn")
+ load_fn = get_vfc_tris_drawn;
+ else
+ if(loadfn=="aoa")
+ load_fn = get_aoa;
+ else
+ if(loadfn=="latitude")
+ load_fn = get_latitude;
+ else
+ if(loadfn=="longitude")
+ load_fn = get_longitude;
+
+
+ p = (instr_item *) new instr_label ( x,
+ y,
+ width,
+ height,
+ load_fn,
+ label_format.c_str(),
+ pre_label_string,
+ post_label_string,
+ scaling,
+ options,
+ justification,
+ font_size,
+ blinking,
+ latitude,
+ longitude,
+ working);
+
+ return p;
+
+} // end readLabel
+
+static instr_item *
+readTBI(const SGPropertyNode * node)
+{
+
+ instr_item *p;
+
+ name = node->getStringValue("name");
+ x = node->getIntValue("x");
+ y = node->getIntValue("y");
+ width = node->getIntValue("width");
+ height = node->getIntValue("height");
+ maxBankAngle = node->getFloatValue("maxBankAngle");
+ maxSlipAngle = node->getFloatValue("maxSlipAngle");
+ gap_width = node->getIntValue("gap_width");
+ working = node->getBoolValue("working");
+
+ FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
+
+
+ p = (instr_item *) new fgTBI_instr( x,
+ y,
+ width,
+ height,
+ get_roll,
+ get_sideslip,
+ maxBankAngle,
+ maxSlipAngle,
+ gap_width,
+ working);
+
+ return p;
+} //end readTBI
+
+
+int readInstrument(const SGPropertyNode * node)
+{
+
+ instr_item *HIptr;
+ if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
+ strcpy(units, " ft");
+ } else {
+ strcpy(units, " m");
+ }
-// case 10: // Digital Mach number
- HIptr = (instr_item *) new instr_label ( min_x , //same as speed tape
- cen_y-(compass_w/2) -10, //below speed tape
- 40,
- 30,
- get_mach,
- "%4.2f",
- "",
- NULL,
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 9:
- HIptr = (instr_item *) new guage_instr( min_x-10, // x
- cen_y -75, // y
- 20, // width
- 150, // height
- get_throttleval, // data source
-// HUDS_VERT | HUDS_RIGHT | HUDS_NOTEXT,
- HUDS_VERT | HUDS_LEFT | HUDS_NOTEXT, 100.0,
- 1.0,
- 0.0
- );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-#endif
-// Remove this when below uncommented
-// case 10:
- HIptr = (instr_item *) new instr_label( 10,
- 25,
- 60,
- 10,
- get_frame_rate,
- "%5.1f",
- "",
- NULL,
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
+ const SGPropertyNode * ladder_group = node->getNode("ladders");
+
+ if (ladder_group != 0) {
+ int nLadders = ladder_group->nChildren();
+ for (int j = 0; j < nLadders; j++) {
+
+ HIptr = readLadder(ladder_group->getChild(j));
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+ }// for - ladders
+ }
+
+ const SGPropertyNode * card_group = node->getNode("cards");
+ if (card_group != 0) {
+ int nCards = card_group->nChildren();
+ for (int j = 0; j < nCards; j++) {
+
+ HIptr = readCard(card_group->getChild(j));
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+ }//for - cards
+ }
+
+ const SGPropertyNode * label_group = node->getNode("labels");
+ if (label_group != 0) {
+ int nLabels = label_group->nChildren();
+ for (int j = 0; j < nLabels; j++) {
+
+ HIptr = readLabel(label_group->getChild(j));
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+ }//for - labels
+ }
+
+ const SGPropertyNode * tbi_group = node->getNode("tbis");
+ if (tbi_group != 0) {
+ int nTbis = tbi_group->nChildren();
+ for (int j = 0; j < nTbis; j++) {
+
+ HIptr = readTBI(tbi_group->getChild(j));
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+ }//for - tbis
+ }
+ return 0;
+}//end readinstrument
+
+int readHud( istream &input )
+{
+
+ SGPropertyNode root;
+
+
+ if (!readProperties(input, &root)) {
+ FG_LOG(FG_INPUT, FG_ALERT, "Malformed property list for hud.");
+ return 0;
+ }
-// $$$ begin - added VS Renganthan 19 Oct 2K
-#ifdef FIGHTER_HUD
- HIptr = (instr_item *) new lat_label( 70,
- 40,
- 1,
- text_h,
- get_latitude,
- "%s%", //"%.0f",
- "", //"Lat ",
- "",
- 1.0,
- HUDS_TOP,
- CENTER_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
- HIptr = (instr_item *) new lon_label( 475,
- 40,
- 1, text_h,
- get_longitude,
- "%s%",//"%.0f",
- "", //"Lon ",
- "",
- 1.0,
- HUDS_TOP,
- CENTER_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-#else
- HIptr = (instr_item *) new lat_label( (cen_x - (compass_w/2))/2,
- max_y,
- 1,
- text_h,
- get_latitude,
- "%s%", //"%.0f",
- "", //"Lat ",
- "",
- 1.0,
- HUDS_TOP,
- CENTER_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
- HIptr = (instr_item *) new lon_label(((cen_x+compass_w/2)+(2*cen_x))/2,
- max_y,
- 1, text_h,
- get_longitude,
- "%s%",//"%.0f",
- "", //"Lon ",
- "",
- 1.0,
- HUDS_TOP,
- CENTER_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-#endif
-// $$$ end - added VS Renganthan 19 Oct 2K
-/*
-// case 10: // Digital KIAS
- HIptr = (instr_item *) new instr_label ( 110,
- 150,
- 40,
- 30,
- get_speed,
- "%5.0f",
- NULL,
- " Kts",
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 11: // Digital Rate of Climb
- HIptr = (instr_item *) new instr_label ( 110,
- 135,
- 40,
- 10,
- get_climb_rate,
- "%5.0f",
- " Climb",
- NULL,
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 12: // Roll indication diagnostic
- HIptr = (instr_item *) new instr_label ( 110,
- 120,
- 40,
- 10,
- get_roll,
- "%5.2f",
- " Roll",
- " Deg",
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 13: // Angle of attack diagnostic
- HIptr = (instr_item *) new instr_label ( 440,
- 150,
- 60,
- 10,
- get_aoa,
- " %5.2f",
- "AOA",
- " Deg",
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 14:
- HIptr = (instr_item *) new instr_label ( 440,
- 135,
- 60,
- 10,
- get_heading,
- " %5.1f",
- "Heading ",
- " Deg",
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 15:
- HIptr = (instr_item *) new instr_label ( 440,
- 120,
- 60,
- 10,
- get_sideslip,
- "%5.2f",
- "Sideslip ",
- NULL,
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 16:
- HIptr = (instr_item *) new instr_label( 440,
- 100,
- 60,
- 10,
- get_throttleval,
- "%5.2f",
- "Throttle ",
- NULL,
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 17:
- HIptr = (instr_item *) new instr_label( 440,
- 85,
- 60,
- 10,
- get_elevatorval,
- "%5.2f",
- "Elevator ",
- NULL,
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 18:
- HIptr = (instr_item *) new instr_label( 440,
- 60,
- 60,
- 10,
- get_aileronval,
- "%5.2f",
- "Aileron ",
- NULL,
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 19:
- HIptr = (instr_item *) new instr_label( 10,
- 10,
- 60,
- 10,
- get_frame_rate,
- "%.1f",
- "Frame rate = ",
- NULL,
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-
-// case 20:
- switch( globals->get_options()->get_tris_or_culled() ) {
- case 0:
- HIptr = (instr_item *) new instr_label( 10,
- 25,
- 120,
- 10,
- get_vfc_tris_drawn,
- "%.0f",
- "Tris Rendered = ",
- NULL,
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- break;
- case 1:
- HIptr = (instr_item *) new instr_label( 10,
- 25,
- 90,
- 10,
- get_vfc_ratio,
- "%.2f",
- "VFC Ratio = ",
- NULL,
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- break;
- }
- break;
-
-// case 21:
- HIptr = (instr_item *) new instr_label( 10,
- 40,
- 90,
- 10,
- get_fov,
- "%.1f",
- "FOV = ",
- NULL,
- 1.0,
- HUDS_TOP,
- RIGHT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.insert( HUD_deque.begin(), HIptr);
-*/
-// default:
-// HIptr = 0;;
-// }
-// if( HIptr ) { // Anything to install?
-// HUD_deque.insert( HUD_deque.begin(), HIptr);
-// }
-// index++;
-// }
-// while( HIptr );
-
- fgHUDalphaInit();
- fgHUDReshape();
- return 0; // For now. Later we may use this for an error code.
+
+ FG_LOG(FG_INPUT, FG_INFO, "Read properties for " <<
+ root.getStringValue("name"));
+
+
+ HUD_deque.erase( HUD_deque.begin(), HUD_deque.end()); // empty the HUD deque
+
+
+ FG_LOG(FG_INPUT, FG_INFO, "Reading Hud instruments");
+
+ const SGPropertyNode * instrument_group = root.getChild("instruments");
+ int nInstruments = instrument_group->nChildren();
+
+ for (int i = 0; i < nInstruments; i++) {
+
+ const SGPropertyNode * node = instrument_group->getChild(i);
+
+ FGPath path( globals->get_options()->get_fg_root() );
+ path.append(node->getStringValue("path"));
+
+ FG_LOG(FG_INPUT, FG_INFO, "Reading Instrument "
+ << node->getName()
+ << " from "
+ << path.str());
+
+
+ SGPropertyNode root2;
+ if (readProperties(path.str(), &root2)) {
+
+ readInstrument(&root2);
+
+ }//if
+ }//for loop(i)
+ return 0;
+}
+
+
+int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
+{
+
+
+ HUD_style = 1;
+
+ FG_LOG( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD" );
+
+ string hud_path =
+ globals->get_props()->getStringValue("/sim/hud/path",
+ "Huds/Default/default.xml");
+ FGPath path(globals->get_options()->get_fg_root());
+ path.append(hud_path);
+
+ ifstream input(path.c_str());
+ if (!input.good())
+ {
+ FG_LOG(FG_INPUT, FG_ALERT,
+ "Cannot read Hud configuration from " << path.str());
+ }
+ else
+ {
+ readHud(input);
+ input.close();
+ }
+
+ fgHUDalphaInit();
+ fgHUDReshape();
+
+ return 0; // For now. Later we may use this for an error code.
}
int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
{
-// instr_item *HIptr;
-// int index;
-
- int off = 50;
-// int min_x = off;
-// int max_x = 640-off;
-// int min_y = off;
- int max_y = 480-off;
- int cen_x = 640 / 2;
- int cen_y = 480 / 2;
- int text_h = 10;
- int ladr_w2 = 60;
- int ladr_h2 = 90;
-// int ladr_t = 35;
- int compass_w = 200;
-// int gap = 10;
-
-// int font_size = globals->get_options()->get_xsize() / 60;
- int font_size = (globals->get_options()->get_xsize() > 1000) ? LARGE : SMALL;
HUD_style = 2;
FG_LOG( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD" );
-// deque < instr_item * > :: iterator first = HUD_deque.begin();
-// deque < instr_item * > :: iterator last = HUD_deque.end();
-// HUD_deque.erase( first, last); // empty the HUD deque
- HUD_deque.erase( HUD_deque.begin(), HUD_deque.end());
-
- // hud->code = 1;
- // hud->status = 0;
-
- // For now lets just hardcode the hud here.
- // In the future, hud information has to come from the same place
- // aircraft information came from.
-
- // fgHUDSetTimeMode( hud, NIGHT );
- // fgHUDSetBrightness( hud, BRT_LIGHT );
-
- // index = 0;
-// index = 19;
-
- instr_item* p;
-
- p = new HudLadder( cen_x-ladr_w2, cen_y-ladr_h2, 2*ladr_w2, 2*ladr_h2, 1 );
- HUD_deque.push_front( p );
-
-// case 4: // GYRO COMPASS
- p =new hud_card( cen_x-(compass_w/2),
- max_y,
- compass_w,
- 28,
- get_view_direction,
- HUDS_TOP,
- 360, 0,
- 1.0,
- 5, 1,
- 360,
- 0,
- 25,
- true);
- HUD_deque.push_front( p );
-
- p = new lat_label( (cen_x - compass_w/2)/2,
- max_y,
- 0, text_h,
- get_latitude,
- "%s%", //"%.0f",
- "", //"Lat ",
- "",
- 1.0,
- HUDS_TOP,
- CENTER_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.push_front( p );
-
-// p = new instr_label( 140, 450, 60, 10,
-// get_lat_min,
-// "%05.2f",
-// "",
-// NULL,
-// 1.0,
-// HUDS_TOP,
-// CENTER_JUST,
-// font_size,
-// 0,
-// TRUE );
-// HUD_deque.push_front( p );
-
- p = new lon_label(((cen_x+compass_w/2)+(2*cen_x))/2,
- max_y,
- 1, text_h,
- get_longitude,
- "%s%",//"%.0f",
- "", //"Lon ",
- "",
- 1.0,
- HUDS_TOP,
- CENTER_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.push_front( p );
-
- int x_pos = 40;
-
- p = new instr_label( x_pos, 25, 60, 10,
- get_frame_rate,
- "%7.1f",
- "Frame rate =",
- NULL,
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.push_front( p );
-#if 0
- p = new instr_label( x_pos, 40, 120, 10,
- get_vfc_tris_culled,
- "%7.0f",
- "Culled =",
- NULL,
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.push_front( p );
-
- p = new instr_label( x_pos, 55, 120, 10,
- get_vfc_tris_drawn,
- "%7.0f",
- "Rendered =",
- NULL,
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.push_front( p );
-#endif // 0
-
-// p = new instr_label( x_pos, 70, 90, 10,
- p = new instr_label( x_pos, 40, 90, 10,
- get_fov,
- "%7.1f",
- "FOV = ",
- NULL,
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.push_front( p );
-
- x_pos = 480;
-
- p = new instr_label ( x_pos,
- 70,
- 60,
- 10,
- get_aoa,
- "%7.2f",
- "AOA ",
- " Deg",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.push_front( p );
-
- p = new instr_label( x_pos, 55, 40, 30,
- get_speed,
- "%5.0f",
- "Airspeed ",
- " Kts",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.push_front( p );
+ FGPath path(globals->get_options()->get_fg_root());
+ path.append("Huds/Minimal/default.xml");
+
+
+ ifstream input(path.c_str());
+ if (!input.good()) {
+ FG_LOG(FG_INPUT, FG_ALERT,
+ "Cannot read Hud configuration from " << path.str());
+ }
+ else {
+ readHud(input);
+ input.close();
+ }
- if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
- strcpy(units, " ft");
- } else {
- strcpy(units, " m");
- }
- p = new instr_label( x_pos, 40, 40, 10,
- get_altitude,
- "%5.0f",
- "Altitude ",
- units,
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.push_front( p );
-
- p = new instr_label( x_pos, 25, 40, 10,
- get_agl,
- "%5.0f",
- "Elvation ",
- units,
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.push_front( p );
-
- p = new instr_label( x_pos, 10, 60, 10,
- get_heading,
- "%5.1f",
- "Heading ",
- " Deg",
- 1.0,
- HUDS_TOP,
- LEFT_JUST,
- font_size,
- 0,
- TRUE );
- HUD_deque.push_front( p );
-
- p = new fgTBI_instr( 290, 55, 60, 10 ); // 270
- HUD_deque.push_front( p );
-
- p = new guage_instr( 270, //250, // x
- 390, //360, //400, //45, //420, // y
- 100, // width
- 20, // height
- get_aileronval, // data source
- HUDS_BOTTOM | HUDS_NOTEXT,
- 100.0,
- +1.0,
- -1.0);
- HUD_deque.push_front( p );
-
- p = new guage_instr( 20, // x
- 240-50, // y
- 20, // width
- 100, // height
- get_elevatorval, // data source
- HUDS_RIGHT | HUDS_VERT | HUDS_NOTEXT,
- -100.0, // Scale data
- +1.0, // Data Range
- -1.0);
- HUD_deque.push_front( p );
-
- p = new guage_instr( 270, //250, // x
- 10+15, // y
- 100, // width
- 20, // height
- get_rudderval, // data source
- HUDS_TOP | HUDS_NOTEXT,
- 100.0,
- +1.0,
- -1.0);
- HUD_deque.push_front( p );
-
- p = new guage_instr( 600, // x
- 240-80,
- 20,
- 160, // height
- get_throttleval, // data source
- HUDS_VERT | HUDS_LEFT | HUDS_NOTEXT,
- 100.0,
- 1.0,
- 0.0);
- HUD_deque.push_front( p );
-
return 0; // For now. Later we may use this for an error code.
+
}
+//$$$ End - added, Neetha, 28 Nov 2k
int global_day_night_switch = DAY;
// fgPrintf( FG_COCKPIT, FG_DEBUG, "HUD Code %d Status %d\n",
// hud->code, hud->status );
pHUDInstr->draw();
+
}
}
UINT height,
UINT width,
FLTFNPTR data_source,
- float data_scaling,
+ float data_scaling,
UINT options,
- bool working = true);
+ bool working = true);
instr_item( const instr_item & image );
int fontSize;
int blink;
char format_buffer[80];
+ bool lat;
+ bool lon;
public:
instr_label( int x,
UINT height,
FLTFNPTR data_source,
const char *label_format,
- const char *pre_label_string = 0,
- const char *post_label_string = 0,
- float scale_data = 1.0,
- UINT options = HUDS_TOP,
- fgLabelJust justification = CENTER_JUST,
- int font_size = SMALL,
- int blinking = NOBLINK,
- bool working = true);
+ const char *pre_label_string,
+ const char *post_label_string,
+ float scale_data,
+ UINT options,
+ fgLabelJust justification,
+ int font_size,
+ int blinking,
+ bool latitude,
+ bool longitude,
+ bool working);
~instr_label();
UINT height,
FLTFNPTR data_source,
const char *label_format,
- const char *pre_label_string = 0,
- const char *post_label_string = 0,
- float scale_data = 1.0,
- UINT options = HUDS_TOP,
- fgLabelJust justification = CENTER_JUST,
- int font_size = SMALL,
- int blinking = NOBLINK,
- bool working = true);
+ const char *pre_label_string,
+ const char *post_label_string,
+ float scale_data,
+ UINT options,
+ fgLabelJust justification,
+ int font_size,
+ int blinking,
+ bool working);
~lat_label();
UINT height,
FLTFNPTR data_source,
const char *label_format,
- const char *pre_label_string = 0,
- const char *post_label_string = 0,
- float scale_data = 1.0,
- UINT options = HUDS_TOP,
- fgLabelJust justification = CENTER_JUST,
- int font_size = SMALL,
- int blinking = NOBLINK,
- bool working = true);
+ const char *pre_label_string,
+ const char *post_label_string,
+ float scale_data,
+ UINT options,
+ fgLabelJust justification,
+ int font_size,
+ int blinking,
+ bool working);
~lon_label();
FLTFNPTR load_fn,
UINT options,
float show_range,
- float max_value = 100.0,
- float min_value = 0.0,
- float disp_scaling = 1.0,
- UINT major_divs = 10,
- UINT minor_divs = 5,
- UINT rollover = 0,
- int dp_showing = 2,
- bool working = true);
+ float max_value,
+ float min_value,
+ float disp_scaling,
+ UINT major_divs,
+ UINT minor_divs,
+ UINT rollover,
+ int dp_showing,
+ bool working = true);
virtual ~instr_scale();
instr_scale( const instr_scale & image);
class hud_card : public instr_scale {
private:
float val_span;
+ string type;
float half_width_units;
+ bool draw_tick_bottom;
+ bool draw_tick_top;
+ bool draw_tick_right;
+ bool draw_tick_left;
+ bool draw_cap_bottom;
+ bool draw_cap_top;
+ bool draw_cap_right;
+ bool draw_cap_left;
+ float marker_offset;
+ bool pointer;
+ string pointer_type;
+
public:
hud_card( int x,
UINT height,
FLTFNPTR load_fn,
UINT options,
- float maxValue = 100.0,
- float minValue = 0.0,
- float disp_scaling = 1.0,
- UINT major_divs = 10,
- UINT minor_divs = 5,
- UINT modulator = 100,
- int dp_showing = 2,
- float value_span = 100.0,
- bool working = true);
+ float maxValue,
+ float minValue,
+ float disp_scaling,
+ UINT major_divs,
+ UINT minor_divs,
+ UINT modulator,
+ int dp_showing,
+ float value_span,
+ string type,
+ bool draw_tick_bottom,
+ bool draw_tick_top,
+ bool draw_tick_right,
+ bool draw_tick_left,
+ bool draw_cap_bottom,
+ bool draw_cap_top,
+ bool draw_cap_right,
+ bool draw_cap_left,
+ float marker_offset,
+ bool pointer,
+ string pointer_type,
+ bool working);
~hud_card();
hud_card( const hud_card & image);
UINT height,
FLTFNPTR load_fn,
UINT options,
- float disp_scaling = 1.0,
- float maxValue = 100,
- float minValue = 0,
- UINT major_divs = 50,
- UINT minor_divs = 0,
- int dp_showing = 2,
- UINT modulus = 0,
- bool working = true);
+ float disp_scaling,
+ float maxValue,
+ float minValue,
+ UINT major_divs,
+ UINT minor_divs,
+ int dp_showing,
+ UINT modulus,
+ bool working);
~guage_instr();
guage_instr( const guage_instr & image);
UINT height,
FLTFNPTR chn1_source,
FLTFNPTR chn2_source,
- bool working = true,
- UINT options = HUDS_TOP);
+ bool working,
+ UINT options );
virtual ~dual_instr_item() {};
dual_instr_item( const dual_instr_item & image);
int y,
UINT width,
UINT height,
- FLTFNPTR chn1_source = get_roll,
- FLTFNPTR chn2_source = get_sideslip,
- float maxBankAngle = 45.0,
- float maxSlipAngle = 5.0,
- UINT gap_width = 5,
- bool working = true);
+ FLTFNPTR chn1_source,
+ FLTFNPTR chn2_source,
+ float maxBankAngle,
+ float maxSlipAngle,
+ UINT gap_width,
+ bool working);
fgTBI_instr( const fgTBI_instr & image);
fgTBI_instr & operator = (const fgTBI_instr & rhs );
UINT minor_div;
UINT label_pos;
UINT scr_hole;
- UINT minimal;
- float vmax;
- float vmin;
- float factor;
+ float vmax;
+ float vmin;
+ float factor;
+ string hudladder_type;
+ bool frl;
+ bool target_spot;
+ bool velocity_vector;
+ bool drift_marker;
+ bool alpha_bracket;
+ bool energy_marker;
+ bool climb_dive_marker;
+ bool glide_slope_marker;
+ float glide_slope;
+ bool energy_worm;
+ bool waypoint_marker;
fgTextList TextList;
fgLineList LineList;
fgLineList StippleLineList;
public:
- HudLadder( int x,
+ HudLadder( string name,
+ int x,
int y,
UINT width,
UINT height,
- UINT minimal = 0,
- FLTFNPTR ptch_source = get_roll,
- FLTFNPTR roll_source = get_pitch,
- float span_units = 45.0,
- float division_units = 10.0,
- float minor_division = 0.0,
- UINT screen_hole = 70,
- UINT lbl_pos = 0,
- bool working = true );
+ float factor,
+ FLTFNPTR ptch_source,
+ FLTFNPTR roll_source,
+ float span_units,
+ float division_units,
+ float minor_division,
+ UINT screen_hole,
+ UINT lbl_pos,
+ bool frl,
+ bool target_spot,
+ bool velocity_vector,
+ bool drift_marker,
+ bool alpha_bracket,
+ bool energy_marker,
+ bool climb_dive_marker,
+ bool glide_slope_marker,
+ float glide_slope,
+ bool energy_worm,
+ bool waypoint_marker,
+ bool working);
~HudLadder();
char *msg,
void *font = GLUT_STROKE_ROMAN,
float theta = 0);
+
//extern void strokeString(float xx,
// float yy,
// char *msg,
UINT height,
FLTFNPTR data_source,
UINT options,
- float max_value, // 360
- float min_value, // 0
- float disp_scaling,
+ float max_value, // 360
+ float min_value, // 0
+ float disp_scaling,
UINT major_divs,
UINT minor_divs,
UINT modulus, // 360
int dp_showing,
- float value_span,
+ float value_span,
+ string card_type,
+ bool tick_bottom,
+ bool tick_top,
+ bool tick_right,
+ bool tick_left,
+ bool cap_bottom,
+ bool cap_top,
+ bool cap_right,
+ bool cap_left,
+ float mark_offset,
+ bool pointer_enable,
+ string type_pointer,
bool working) :
instr_scale( x,y,width,height,
data_source, options,
max_value, min_value, disp_scaling,
major_divs, minor_divs, modulus,
working),
- val_span ( value_span)
+ val_span ( value_span),
+ type ( card_type),
+ draw_tick_bottom (tick_bottom),
+ draw_tick_top (tick_top),
+ draw_tick_right (tick_right),
+ draw_tick_left (tick_left),
+ draw_cap_bottom (cap_bottom),
+ draw_cap_top (cap_top),
+ draw_cap_right (cap_right),
+ draw_cap_left (cap_left),
+ marker_offset (mark_offset),
+ pointer (pointer_enable),
+ pointer_type (type_pointer)
+
{
half_width_units = range_to_show() / 2.0;
// UINT options = get_options();
hud_card( const hud_card & image):
instr_scale( (const instr_scale & ) image),
val_span( image.val_span),
- half_width_units (image.half_width_units)
+ half_width_units (image.half_width_units),
+ draw_tick_bottom (image.draw_tick_bottom),
+ draw_tick_top (image.draw_tick_top),
+ draw_tick_right (image.draw_tick_right),
+ draw_tick_left (image.draw_tick_left),
+ draw_cap_bottom (image.draw_cap_bottom),
+ draw_cap_top (image.draw_cap_top),
+ draw_cap_right (image.draw_cap_right),
+ draw_cap_left (image.draw_cap_left),
+ marker_offset (image.marker_offset),
+ type(image.type),
+ pointer (image.pointer),
+ pointer_type (image.pointer_type)
+
{
// UINT options = get_options();
// huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
instr_scale::operator = (rhs);
val_span = rhs.val_span;
half_width_units = rhs.half_width_units;
- }
+ draw_tick_bottom = rhs.draw_tick_bottom;
+ draw_tick_top = rhs.draw_tick_top;
+ draw_tick_right = rhs.draw_tick_right;
+ draw_tick_left = rhs.draw_tick_left;
+ draw_cap_bottom = rhs.draw_cap_bottom;
+ draw_cap_top = rhs.draw_cap_top;
+ draw_cap_right = rhs.draw_cap_right;
+ draw_cap_left = rhs.draw_cap_left;
+ marker_offset = rhs.marker_offset;
+ type = rhs.type;
+ pointer = rhs.pointer;
+ pointer_type = rhs.pointer_type;
+
+ }
return *this;
}
-// $$$ begin - added, VS Renganathan, 13 Oct 2K
-#ifdef FIGHTER_HUD
void hud_card ::
draw( void ) // (HUD_scale * pscale )
{
- float vmin, vmax;
- int marker_xs;
- int marker_xe;
- int marker_ys;
- int marker_ye;
- int lenstr;
- int height, width;
- int i, last;
- char TextScale[80];
- bool condition;
- int disp_val = 0;
- POINT mid_scr = get_centroid();
- float cur_value = get_value();
- RECT scrn_rect = get_location();
- UINT options = get_options();
-
- height = scrn_rect.top + scrn_rect.bottom;
- width = scrn_rect.left + scrn_rect.right;
-
- vmin = cur_value - half_width_units; // width units == needle travel
- vmax = cur_value + half_width_units; // or picture unit span.
-
- // Draw the basic markings for the scale...
-
- if( huds_vert(options) ) { // Vertical scale
-// drawOneLine( scrn_rect.left, // Bottom tick bar
-// scrn_rect.top,
-// width,
-// scrn_rect.top);
-
-// drawOneLine( scrn_rect.left, // Top tick bar
-// height,
-// width,
-// height );
-
- marker_xs = scrn_rect.left; // x start
- marker_xe = width; // x extent
- marker_ye = height;
-
-// glBegin(GL_LINES);
-
- // Bottom tick bar
-// glVertex2f( marker_xs, scrn_rect.top);
-// glVertex2f( marker_xe, scrn_rect.top);
-
- // Top tick bar
-// glVertex2f( marker_xs, marker_ye);
-// glVertex2f( marker_xe, marker_ye );
-// glEnd();
-
- // We do not use else in the following so that combining the two
- // options produces a "caged" display with double carrots. The
- // same is done for horizontal card indicators.
-
- if( huds_left(options) ) { // Calculate x marker offset
-// drawOneLine( marker_xe, scrn_rect.top,
-// marker_xe, marker_ye); // Cap right side
-
- marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
- // Indicator carrot
-// drawOneLine( marker_xs, mid_scr.y,
-// marker_xe, mid_scr.y + scrn_rect.right / 6);
-// drawOneLine( marker_xs, mid_scr.y,
-// marker_xe, mid_scr.y - scrn_rect.right / 6);
-
- glBegin(GL_LINE_STRIP);
- glVertex2f( 10+marker_xe, mid_scr.y + scrn_rect.right / 6);
- glVertex2f( 10+marker_xs, mid_scr.y);
- glVertex2f( 10+marker_xe, mid_scr.y - scrn_rect.right / 6);
- glEnd();
- }
- if( huds_right(options) ) { // We'll default this for now.
-// drawOneLine( scrn_rect.left, scrn_rect.top,
-// scrn_rect.left, marker_ye ); // Cap left side
-
- marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
- // Indicator carrot
-// drawOneLine( scrn_rect.left, mid_scr.y + scrn_rect.right / 6,
-// marker_xe, mid_scr.y );
-// drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
-// marker_xe, mid_scr.y);
- glBegin(GL_LINE_STRIP);
- glVertex2f( -10+scrn_rect.left, mid_scr.y + scrn_rect.right / 6);
- glVertex2f( -10+marker_xe, mid_scr.y );
- glVertex2f( -10+scrn_rect.left, mid_scr.y - scrn_rect.right / 6);
- glEnd();
- }
-
- // At this point marker x_start and x_end values are transposed.
- // To keep this from confusing things they are now interchanged.
- if(huds_both(options)) {
- marker_ye = marker_xs;
- marker_xs = marker_xe;
- marker_xe = marker_ye;
- }
-
- // Work through from bottom to top of scale. Calculating where to put
- // minor and major ticks.
-
-// last = FloatToInt(vmax)+1;
-// i = FloatToInt(vmin);
- last = (int)vmax + 1;
- i = (int)vmin;
- for( ; i <last ; i++ )
- {
-
- condition = true;
- if( !modulo()) {
- if( i < min_val()) {
- condition = false;
- }
- }
-
- if( condition ) { // Show a tick if necessary
- // Calculate the location of this tick
- marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
-// marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
- // Block calculation artifact from drawing ticks below min coordinate.
- // Calculation here accounts for text height.
-
- if(( marker_ys < (scrn_rect.top + 4)) |
- ( marker_ys > (height - 4))) {
- // Magic numbers!!!
- continue;
- }
- if( div_min()) {
-// if( (i%div_min()) == 0) {
- if( !(i%(int)div_min())) {
- if((( marker_ys - 5) > scrn_rect.top ) &&
- (( marker_ys + 5) < (height))){
- if( huds_both(options) ) {
- drawOneLine( scrn_rect.left, marker_ys,
- marker_xs, marker_ys );
- drawOneLine( marker_xe, marker_ys,
- width, marker_ys );
-// glBegin(GL_LINES);
-// glVertex2f( scrn_rect.left, marker_ys );
-// glVertex2f( marker_xs, marker_ys );
-// glVertex2f( marker_xe, marker_ys);
-// glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys );
-// glEnd();
- }
- else {
- if( huds_left(options) ) {
- drawOneLine( marker_xs + 4, marker_ys,
- marker_xe, marker_ys );
- }
- else {
- drawOneLine( marker_xs, marker_ys,
- marker_xe - 4, marker_ys );
- }
- }
- }
- }
- }
- if( div_max() ) {
- if( !(i%(int)div_max()) )
- {
- if(modulo()) {
- if( disp_val < 0) {
- while(disp_val < 0)
- disp_val += modulo();
-// } else {
-// disp_val = i % (int)modulo();
- }
- disp_val = i % (int) modulo(); // ?????????
- } else {
- disp_val = i;
- }
-
- lenstr = sprintf( TextScale, "%d",
- FloatToInt(disp_val * data_scaling()/*+.5*/));
-// (int)(disp_val * data_scaling() +.5));
- if(( (marker_ys - 8 ) > scrn_rect.top ) &&
- ( (marker_ys + 8) < (height))){
- if( huds_both(options) ) {
-// drawOneLine( scrn_rect.left, marker_ys,
-// marker_xs, marker_ys);
-// drawOneLine( marker_xs, marker_ys,
-// scrn_rect.left + scrn_rect.right,
-// marker_ys);
- glBegin(GL_LINE_STRIP);
- glVertex2f( scrn_rect.left, marker_ys );
- glVertex2f( marker_xs, marker_ys);
- glVertex2f( width, marker_ys);
- glEnd();
- if( !huds_notext(options)) {
- textString ( marker_xs + 2, marker_ys,
- TextScale, GLUT_BITMAP_8_BY_13 );
- }
- }
- else {
- drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
- if( !huds_notext(options) ) {
- if( huds_left(options) ) {
- textString( marker_xs - 8 * lenstr - 2,
- marker_ys - 4,
- TextScale, GLUT_BITMAP_8_BY_13 );
- }
- else {
- textString( marker_xe + 3 * lenstr,
- marker_ys - 4,
- TextScale, GLUT_BITMAP_8_BY_13 );
- }
- }
- }
- } // Else read oriented right
- } // End if modulo division by major interval is zero
- } // End if major interval divisor non-zero
- } // End if condition
- } // End for range of i from vmin to vmax
- } // End if VERTICAL SCALE TYPE
- else { // Horizontal scale by default
-// commented
- // left tick bar
-// drawOneLine( scrn_rect.left, scrn_rect.top,
-// scrn_rect.left, height);
-
- // right tick bar
-// drawOneLine( width, scrn_rect.top,
-// width,
-// height );
-
- marker_ys = scrn_rect.top; // Starting point for
- marker_ye = height; // tick y location calcs
- marker_xe = width;
-
-// glBegin(GL_LINES);
- // left tick bar
-// glVertex2f( scrn_rect.left, scrn_rect.top);
-// glVertex2f( scrn_rect.left, marker_ye);
-
- // right tick bar
-// glVertex2f( marker_xe, scrn_rect.top);
-// glVertex2f( marker_xe, marker_ye );
-// glEnd();
-
- if( huds_top(options) ) {
- // Bottom box line
-// commented
-// drawOneLine( scrn_rect.left,
-// scrn_rect.top,
-// width,
-// scrn_rect.top);
-
- // Tick point adjust
- marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
-
- // Bottom arrow
-// drawOneLine( mid_scr.x, marker_ye,
-// mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
-// drawOneLine( mid_scr.x, marker_ye,
-// mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
-
-// commented
-// glBegin(GL_LINE_STRIP);
-// glVertex2f( mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
-// glVertex2f( mid_scr.x, marker_ye);
-// glVertex2f( mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
-// glEnd();
-
- }
- if( huds_bottom(options) ) {
- // Top box line
- drawOneLine( scrn_rect.left, height,
- width, height);
- // Tick point adjust
- marker_ys = height - scrn_rect.bottom / 2;
-
- // Top arrow
-// drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
-// scrn_rect.top + scrn_rect.bottom,
-// mid_scr.x, marker_ys );
-// drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
-// scrn_rect.top + scrn_rect.bottom,
-// mid_scr.x , marker_ys );
- glBegin(GL_LINE_STRIP);
- glVertex2f( mid_scr.x + scrn_rect.bottom / 4,
- height);
- glVertex2f( mid_scr.x , marker_ys );
- glVertex2f( mid_scr.x - scrn_rect.bottom / 4,
- height);
- glEnd();
- }
-
-// if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
-// marker_xe = marker_ys;
-// marker_ys = marker_ye;
-// marker_ye = marker_xe;
-// }
-
- // printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax);
-
-// last = FloatToInt(vmax)+1;
-// i = FloatToInt(vmin);
- last = (int)vmax + 1;
- i = (int)vmin;
- for(; i <last ; i++ ) {
-// for( i = (int)vmin; i <= (int)vmax; i++ ) {
- // printf("<*> i = %d\n", i);
- condition = true;
- if( !modulo()) {
- if( i < min_val()) {
- condition = false;
- }
- }
- // printf("<**> i = %d\n", i);
- if( condition ) {
-// marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
- marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
- if( div_min()){
-// if( (i%(int)div_min()) == 0 ) {
- if( !(i%(int)div_min() )) {
- // draw in ticks only if they aren't too close to the edge.
- if((( marker_xs - 5) > scrn_rect.left ) &&
- (( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
-
- if( huds_both(options) ) {
- drawOneLine( marker_xs, scrn_rect.top,
- marker_xs, marker_ys - 4);
- drawOneLine( marker_xs, marker_ye + 4,
- marker_xs, height);
-// glBegin(GL_LINES);
-// glVertex2f( marker_xs, scrn_rect.top);
-// glVertex2f( marker_xs, marker_ys - 4);
-// glVertex2f( marker_xs, marker_ye + 4);
-// glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
-// glEnd();
- }
- else {
- if( huds_top(options)) {
- // draw minor ticks
- drawOneLine( marker_xs, marker_ys,
- marker_xs, marker_ye - 4);
-// patch for angled deck heading
- if (i == 352) {
- glBegin(GL_POLYGON);
- glVertex2f( marker_xs, marker_ys+16);
- glVertex2f( marker_xs+2, marker_ys+13);
- glVertex2f( marker_xs, marker_ys+10);
- glVertex2f( marker_xs-2, marker_ys+13);
- glEnd();
- }
- }
- else {
- drawOneLine( marker_xs, marker_ys + 4,
- marker_xs, marker_ye);
- }
- }
- }
- }
- }
- // printf("<***> i = %d\n", i);
- if( div_max()) {
- // printf("i = %d\n", i);
-// if( (i%(int)div_max())==0 ) {
- if( !(i%(int)div_max()) ) {
- if(modulo()) {
- if( disp_val < 0) {
- while(disp_val<0)
- disp_val += modulo();
- }
- disp_val = i % (int) modulo(); // ?????????
- } else {
- disp_val = i;
- }
- // printf("disp_val = %d\n", disp_val);
- // printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
- lenstr = sprintf( TextScale, "%d",
-// (int)(disp_val * data_scaling() +.5));
- FloatToInt(disp_val * data_scaling()/*+.5*/));
- // Draw major ticks and text only if far enough from the edge.
- if(( (marker_xs - 10)> scrn_rect.left ) &&
- ( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
- if( huds_both(options) ) {
-// drawOneLine( marker_xs, scrn_rect.top,
-// marker_xs, marker_ys);
-// drawOneLine( marker_xs, marker_ye,
-// marker_xs, scrn_rect.top + scrn_rect.bottom);
- glBegin(GL_LINE_STRIP);
- glVertex2f( marker_xs, scrn_rect.top);
- glVertex2f( marker_xs, marker_ye);
- glVertex2f( marker_xs, height);
- glEnd();
- if( !huds_notext(options) ) {
- textString ( marker_xs - 4 * lenstr,
- marker_ys + 4,
- TextScale, GLUT_BITMAP_8_BY_13 );
- }
- }
- else {
- // draw major ticks
- drawOneLine( marker_xs, marker_ys,
- marker_xs, marker_ye );
- if( !huds_notext(options)) {
- if( huds_top(options) ) {
- textString ( marker_xs - 4 * lenstr,
- height - 10,
- TextScale, GLUT_BITMAP_8_BY_13 );
- }
- else {
- textString( marker_xs - 4 * lenstr,
- scrn_rect.top,
- TextScale, GLUT_BITMAP_8_BY_13 );
- }
- }
- }
- }
- }
- }//if(condition)
- // printf("<****> i = %d\n", i);
- } //if(divmax)
- } //if(!modulo)
- } //for
-} //draw
-#else
-//$$$ end - VS Renganathan, 13 Oct 2K
-
-void hud_card ::
-draw( void ) // (HUD_scale * pscale )
-{
- float vmin, vmax;
- int marker_xs;
- int marker_xe;
- int marker_ys;
- int marker_ye;
- int lenstr;
- int height, width;
- int i, last;
- char TextScale[80];
- bool condition;
- int disp_val = 0;
- POINT mid_scr = get_centroid();
- float cur_value = get_value();
- RECT scrn_rect = get_location();
- UINT options = get_options();
-
- height = scrn_rect.top + scrn_rect.bottom;
- width = scrn_rect.left + scrn_rect.right;
-
- vmin = cur_value - half_width_units; // width units == needle travel
- vmax = cur_value + half_width_units; // or picture unit span.
+ float vmin, vmax;
+ int marker_xs;
+ int marker_xe;
+ int marker_ys;
+ int marker_ye;
+ int text_x, text_y;
+ int lenstr;
+ int height, width;
+ int i, last;
+ char TextScale[80];
+ bool condition;
+ int disp_val = 0;
+
+
+ POINT mid_scr = get_centroid();
+ float cur_value = get_value();
+ RECT scrn_rect = get_location();
+ UINT options = get_options();
+
+ height = scrn_rect.top + scrn_rect.bottom;
+ width = scrn_rect.left + scrn_rect.right;
+
+
+
+ if(type=="guage") {
+
+ vmin = min_val();
+ vmax = max_val();
+ text_y = scrn_rect.top + FloatToInt((cur_value - vmin) * factor() /*+.5f*/);
+ text_x = marker_xs;
+ }
+ else
+ if(type=="tape") {
+
+ vmin = cur_value - half_width_units; // width units == needle travel
+ vmax = cur_value + half_width_units; // or picture unit span.
+ text_x = mid_scr.x;
+ text_y = mid_scr.y;
+ }
- // Draw the basic markings for the scale...
+
+ // Draw the basic markings for the scale...
- if( huds_vert(options) ) { // Vertical scale
- drawOneLine( scrn_rect.left, // Bottom tick bar
- scrn_rect.top,
- width,
- scrn_rect.top);
-
- drawOneLine( scrn_rect.left, // Top tick bar
- height,
- width,
- height );
+ if( huds_vert(options) ) { // Vertical scale
+ if (draw_tick_bottom) {
+ drawOneLine( scrn_rect.left, // Bottom tick bar
+ scrn_rect.top,
+ width,
+ scrn_rect.top);
+ } // endif draw_tick_bottom
+ if (draw_tick_top) {
+ drawOneLine( scrn_rect.left, // Top tick bar
+ height,
+ width,
+ height );
+ } // endif draw_tick_top
- marker_xs = scrn_rect.left; // x start
- marker_xe = width; // x extent
- marker_ye = height;
+ marker_xs = scrn_rect.left; // x start
+ marker_xe = width; // x extent
+ marker_ye = height;
-// glBegin(GL_LINES);
+ // glBegin(GL_LINES);
- // Bottom tick bar
-// glVertex2f( marker_xs, scrn_rect.top);
-// glVertex2f( marker_xe, scrn_rect.top);
-
- // Top tick bar
-// glVertex2f( marker_xs, marker_ye);
-// glVertex2f( marker_xe, marker_ye );
-// glEnd();
-
- // We do not use else in the following so that combining the two
- // options produces a "caged" display with double carrots. The
- // same is done for horizontal card indicators.
-
- if( huds_left(options) ) { // Calculate x marker offset
- drawOneLine( marker_xe, scrn_rect.top,
- marker_xe, marker_ye); // Cap right side
-
- marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
- // Indicator carrot
-// drawOneLine( marker_xs, mid_scr.y,
-// marker_xe, mid_scr.y + scrn_rect.right / 6);
-// drawOneLine( marker_xs, mid_scr.y,
-// marker_xe, mid_scr.y - scrn_rect.right / 6);
-
- glBegin(GL_LINE_STRIP);
- glVertex2f( marker_xe, mid_scr.y + scrn_rect.right / 6);
- glVertex2f( marker_xs, mid_scr.y);
- glVertex2f( marker_xe, mid_scr.y - scrn_rect.right / 6);
- glEnd();
- }
- if( huds_right(options) ) { // We'll default this for now.
- drawOneLine( scrn_rect.left, scrn_rect.top,
- scrn_rect.left, marker_ye ); // Cap left side
-
- marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
- // Indicator carrot
-// drawOneLine( scrn_rect.left, mid_scr.y + scrn_rect.right / 6,
-// marker_xe, mid_scr.y );
-// drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
-// marker_xe, mid_scr.y);
- glBegin(GL_LINE_STRIP);
- glVertex2f( scrn_rect.left, mid_scr.y + scrn_rect.right / 6);
- glVertex2f( marker_xe, mid_scr.y );
- glVertex2f( scrn_rect.left, mid_scr.y - scrn_rect.right / 6);
- glEnd();
- }
-
- // At this point marker x_start and x_end values are transposed.
- // To keep this from confusing things they are now interchanged.
- if(huds_both(options)) {
- marker_ye = marker_xs;
- marker_xs = marker_xe;
- marker_xe = marker_ye;
- }
-
- // Work through from bottom to top of scale. Calculating where to put
- // minor and major ticks.
-
-// last = FloatToInt(vmax)+1;
-// i = FloatToInt(vmin);
- last = (int)vmax + 1;
- i = (int)vmin;
- for( ; i <last ; i++ )
- {
- condition = true;
- if( !modulo()) {
- if( i < min_val()) {
- condition = false;
- }
- }
-
- if( condition ) { // Show a tick if necessary
- // Calculate the location of this tick
- marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
-// marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
- // Block calculation artifact from drawing ticks below min coordinate.
- // Calculation here accounts for text height.
-
- if(( marker_ys < (scrn_rect.top + 4)) |
- ( marker_ys > (height - 4))) {
- // Magic numbers!!!
- continue;
- }
- if( div_min()) {
-// if( (i%div_min()) == 0) {
- if( !(i%(int)div_min())) {
- if((( marker_ys - 5) > scrn_rect.top ) &&
- (( marker_ys + 5) < (height))){
- if( huds_both(options) ) {
- drawOneLine( scrn_rect.left, marker_ys,
- marker_xs, marker_ys );
- drawOneLine( marker_xe, marker_ys,
- width, marker_ys );
-// glBegin(GL_LINES);
-// glVertex2f( scrn_rect.left, marker_ys );
-// glVertex2f( marker_xs, marker_ys );
-// glVertex2f( marker_xe, marker_ys);
-// glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys );
-// glEnd();
- }
- else {
- if( huds_left(options) ) {
- drawOneLine( marker_xs + 4, marker_ys,
- marker_xe, marker_ys );
- }
- else {
- drawOneLine( marker_xs, marker_ys,
- marker_xe - 4, marker_ys );
- }
- }
- }
- }
- }
- if( div_max() ) {
- if( !(i%(int)div_max()) )
- {
- if(modulo()) {
- if( disp_val < 0) {
- while(disp_val < 0)
- disp_val += modulo();
-// } else {
-// disp_val = i % (int)modulo();
- }
- disp_val = i % (int) modulo(); // ?????????
- } else {
- disp_val = i;
- }
-
- lenstr = sprintf( TextScale, "%d",
- FloatToInt(disp_val * data_scaling()/*+.5*/));
-// (int)(disp_val * data_scaling() +.5));
- if(( (marker_ys - 8 ) > scrn_rect.top ) &&
- ( (marker_ys + 8) < (height))){
- if( huds_both(options) ) {
-// drawOneLine( scrn_rect.left, marker_ys,
-// marker_xs, marker_ys);
-// drawOneLine( marker_xs, marker_ys,
-// scrn_rect.left + scrn_rect.right,
-// marker_ys);
- glBegin(GL_LINE_STRIP);
- glVertex2f( scrn_rect.left, marker_ys );
- glVertex2f( marker_xs, marker_ys);
- glVertex2f( width, marker_ys);
- glEnd();
- if( !huds_notext(options)) {
- textString ( marker_xs + 2, marker_ys,
- TextScale, GLUT_BITMAP_8_BY_13 );
- }
- }
- else {
- drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
- if( !huds_notext(options) ) {
- if( huds_left(options) ) {
- textString( marker_xs - 8 * lenstr - 2,
- marker_ys - 4,
- TextScale, GLUT_BITMAP_8_BY_13 );
- }
- else {
- textString( marker_xe + 3 * lenstr,
- marker_ys - 4,
- TextScale, GLUT_BITMAP_8_BY_13 );
- }
- }
- }
- } // Else read oriented right
- } // End if modulo division by major interval is zero
- } // End if major interval divisor non-zero
- } // End if condition
- } // End for range of i from vmin to vmax
- } // End if VERTICAL SCALE TYPE
+ // Bottom tick bar
+ // glVertex2f( marker_xs, scrn_rect.top);
+ // glVertex2f( marker_xe, scrn_rect.top);
+
+ // Top tick bar
+ // glVertex2f( marker_xs, marker_ye);
+ // glVertex2f( marker_xe, marker_ye );
+ // glEnd();
+
+
+ // We do not use else in the following so that combining the two
+ // options produces a "caged" display with double carrots. The
+ // same is done for horizontal card indicators.
+
+ if( huds_left(options) ) { // Calculate x marker offset
+
+ if (draw_cap_right) {
+
+ drawOneLine( marker_xe, scrn_rect.top,
+ marker_xe, marker_ye); // Cap right side
+ } //endif cap_right
+
+ marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
+
+ // drawOneLine( marker_xs, mid_scr.y,
+ // marker_xe, mid_scr.y + scrn_rect.right / 6);
+ // drawOneLine( marker_xs, mid_scr.y,
+ // marker_xe, mid_scr.y - scrn_rect.right / 6);
+
+// draw pointer
+ if(pointer) {
+ if(pointer_type=="fixed") {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f( marker_offset+marker_xe, text_y + scrn_rect.right / 6);
+ glVertex2f( marker_offset+marker_xs, text_y);
+ glVertex2f( marker_offset+marker_xe, text_y - scrn_rect.right / 6);
+ glEnd();
+ }
+ else
+ if(pointer_type=="moving") {
+ //Code for Moving Type Pointer to be included.
+ }
+ }
+
+ }
+
+ if( huds_right(options) ) { // We'll default this for now.
+ if (draw_cap_left) {
+ drawOneLine( scrn_rect.left, scrn_rect.top,
+ scrn_rect.left, marker_ye ); // Cap left side
+ } //endif cap_left
+
+ marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
+ // Indicator carrot
+ // drawOneLine( scrn_rect.left, mid_scr.y + scrn_rect.right / 6,
+ // marker_xe, mid_scr.y );
+ // drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
+ // marker_xe, mid_scr.y);
+
+// draw pointer
+ if(pointer) {
+ if(pointer_type=="fixed") {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f( -marker_offset+scrn_rect.left, text_y + scrn_rect.right / 6);
+ glVertex2f( -marker_offset+marker_xe, text_y );
+ glVertex2f( -marker_offset+scrn_rect.left, text_y - scrn_rect.right / 6);
+ glEnd();
+ }
+ else
+ if(pointer_type=="moving") {
+ // Code for Moving Type Pointer to be included.
+ }
+ }
+ }
+
+ // At this point marker x_start and x_end values are transposed.
+ // To keep this from confusing things they are now interchanged.
+ if(huds_both(options)) {
+ marker_ye = marker_xs;
+ marker_xs = marker_xe;
+ marker_xe = marker_ye;
+ }
+
+ // Work through from bottom to top of scale. Calculating where to put
+ // minor and major ticks.
+
+// draw scale or tape
+ // last = FloatToInt(vmax)+1;
+ // i = FloatToInt(vmin);
+ last = (int)vmax + 1;
+ i = (int)vmin;
+ for( ; i <last ; i++ )
+ {
+ condition = true;
+ if( !modulo()) {
+ if( i < min_val()) {
+ condition = false;
+ }
+ }
+
+ if( condition ) { // Show a tick if necessary
+ // Calculate the location of this tick
+ marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
+ // marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
+ // Block calculation artifact from drawing ticks below min coordinate.
+ // Calculation here accounts for text height.
+
+ if(( marker_ys < (scrn_rect.top + 4)) |
+ ( marker_ys > (height - 4))) {
+ // Magic numbers!!!
+ continue;
+ }
+ if( div_min()) {
+ // if( (i%div_min()) == 0) {
+ if( !(i%(int)div_min())) {
+ if((( marker_ys - 5) > scrn_rect.top ) &&
+ (( marker_ys + 5) < (height))){
+ if( huds_both(options) ) {
+ drawOneLine( scrn_rect.left, marker_ys,
+ marker_xs, marker_ys );
+ drawOneLine( marker_xe, marker_ys,
+ width, marker_ys );
+ // glBegin(GL_LINES);
+ // glVertex2f( scrn_rect.left, marker_ys );
+ // glVertex2f( marker_xs, marker_ys );
+ // glVertex2f( marker_xe, marker_ys);
+ // glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys );
+ // glEnd();
+ }
+ else {
+ if( huds_left(options) ) {
+ drawOneLine( marker_xs + 4, marker_ys,
+ marker_xe, marker_ys );
+ }
+ else {
+ drawOneLine( marker_xs, marker_ys,
+ marker_xe - 4, marker_ys );
+ }
+ }
+ }
+ }
+ }
+ if( div_max() ) {
+ if( !(i%(int)div_max()) )
+ {
+ if(modulo()) {
+ if( disp_val < 0) {
+ while(disp_val < 0)
+ disp_val += modulo();
+ // } else {
+ // disp_val = i % (int)modulo();
+ }
+ disp_val = i % (int) modulo(); // ?????????
+ } else {
+ disp_val = i;
+ }
+
+ lenstr = sprintf( TextScale, "%d",
+ FloatToInt(disp_val * data_scaling()/*+.5*/));
+ // (int)(disp_val * data_scaling() +.5));
+ if(( (marker_ys - 8 ) > scrn_rect.top ) &&
+ ( (marker_ys + 8) < (height))){
+ if( huds_both(options) ) {
+ // drawOneLine( scrn_rect.left, marker_ys,
+ // marker_xs, marker_ys);
+ // drawOneLine( marker_xs, marker_ys,
+ // scrn_rect.left + scrn_rect.right,
+ // marker_ys);
+ glBegin(GL_LINE_STRIP);
+ glVertex2f( scrn_rect.left, marker_ys );
+ glVertex2f( marker_xs, marker_ys);
+ glVertex2f( width, marker_ys);
+ glEnd();
+ if( !huds_notext(options)) {
+ textString ( marker_xs + 2, marker_ys,
+ TextScale, GLUT_BITMAP_8_BY_13 );
+ }
+ }
+ else {
+ drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
+ if( !huds_notext(options) ) {
+ if( huds_left(options) ) {
+ textString( marker_xs - 8 * lenstr - 2,
+ marker_ys - 4,
+ TextScale, GLUT_BITMAP_8_BY_13 );
+ }
+ else {
+ textString( marker_xe + 3 * lenstr,
+ marker_ys - 4,
+ TextScale, GLUT_BITMAP_8_BY_13 );
+ }
+ }
+ }
+ } // Else read oriented right
+ } // End if modulo division by major interval is zero
+ } // End if major interval divisor non-zero
+ } // End if condition
+ } // End for range of i from vmin to vmax
+ } // End if VERTICAL SCALE TYPE
else { // Horizontal scale by default
- // left tick bar
- drawOneLine( scrn_rect.left, scrn_rect.top,
- scrn_rect.left, height);
-
- // right tick bar
- drawOneLine( width, scrn_rect.top,
- width,
- height );
+ // left tick bar
+ if (draw_tick_left) {
+ drawOneLine( scrn_rect.left, scrn_rect.top,
+ scrn_rect.left, height);
+ } // endif draw_tick_left
+ // right tick bar
+ if (draw_tick_right) {
+ drawOneLine( width, scrn_rect.top,
+ width,
+ height );
+ } // endif draw_tick_right
- marker_ys = scrn_rect.top; // Starting point for
- marker_ye = height; // tick y location calcs
- marker_xe = width;
-
-// glBegin(GL_LINES);
- // left tick bar
-// glVertex2f( scrn_rect.left, scrn_rect.top);
-// glVertex2f( scrn_rect.left, marker_ye);
-
- // right tick bar
-// glVertex2f( marker_xe, scrn_rect.top);
-// glVertex2f( marker_xe, marker_ye );
-// glEnd();
-
- if( huds_top(options) ) {
- // Bottom box line
- drawOneLine( scrn_rect.left,
- scrn_rect.top,
- width,
- scrn_rect.top);
-
- // Tick point adjust
- marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
-
- // Bottom arrow
-// drawOneLine( mid_scr.x, marker_ye,
-// mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
-// drawOneLine( mid_scr.x, marker_ye,
-// mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
-
- glBegin(GL_LINE_STRIP);
- glVertex2f( mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
- glVertex2f( mid_scr.x, marker_ye);
- glVertex2f( mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
- glEnd();
- }
- if( huds_bottom(options) ) {
- // Top box line
- drawOneLine( scrn_rect.left, height,
- width, height);
- // Tick point adjust
- marker_ys = height - scrn_rect.bottom / 2;
-
- // Top arrow
-// drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
-// scrn_rect.top + scrn_rect.bottom,
-// mid_scr.x, marker_ys );
-// drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
-// scrn_rect.top + scrn_rect.bottom,
-// mid_scr.x , marker_ys );
- glBegin(GL_LINE_STRIP);
- glVertex2f( mid_scr.x + scrn_rect.bottom / 4,
- height);
- glVertex2f( mid_scr.x , marker_ys );
- glVertex2f( mid_scr.x - scrn_rect.bottom / 4,
- height);
- glEnd();
- }
-
-// if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
-// marker_xe = marker_ys;
-// marker_ys = marker_ye;
-// marker_ye = marker_xe;
-// }
-
- // printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax);
-
-// last = FloatToInt(vmax)+1;
-// i = FloatToInt(vmin);
- last = (int)vmax + 1;
- i = (int)vmin;
- for(; i <last ; i++ ) {
-// for( i = (int)vmin; i <= (int)vmax; i++ ) {
- // printf("<*> i = %d\n", i);
- condition = true;
- if( !modulo()) {
- if( i < min_val()) {
- condition = false;
- }
- }
- // printf("<**> i = %d\n", i);
- if( condition ) {
-// marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
- marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
- if( div_min()){
-// if( (i%(int)div_min()) == 0 ) {
- if( !(i%(int)div_min() )) {
- // draw in ticks only if they aren't too close to the edge.
- if((( marker_xs - 5) > scrn_rect.left ) &&
- (( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
-
- if( huds_both(options) ) {
- drawOneLine( marker_xs, scrn_rect.top,
- marker_xs, marker_ys - 4);
- drawOneLine( marker_xs, marker_ye + 4,
- marker_xs, height);
-// glBegin(GL_LINES);
-// glVertex2f( marker_xs, scrn_rect.top);
-// glVertex2f( marker_xs, marker_ys - 4);
-// glVertex2f( marker_xs, marker_ye + 4);
-// glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
-// glEnd();
- }
- else {
- if( huds_top(options)) {
- drawOneLine( marker_xs, marker_ys,
- marker_xs, marker_ye - 4);
- }
- else {
- drawOneLine( marker_xs, marker_ys + 4,
- marker_xs, marker_ye);
- }
- }
- }
- }
- }
- // printf("<***> i = %d\n", i);
- if( div_max()) {
- // printf("i = %d\n", i);
-// if( (i%(int)div_max())==0 ) {
- if( !(i%(int)div_max()) ) {
- if(modulo()) {
- if( disp_val < 0) {
- while(disp_val<0)
- disp_val += modulo();
- }
- disp_val = i % (int) modulo(); // ?????????
- } else {
- disp_val = i;
- }
- // printf("disp_val = %d\n", disp_val);
- // printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
- lenstr = sprintf( TextScale, "%d",
-// (int)(disp_val * data_scaling() +.5));
- FloatToInt(disp_val * data_scaling()/*+.5*/));
- // Draw major ticks and text only if far enough from the edge.
- if(( (marker_xs - 10)> scrn_rect.left ) &&
- ( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
- if( huds_both(options) ) {
-// drawOneLine( marker_xs, scrn_rect.top,
-// marker_xs, marker_ys);
-// drawOneLine( marker_xs, marker_ye,
-// marker_xs, scrn_rect.top + scrn_rect.bottom);
- glBegin(GL_LINE_STRIP);
- glVertex2f( marker_xs, scrn_rect.top);
- glVertex2f( marker_xs, marker_ye);
- glVertex2f( marker_xs, height);
- glEnd();
- if( !huds_notext(options) ) {
- textString ( marker_xs - 4 * lenstr,
- marker_ys + 4,
- TextScale, GLUT_BITMAP_8_BY_13 );
- }
- }
- else {
- drawOneLine( marker_xs, marker_ys,
- marker_xs, marker_ye );
- if( !huds_notext(options)) {
- if( huds_top(options) ) {
- textString ( marker_xs - 4 * lenstr,
- height - 10,
- TextScale, GLUT_BITMAP_8_BY_13 );
- }
- else {
- textString( marker_xs - 4 * lenstr,
- scrn_rect.top,
- TextScale, GLUT_BITMAP_8_BY_13 );
- }
- }
- }
- }
- }
- }
- // printf("<****> i = %d\n", i);
- }
- }
- }
-}
-
-#endif
+ marker_ys = scrn_rect.top; // Starting point for
+ marker_ye = height; // tick y location calcs
+ marker_xe = width;
+ marker_xs = scrn_rect.left + FloatToInt((cur_value - vmin) * factor() /*+ .5f*/);
+
+
+ // glBegin(GL_LINES);
+ // left tick bar
+ // glVertex2f( scrn_rect.left, scrn_rect.top);
+ // glVertex2f( scrn_rect.left, marker_ye);
+
+ // right tick bar
+ // glVertex2f( marker_xe, scrn_rect.top);
+ // glVertex2f( marker_xe, marker_ye );
+ // glEnd();
+
+ if( huds_top(options) ) {
+ if (draw_cap_bottom) {
+ // Bottom box line
+ drawOneLine( scrn_rect.left,
+ scrn_rect.top,
+ width,
+ scrn_rect.top);
+ } //endif cap_bottom
+
+ // Tick point adjust
+ marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
+ // Bottom arrow
+ // drawOneLine( mid_scr.x, marker_ye,
+ // mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
+ // drawOneLine( mid_scr.x, marker_ye,
+ // mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
+// draw pointer
+ if(pointer) {
+ if(pointer_type=="fixed") {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f( marker_xs - scrn_rect.bottom / 4, scrn_rect.top);
+ glVertex2f( marker_xs, marker_ye);
+ glVertex2f( marker_xs + scrn_rect.bottom / 4, scrn_rect.top);
+ glEnd();
+ }
+ else
+ if(pointer_type=="moving") {
+ // Code for Moving type Pointer to be included.
+ }
+ }
+
+ }
+ if( huds_bottom(options) ) {
+ // Top box line
+ if (draw_cap_top) {
+ drawOneLine( scrn_rect.left, height,
+ width, height);
+ } //endif cap_top
+
+ // Tick point adjust
+ marker_ys = height - scrn_rect.bottom / 2;
+ // Top arrow
+ // drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
+ // scrn_rect.top + scrn_rect.bottom,
+ // mid_scr.x, marker_ys );
+ // drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
+ // scrn_rect.top + scrn_rect.bottom,
+ // mid_scr.x , marker_ys );
+
+// draw pointer
+ if(pointer) {
+ if(pointer_type=="fixed") {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f( marker_xs + scrn_rect.bottom / 4, height);
+ glVertex2f( marker_xs, marker_ys );
+ glVertex2f( marker_xs - scrn_rect.bottom / 4, height);
+ glEnd();
+ }
+ else
+ if(pointer_type=="moving") {
+ // Code for Moving Type Pointer to be included.
+ }
+ }//if pointer
+
+
+ }
+
+ // if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
+ // marker_xe = marker_ys;
+ // marker_ys = marker_ye;
+ // marker_ye = marker_xe;
+ // }
+
+ // printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax);
+
+ // last = FloatToInt(vmax)+1;
+ // i = FloatToInt(vmin);
+ last = (int)vmax + 1;
+ i = (int)vmin;
+ for(; i <last ; i++ ) {
+ // for( i = (int)vmin; i <= (int)vmax; i++ ) {
+ // printf("<*> i = %d\n", i);
+ condition = true;
+ if( !modulo()) {
+ if( i < min_val()) {
+ condition = false;
+ }
+ }
+ // printf("<**> i = %d\n", i);
+ if( condition ) {
+ // marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
+ marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
+ if( div_min()){
+ // if( (i%(int)div_min()) == 0 ) {
+ if( !(i%(int)div_min() )) {
+ // draw in ticks only if they aren't too close to the edge.
+ if((( marker_xs - 5) > scrn_rect.left ) &&
+ (( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
+
+ if( huds_both(options) ) {
+ drawOneLine( marker_xs, scrn_rect.top,
+ marker_xs, marker_ys - 4);
+ drawOneLine( marker_xs, marker_ye + 4,
+ marker_xs, height);
+ // glBegin(GL_LINES);
+ // glVertex2f( marker_xs, scrn_rect.top);
+ // glVertex2f( marker_xs, marker_ys - 4);
+ // glVertex2f( marker_xs, marker_ye + 4);
+ // glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
+ // glEnd();
+ }
+ else {
+ if( huds_top(options)) {
+ // draw minor ticks
+ drawOneLine( marker_xs, marker_ys,
+ marker_xs, marker_ye - 4);
+ }
+ else {
+ drawOneLine( marker_xs, marker_ys + 4,
+ marker_xs, marker_ye);
+ }
+ }
+ }
+ }
+ }
+ // printf("<***> i = %d\n", i);
+ if( div_max()) {
+ // printf("i = %d\n", i);
+ // if( (i%(int)div_max())==0 ) {
+ if( !(i%(int)div_max()) ) {
+ if(modulo()) {
+ if( disp_val < 0) {
+ while(disp_val<0)
+ disp_val += modulo();
+ }
+ disp_val = i % (int) modulo(); // ?????????
+ } else {
+ disp_val = i;
+ }
+ // printf("disp_val = %d\n", disp_val);
+ // printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
+ lenstr = sprintf( TextScale, "%d",
+ // (int)(disp_val * data_scaling() +.5));
+ FloatToInt(disp_val * data_scaling()/*+.5*/));
+ // Draw major ticks and text only if far enough from the edge.
+ if(( (marker_xs - 10)> scrn_rect.left ) &&
+ ( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
+ if( huds_both(options) ) {
+ // drawOneLine( marker_xs, scrn_rect.top,
+ // marker_xs, marker_ys);
+ // drawOneLine( marker_xs, marker_ye,
+ // marker_xs, scrn_rect.top + scrn_rect.bottom);
+ glBegin(GL_LINE_STRIP);
+ glVertex2f( marker_xs, scrn_rect.top);
+ glVertex2f( marker_xs, marker_ye);
+ glVertex2f( marker_xs, height);
+ glEnd();
+ if( !huds_notext(options) ) {
+ textString ( marker_xs - 4 * lenstr,
+ marker_ys + 4,
+ TextScale, GLUT_BITMAP_8_BY_13 );
+ }
+ }
+ else {
+ drawOneLine( marker_xs, marker_ys,
+ marker_xs, marker_ye );
+ if( !huds_notext(options)) {
+ if( huds_top(options) ) {
+ textString ( marker_xs - 4 * lenstr,
+ height - 10,
+ TextScale, GLUT_BITMAP_8_BY_13 );
+ }
+ else {
+ textString( marker_xs - 4 * lenstr,
+ scrn_rect.top,
+ TextScale, GLUT_BITMAP_8_BY_13 );
+ }
+ }
+ }
+ }
+ }
+ }
+ // printf("<****> i = %d\n", i);
+ }
+ }
+ }
+} //draw
fgLabelJust justification,
int font_size,
int blinking,
- bool working ):
+ bool latitude,
+ bool longitude,
+ bool working):
instr_item( x, y, width, height,
- data_source, scale_data,options, working ),
+ data_source,scale_data,options, working ),
pformat ( label_format ),
pre_str ( pre_label_string ),
post_str ( post_label_string ),
justify ( justification ),
fontSize ( font_size ),
- blink ( blinking )
+ blink ( blinking ),
+ lat ( latitude ),
+ lon ( longitude )
+
{
if( pre_str != NULL) {
if( post_str != NULL ) {
pformat ( image.pformat ),
pre_str ( image.pre_str ),
post_str ( image.post_str ),
- blink ( image.blink )
+ blink ( image.blink ),
+ lat ( image.lat ),
+ lon ( image.lon )
+
{
if( pre_str != NULL) {
if( post_str != NULL ) {
justify = rhs.justify;
pre_str = rhs.pre_str;
post_str = rhs.post_str;
+ lat = rhs.lat;
+ lon = rhs.lon;
+
+
strcpy(format_buffer,rhs.format_buffer);
}
return *this;
RECT scrn_rect = get_location();
if( data_available() ) {
- sprintf( label_buffer, format_buffer, get_value() );
+ if(lat)
+ sprintf( label_buffer, format_buffer, coord_format_lat(get_value()) );
+ else
+ if(lon)
+ sprintf( label_buffer, format_buffer, coord_format_lon(get_value()) );
+ else
+ sprintf( label_buffer, format_buffer, get_value() );
}
else {
sprintf( label_buffer, format_buffer );
- }
+ }
lenstr = getStringWidth( label_buffer );
#define DO_PANEL_HACK
//====================== Top of HudLadder Class =======================
-HudLadder :: HudLadder( int x,
- int y,
- UINT width,
- UINT height,
- UINT mini,
- FLTFNPTR ptch_source,
- FLTFNPTR roll_source,
- float span_units,
- float major_div,
- float minor_div,
- UINT screen_hole,
- UINT lbl_pos,
- bool working) :
- dual_instr_item( x, y, width, height,
- ptch_source,
- roll_source,
- working,
- HUDS_RIGHT),
- width_units ( (int)(span_units) ),
- div_units ( (int)(major_div < 0? -major_div: major_div) ),
- minor_div ( (int)(minor_div) ),
- label_pos ( lbl_pos ),
- scr_hole ( screen_hole ),
- vmax ( span_units/2 ),
- vmin ( -vmax )
- {
- if( !width_units ) {
- width_units = 45;
- }
-// $$$ begin -added VS Renganthan 16 Oct 2k
-#ifdef FIGHTER_HUD
- factor = 480.0 / 33.75;
-#else
-// $$$ begin -added VS Renganthan 16 Oct 2k
- factor = (float)get_span() / (float) width_units;
-#endif
- minimal = mini;
- }
+HudLadder :: HudLadder( string name,
+ int x,
+ int y,
+ UINT width,
+ UINT height,
+ float factr,
+ FLTFNPTR ptch_source,
+ FLTFNPTR roll_source,
+ float span_units,
+ float major_div,
+ float minor_div,
+ UINT screen_hole,
+ UINT lbl_pos,
+ bool frl_spot,
+ bool target,
+ bool vel_vec,
+ bool drift,
+ bool alpha,
+ bool energy,
+ bool climb,
+ bool glide,
+ float glide_slope_val,
+ bool worm_energy,
+ bool waypoint,
+ bool working) :
+ dual_instr_item( x, y, width, height,
+ ptch_source,
+ roll_source,
+ working,
+ HUDS_RIGHT),
+ width_units ( (int)(span_units) ),
+ div_units ( (int)(major_div < 0? -major_div: major_div) ),
+ minor_div ( (int)(minor_div) ),
+ label_pos ( lbl_pos ),
+ scr_hole ( screen_hole ),
+ vmax ( span_units/2 ),
+ vmin ( -vmax ),
+ factor ( factr ),
+ hudladder_type ( name ),
+ frl ( frl_spot ),
+ velocity_vector ( vel_vec ),
+ drift_marker ( drift ),
+ alpha_bracket ( alpha ),
+ energy_marker ( energy ),
+ climb_dive_marker ( climb ),
+ target_spot ( target ),
+ glide_slope_marker ( glide ),
+ glide_slope ( glide_slope_val),
+ energy_worm ( worm_energy),
+ waypoint_marker ( waypoint)
+
+
+{
+ if( !width_units ) {
+ width_units = 45;
+ }
+}
HudLadder :: ~HudLadder()
- {
- }
+{
+}
- HudLadder ::
- HudLadder( const HudLadder & image ) :
- dual_instr_item( (dual_instr_item &) image),
- width_units ( image.width_units ),
- div_units ( image.div_units ),
- label_pos ( image.label_pos ),
- scr_hole ( image.scr_hole ),
- vmax ( image.vmax ),
- vmin ( image.vmin ),
- factor ( image.factor )
- {
- }
+HudLadder ::
+HudLadder( const HudLadder & image ) :
+ dual_instr_item ( (dual_instr_item &) image),
+ width_units ( image.width_units ),
+ div_units ( image.div_units ),
+ label_pos ( image.label_pos ),
+ scr_hole ( image.scr_hole ),
+ vmax ( image.vmax ),
+ vmin ( image.vmin ),
+ factor ( image.factor ),
+ hudladder_type ( image.hudladder_type),
+ frl ( image.frl),
+ velocity_vector ( image.velocity_vector),
+ drift_marker ( image.drift_marker),
+ alpha_bracket ( image.alpha_bracket),
+ energy_marker ( image.energy_marker),
+ climb_dive_marker ( image.climb_dive_marker),
+ target_spot ( image.target_spot),
+ glide_slope_marker ( image.glide_slope_marker),
+ glide_slope ( image.glide_slope),
+ energy_worm ( image.energy_worm),
+ waypoint_marker ( image.waypoint_marker)
+{
+}
HudLadder & HudLadder :: operator = ( const HudLadder & rhs )
- {
- if( !(this == &rhs)) {
- (dual_instr_item &)(*this) = (dual_instr_item &)rhs;
- width_units = rhs.width_units;
- div_units = rhs.div_units;
- label_pos = rhs.label_pos;
- scr_hole = rhs.scr_hole;
- vmax = rhs.vmax;
- vmin = rhs.vmin;
- factor = rhs.factor;
- }
- return *this;
+{
+ if( !(this == &rhs)) {
+ (dual_instr_item &)(*this) = (dual_instr_item &)rhs;
+ width_units = rhs.width_units;
+ div_units = rhs.div_units;
+ label_pos = rhs.label_pos;
+ scr_hole = rhs.scr_hole;
+ vmax = rhs.vmax;
+ vmin = rhs.vmin;
+ factor = rhs.factor;
+ hudladder_type = rhs.hudladder_type;
+ frl = rhs.frl;
+ velocity_vector = rhs.velocity_vector;
+ drift_marker = rhs.drift_marker;
+ alpha_bracket = rhs.alpha_bracket;
+ energy_marker = rhs.energy_marker;
+ climb_dive_marker = rhs.climb_dive_marker;
+ target_spot = rhs.target_spot;
+ glide_slope_marker = rhs.glide_slope_marker;
+ glide_slope = rhs.glide_slope;
+ energy_worm = rhs.energy_worm;
+ waypoint_marker = rhs.waypoint_marker;
}
+ return *this;
+}
//
// Draws a climb ladder in the center of the HUD
//
-// $$$ begin - added VS Renganathan, 13 Oct 2K
-#ifdef FIGHTER_HUD
+
void HudLadder :: draw( void )
{
- float x_ini;
- float x_end;
+
+ float x_ini,x_ini2;
+ float x_end,x_end2;
float y;
int count;
float cosine, sine,xvvr,yvvr,Vxx,Vyy,Vzz,up_vel,ground_vel,actslope;
float Axx,Ayy,Azz,total_vel,pot_slope,t1,t2,psi,alpha,pla;
float vel_x,vel_y,drift;
char Textaux[8] ;
+ bool pitch_ladder;
+ bool climb_dive_ladder;
+ bool clip_plane;
GLdouble eqn_top[4] = {0.0,-1.0,0.0,0.0};
GLdouble eqn_left[4] = {-1.0,0.0,0.0,100.0};
alpha = get_aoa();
pla = get_throttleval();
- int lgear,wown,wowm,iclaw,ihook;
- iclaw = get_iaux1();
+ int lgear,wown,wowm,ilcanclaw,ihook;
+ ilcanclaw = get_iaux1();
lgear = get_iaux2();
wown = get_iaux3();
wowm = get_iaux4();
ihook = get_iaux5();
float pitch_value = current_ch1() * RAD_TO_DEG;
- vmin = pitch_value - (float)width_units;
- vmax = pitch_value + (float)width_units; //$$$
-
+
+ if(hudladder_type=="Climb/Dive Ladder") {
+ pitch_ladder = false;
+ climb_dive_ladder = true;
+ clip_plane = true;
+ }
+ else
+ if(hudladder_type=="Pitch Ladder") {
+ pitch_ladder = true;
+ climb_dive_ladder = false;
+ clip_plane = false;
+ }
+
+ //**************************************************************
glPushMatrix();
+ // define (0,0) as center of screen
glTranslatef( centroid.x, centroid.y, 0);
-//*********************************************************
-//waypoint marker computation
- float fromwp_lat,towp_lat,fromwp_lon,towp_lon,dist,delx,dely,hyp,theta,brg;
-
- fromwp_lon = get_longitude()*DEG_TO_RAD;
- fromwp_lat = get_latitude()*DEG_TO_RAD;
- towp_lon = get_aux5()*DEG_TO_RAD;
- towp_lat = get_aux6()*DEG_TO_RAD;
-
- dist = acos(sin(fromwp_lat)*sin(towp_lat)+cos(fromwp_lat)*cos(towp_lat)*cos(fabs(fromwp_lon-towp_lon)));
- delx= towp_lat - fromwp_lat;
- dely = towp_lon - fromwp_lon;
- hyp = sqrt(pow(delx,2)+pow(dely,2));
- if (hyp != 0) {
- theta = asin(dely/hyp);
- } else {
- theta = 0.0;
- }
- brg = theta*RAD_TO_DEG;
- if (brg > 360.0) brg = 0.0;
- if (delx < 0) brg = 180 - brg;
-
-// {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
-// Brg = Brg * RAD_TO_DEG; }
- dist = dist*RAD_TO_DEG * 60.0*1852.0; //rad->deg->nm->m
-//*********************************************************
+ // OBJECT STATIC RETICLE
+ // TYPE FRL
+ // ATTRIB - ALWAYS
// Draw the FRL spot and line
+ if(frl) {
#define FRL_DIAMOND_SIZE 2.0
- glBegin(GL_LINE_LOOP);
- glVertex2f( -FRL_DIAMOND_SIZE, 0.0);
- glVertex2f(0.0, FRL_DIAMOND_SIZE);
- glVertex2f( FRL_DIAMOND_SIZE, 0.0);
- glVertex2f(0.0, -FRL_DIAMOND_SIZE);
- glEnd();
- glBegin(GL_LINE_STRIP);
- glVertex2f(0, FRL_DIAMOND_SIZE);
- glVertex2f(0, 8.0 );
- glEnd();
+ glBegin(GL_LINE_LOOP);
+ glVertex2f( -FRL_DIAMOND_SIZE, 0.0);
+ glVertex2f(0.0, FRL_DIAMOND_SIZE);
+ glVertex2f( FRL_DIAMOND_SIZE, 0.0);
+ glVertex2f(0.0, -FRL_DIAMOND_SIZE);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(0, FRL_DIAMOND_SIZE);
+ glVertex2f(0, 8.0 );
+ glEnd();
#undef FRL_DIAMOND_SIZE
+ }
+ // TYPE WATERLINE_MARK (W shaped _ _ )
+ // \/\/
+
+ //****************************************************************
+ // TYPE TARGET_SPOT
+ // Draw the target spot.
+ if (target_spot) {
+#define CENTER_DIAMOND_SIZE 6.0
+ glBegin(GL_LINE_LOOP);
+ glVertex2f( -CENTER_DIAMOND_SIZE, 0.0);
+ glVertex2f(0.0, CENTER_DIAMOND_SIZE);
+ glVertex2f( CENTER_DIAMOND_SIZE, 0.0);
+ glVertex2f(0.0, -CENTER_DIAMOND_SIZE);
+ glEnd();
+#undef CENTER_DIAMOND_SIZE
+ }
- //velocity vector reticle - computations
+ //****************************************************************
+ //velocity vector reticle - computations
+ if(velocity_vector) {
Vxx = get_Vx();
Vyy = get_Vy();
Vzz = get_Vz();
- Axx = get_Ax();
+ Axx = get_Ax();
Ayy = get_Ay();
Azz = get_Az();
psi = get_heading();
- if (psi > 180.0) psi = psi - 360;
+ if (psi > 180.0) psi = psi - 360;
- total_vel = sqrt(Vxx*Vxx + Vyy*Vyy + Vzz*Vzz);
+ total_vel = sqrt(Vxx*Vxx + Vyy*Vyy + Vzz*Vzz);
ground_vel = sqrt(Vxx*Vxx + Vyy*Vyy);
up_vel = Vzz;
if (ground_vel < 2.0) {
- if (fabs(up_vel) < 2.0) {
- actslope = 0.0;
- } else {
- actslope = (up_vel/fabs(up_vel))*90.0;
- }
+ if (fabs(up_vel) < 2.0) {
+ actslope = 0.0;
+ } else {
+ actslope = (up_vel/fabs(up_vel))*90.0;
+ }
} else {
- actslope = atan(up_vel/ground_vel)*RAD_TO_DEG;
+ actslope = atan(up_vel/ground_vel)*RAD_TO_DEG;
}
- xvvr = (((atan2(Vyy,Vxx)*RAD_TO_DEG)-psi)*(640.0/45.0));
- drift = ((atan2(Vyy,Vxx)*RAD_TO_DEG)-psi);
- yvvr = ((actslope - pitch_value)*factor);
- vel_y = ((actslope -pitch_value) * cos(roll_value) + drift*sin(roll_value))*factor;
- vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))*(640/45.0);
-// printf("%f %f %f %f\n",vel_x,vel_y,drift,psi);
-
+ xvvr = (((atan2(Vyy,Vxx)*RAD_TO_DEG)-psi)*(640.0/45.0));
+ drift = ((atan2(Vyy,Vxx)*RAD_TO_DEG)-psi);
+ yvvr = ((actslope - pitch_value)*factor);
+ vel_y = ((actslope -pitch_value) * cos(roll_value) + drift*sin(roll_value))*factor;
+ vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))*(640/45.0);
+ // printf("%f %f %f %f\n",vel_x,vel_y,drift,psi);
+ //****************************************************************
+ // OBJECT MOVING RETICLE
+ // TYPE - DRIFT MARKER
+ // ATTRIB - ALWAYS
// drift marker
- glBegin(GL_LINE_STRIP);
- glVertex2f((xvvr*25/120)-6, -4);
- glVertex2f(xvvr*25/120, 8);
- glVertex2f((xvvr*25/120)+6, -4);
- glEnd();
-
-// clip hud ladder
- glClipPlane(GL_CLIP_PLANE0,eqn_top);
- glEnable(GL_CLIP_PLANE0);
- glClipPlane(GL_CLIP_PLANE1,eqn_left);
- glEnable(GL_CLIP_PLANE1);
- glClipPlane(GL_CLIP_PLANE2,eqn_right);
- glEnable(GL_CLIP_PLANE2);
-
- // alpha bracket - reqd only for landing (tied to hook)
- if (ihook == 1) {
- glBegin(GL_LINE_STRIP);
- glVertex2f(vel_x-20 , vel_y-(16-alpha)*factor);
- glVertex2f(vel_x-17, vel_y-(16-alpha)*factor);
- glVertex2f(vel_x-17, vel_y-(14-alpha)*factor);
- glVertex2f(vel_x-20, vel_y-(14-alpha)*factor);
- glEnd();
- glBegin(GL_LINE_STRIP);
- glVertex2f(vel_x+20 , vel_y-(16-alpha)*factor);
- glVertex2f(vel_x+17, vel_y-(16-alpha)*factor);
- glVertex2f(vel_x+17, vel_y-(14-alpha)*factor);
- glVertex2f(vel_x+20, vel_y-(14-alpha)*factor);
- glEnd();
+ if(drift_marker) {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f((xvvr*25/120)-6, -4);
+ glVertex2f(xvvr*25/120, 8);
+ glVertex2f((xvvr*25/120)+6, -4);
+ glEnd();
}
- //printf("xvr=%f,yvr=%f,Vx=%f,Vy=%f,Vz=%f\n",xvvr,yvvr,Vx,Vy,Vz);
- //printf("Ax=%f,Ay=%f,Az=%f\n",Ax,Ay,Az);
-
+ //****************************************************************
+ // Clipping coordinates for ladder to be input from xml file
+ // Clip hud ladder
+ if (clip_plane) {
+ glClipPlane(GL_CLIP_PLANE0,eqn_top);
+ glEnable(GL_CLIP_PLANE0);
+ glClipPlane(GL_CLIP_PLANE1,eqn_left);
+ glEnable(GL_CLIP_PLANE1);
+ glClipPlane(GL_CLIP_PLANE2,eqn_right);
+ glEnable(GL_CLIP_PLANE2);
+ // glScissor(-100,-240,200,240);
+ // glEnable(GL_SCISSOR_TEST);
+ }
+ //****************************************************************
+ // OBJECT MOVING RETICLE
+ // TYPE VELOCITY VECTOR
+ // ATTRIB - ALWAYS
+ // velocity vector
+ glBegin(GL_LINE_LOOP); // Use polygon to approximate a circle
+ for(count=0; count<50; count++) {
+ cosine = 6 * cos(count * 2 * M_PI/50.0);
+ sine = 6 * sin(count * 2 * M_PI/50.0);
+ glVertex2f(cosine+vel_x, sine+vel_y);
+ }
+ glEnd();
+ //velocity vector reticle orientation lines
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-12, vel_y);
+ glVertex2f(vel_x-6, vel_y);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x+12, vel_y);
+ glVertex2f(vel_x+6, vel_y);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x, vel_y+12);
+ glVertex2f(vel_x, vel_y+6);
+ glEnd();
+
+ // OBJECT MOVING RETICLE
+ // TYPE LINE
+ // ATTRIB - ON CONDITION
+ if (lgear == 1) {
+ // undercarriage status
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x+8, vel_y);
+ glVertex2f(vel_x+8, vel_y-4);
+ glEnd();
+ // OBJECT MOVING RETICLE
+ // TYPE LINE
+ // ATTRIB - ON CONDITION
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-8, vel_y);
+ glVertex2f(vel_x-8, vel_y-4);
+ glEnd();
+ // OBJECT MOVING RETICLE
+ // TYPE LINE
+ // ATTRIB - ON CONDITION
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x, vel_y-6);
+ glVertex2f(vel_x, vel_y-10);
+ glEnd();
+ }
+
+ // OBJECT MOVING RETICLE
+ // TYPE V
+ // ATTRIB - ON CONDITION
+ if (ihook == 1) {
+ // arrestor hook status
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-4, vel_y-8);
+ glVertex2f(vel_x, vel_y-10);
+ glVertex2f(vel_x+4, vel_y-8);
+ glEnd();
+ }
+ }//if velocity_vector
+
+ //***************************************************************
+ // OBJECT MOVING RETICLE
+ // TYPE - SQUARE_BRACKET
+ // ATTRIB - ON CONDITION
+ // alpha bracket
+ if (alpha_bracket) {
+ if (ihook == 1) {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-20 , vel_y-(16-alpha)*factor);
+ glVertex2f(vel_x-17, vel_y-(16-alpha)*factor);
+ glVertex2f(vel_x-17, vel_y-(14-alpha)*factor);
+ glVertex2f(vel_x-20, vel_y-(14-alpha)*factor);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x+20 , vel_y-(16-alpha)*factor);
+ glVertex2f(vel_x+17, vel_y-(16-alpha)*factor);
+ glVertex2f(vel_x+17, vel_y-(14-alpha)*factor);
+ glVertex2f(vel_x+20, vel_y-(14-alpha)*factor);
+ glEnd();
+ }
+ }
+ //printf("xvr=%f,yvr=%f,Vx=%f,Vy=%f,Vz=%f\n",xvvr,yvvr,Vx,Vy,Vz);
+ //printf("Ax=%f,Ay=%f,Az=%f\n",Ax,Ay,Az);
+ //****************************************************************
+ // OBJECT MOVING RETICLE
+ // TYPE ENERGY_MARKERS
+ // ATTRIB - ALWAYS
//energy markers - compute potential slope
+ if(energy_marker) {
if (total_vel < 5.0) {
- t1 = 0;
- t2 = 0;
+ t1 = 0;
+ t2 = 0;
} else {
- t1 = up_vel/total_vel;
- t2 = asin((Vxx*Axx + Vyy*Ayy + Vzz*Azz)/(9.81*total_vel));
+ t1 = up_vel/total_vel;
+ t2 = asin((Vxx*Axx + Vyy*Ayy + Vzz*Azz)/(9.81*total_vel));
}
pot_slope = ((t2/3)*RAD_TO_DEG)*factor + vel_y;
-
- //energy markers
- glBegin(GL_LINE_STRIP);
- glVertex2f(vel_x-20, pot_slope-5);
- glVertex2f(vel_x-15, pot_slope);
- glVertex2f(vel_x-20, pot_slope+5);
- glEnd();
- glBegin(GL_LINE_STRIP);
- glVertex2f(vel_x+20, pot_slope-5);
- glVertex2f(vel_x+15, pot_slope);
- glVertex2f(vel_x+20, pot_slope+5);
- glEnd();
- if (pla > (105.0/131.0)) {
- glBegin(GL_LINE_STRIP);
- glVertex2f(vel_x-24, pot_slope-5);
- glVertex2f(vel_x-19, pot_slope);
- glVertex2f(vel_x-24, pot_slope+5);
- glEnd();
- glBegin(GL_LINE_STRIP);
- glVertex2f(vel_x+24, pot_slope-5);
- glVertex2f(vel_x+19, pot_slope);
- glVertex2f(vel_x+24, pot_slope+5);
- glEnd();
+ // if (pot_slope < (vel_y - 45)) pot_slope = vel_y-45;
+ // if (pot_slope > (vel_y + 45)) pot_slope = vel_y+45;
+
+ //energy markers
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-20, pot_slope-5);
+ glVertex2f(vel_x-15, pot_slope);
+ glVertex2f(vel_x-20, pot_slope+5);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x+20, pot_slope-5);
+ glVertex2f(vel_x+15, pot_slope);
+ glVertex2f(vel_x+20, pot_slope+5);
+ glEnd();
+ if (pla > (105.0/131.0)) {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-24, pot_slope-5);
+ glVertex2f(vel_x-19, pot_slope);
+ glVertex2f(vel_x-24, pot_slope+5);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x+24, pot_slope-5);
+ glVertex2f(vel_x+19, pot_slope);
+ glVertex2f(vel_x+24, pot_slope+5);
+ glEnd();
+ }
}
-
-// ramp reticle - for ski jump takeoff only
- if (iclaw == 1) {
- glBegin(GL_LINE_STRIP);
- glVertex2f(-15, -134);
- glVertex2f(15, -134);
- glEnd();
- glBegin(GL_LINE_STRIP);
- glVertex2f(-6, -134);
- glVertex2f(-6, t2*RAD_TO_DEG*4.0 - 134);
- glVertex2f(+6, t2*RAD_TO_DEG*4.0 - 134);
- glVertex2f(6, -134);
- glEnd();
- glBegin(GL_LINE_LOOP);
- glVertex2f(-6, actslope*4.0 - 134);
- glVertex2f(0, actslope*4.0 -134 +3);
- glVertex2f(6, actslope*4.0 - 134);
- glVertex2f(0, actslope*4.0 -134 -3);
- glEnd();
+ //**********************************************************
+ // ramp reticle
+ // OBJECT STATIC RETICLE
+ // TYPE LINE
+ // ATTRIB - ON CONDITION
+ if (energy_worm) {
+ if (ilcanclaw == 1) {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(-15, -134);
+ glVertex2f(15, -134);
+ glEnd();
+ // OBJECT MOVING RETICLE
+ // TYPE BOX
+ // ATTRIB - ON CONDITION
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(-6, -134);
+ glVertex2f(-6, t2*RAD_TO_DEG*4.0 - 134);
+ glVertex2f(+6, t2*RAD_TO_DEG*4.0 - 134);
+ glVertex2f(6, -134);
+ glEnd();
+ // OBJECT MOVING RETICLE
+ // TYPE DIAMOND
+ // ATTRIB - ON CONDITION
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(-6, actslope*4.0 - 134);
+ glVertex2f(0, actslope*4.0 -134 +3);
+ glVertex2f(6, actslope*4.0 - 134);
+ glVertex2f(0, actslope*4.0 -134 -3);
+ glEnd();
+ }
}
-
+ //*************************************************************
+ // OBJECT MOVING RETICLE
+ // TYPE DIAMOND
+ // ATTRIB - ALWAYS
// Draw the locked velocity vector.
- glBegin(GL_LINE_LOOP);
+ if(climb_dive_marker) {
+ glBegin(GL_LINE_LOOP);
glVertex2f( -3.0, 0.0+vel_y);
glVertex2f(0.0, 6.0+vel_y);
glVertex2f( 3.0, 0.0+vel_y);
glVertex2f(0.0, -6.0+vel_y);
- glEnd();
-
-// draw velocity vector
- glBegin(GL_LINE_LOOP); // Use polygon to approximate a circle
- for(count=0; count<50; count++) {
- cosine = 6 * cos(count * 2 * M_PI/50.0);
- sine = 6 * sin(count * 2 * M_PI/50.0);
- glVertex2f(cosine+vel_x, sine+vel_y);
- }
- glEnd();
-
- //velocity vector reticle orientation lines
- glBegin(GL_LINE_STRIP);
- glVertex2f(vel_x-12, vel_y);
- glVertex2f(vel_x-6, vel_y);
- glEnd();
- glBegin(GL_LINE_STRIP);
- glVertex2f(vel_x+12, vel_y);
- glVertex2f(vel_x+6, vel_y);
- glEnd();
- glBegin(GL_LINE_STRIP);
- glVertex2f(vel_x, vel_y+12);
- glVertex2f(vel_x, vel_y+6);
- glEnd();
-
- if (lgear == 1) {
-// undercarriage status
- glBegin(GL_LINE_STRIP);
- glVertex2f(vel_x+8, vel_y);
- glVertex2f(vel_x+8, vel_y-4);
- glEnd();
- glBegin(GL_LINE_STRIP);
- glVertex2f(vel_x-8, vel_y);
- glVertex2f(vel_x-8, vel_y-4);
- glEnd();
- glBegin(GL_LINE_STRIP);
- glVertex2f(vel_x, vel_y-6);
- glVertex2f(vel_x, vel_y-10);
- glEnd();
+ glEnd();
}
- if (ihook == 1) {
-// arrestor hook status
- glBegin(GL_LINE_STRIP);
- glVertex2f(vel_x-4, vel_y-8);
- glVertex2f(vel_x, vel_y-10);
- glVertex2f(vel_x+4, vel_y-8);
- glEnd();
+ //****************************************************************
+
+ if(climb_dive_ladder) {// CONFORMAL_HUD
+
+ vmin = pitch_value - (float)width_units;
+ vmax = pitch_value + (float)width_units;
+
+ glTranslatef( vel_x, vel_y, 0);
+
}
+ else
+ if (pitch_ladder) {//Default Hud
+
+ vmin = pitch_value - (float)width_units * 0.5f;
+ vmax = pitch_value + (float)width_units * 0.5f;
+
+ }
- // FRL marker not rotated - this line shifted below
- glTranslatef( vel_x, vel_y, 0);
glRotatef(roll_value * RAD_TO_DEG, 0.0, 0.0, 1.0);
+ // FRL marker not rotated - this line shifted below
if( div_units ) {
float bot ;
float top ;
float text_offset = 4.0f ;
- float zero_offset = 50.0f ;
-
- fntFont *font = HUDtext->getFont();
- float pointsize = HUDtext->getPointSize();
- float italic = HUDtext->getSlant();
+ float zero_offset;
+
+ if(climb_dive_ladder)
+ zero_offset = 50.0f ;
+ else
+ if(pitch_ladder)
+ zero_offset = 10.0f ;
+
+ fntFont *font = HUDtext->getFont();
+ float pointsize = HUDtext->getPointSize();
+ float italic = HUDtext->getSlant();
TextList.setFont( HUDtext );
TextList.erase();
int i = FloatToInt(vmin);
if( !scr_hole ) {
+ x_end = half_span;
for( ; i<last ; i++ ) {
y = (((float)(i - pitch_value) * factor) + .5f);
label_height = (top - bot)/2.0f;
x_ini = -half_span;
- x_end = half_span;
if( i >= 0 ) {
// Make zero point wider on left
}
}
else // if(scr_hole )
- { // Draw ladder with space in the middle of the lines
- float hole = (float)((scr_hole)/2.0f);
- for( ; i<last ; i++ ) {
-
-// y = (((float)(i - pitch_value) * factor) + .5);
- y = (((float)(i - actslope) * factor) + .5);
+ { // Draw ladder with space in the middle of the lines
+ float hole = (float)((scr_hole)/2.0f);
- if( !(i % div_units )) { // At integral multiple of div
+ x_end = -half_span + hole;
+ x_ini2= half_span - hole;
+ for( ; i<last ; i++ ) {
- sprintf( TextLadder, "%d", i );
- font->getBBox ( TextLadder, pointsize, italic,
- &left, &right, &bot, &top ) ;
- label_length = right - left;
- label_length += text_offset;
- label_height = (top - bot)/2.0f;
-// printf("l %f r %f b %f t %f\n",left, right, bot, top );
+ if(hudladder_type=="Pitch Ladder")
+ y = (((float)(i - pitch_value) * factor) + .5);
+ else
+ if(hudladder_type=="Climb/Dive Ladder")
+ y = (((float)(i - actslope) * factor) + .5);
+
+ if( !(i % div_units )) { // At integral multiple of div
+
+ sprintf( TextLadder, "%d", i );
+ font->getBBox ( TextLadder, pointsize, italic,
+ &left, &right, &bot, &top ) ;
+ label_length = right - left;
+ label_length += text_offset;
+ label_height = (top - bot)/2.0f;
+ // printf("l %f r %f b %f t %f\n",left, right, bot, top );
- // Start by calculating the points and drawing the
- // left side lines.
- x_ini = -half_span;
- x_end = -half_span + hole;
-
- if( i >= 0 ) {
- // Make zero point wider on left
- if( i == 0 ) {
- x_ini -= zero_offset;
- } else {
- // Zero or above draw solid lines
- Line(x_end, y-5.0, x_end, y);
- }
-
- Line(x_ini, y, x_end, y);
-
- } else {
- // Below zero draw dashed lines.
- Line(x_end, y+5.0, x_end, y);
- StippleLine(x_ini, y, x_end, y);
- }
-
- // Now calculate the location of the left side label using
- Text( x_ini-label_length, y-label_height, TextLadder );
-
- // Now calculate and draw the right side line location
- x_ini = half_span - hole;
- x_end = half_span;
+ // Start by calculating the points and drawing the
+ // left side lines.
+ x_ini = -half_span;
+ x_end2= half_span;
- if( i >= 0 ) {
- if( i == 0 ) {
- x_end += zero_offset;
- } else {
- Line(x_ini, y-5.0, x_ini, y);
- }
- // Zero or above draw solid lines
- Line(x_ini, y, x_end, y);
- } else {
- // Below zero draw dashed lines.
- Line(x_ini, y+5.0, x_ini, y);
- StippleLine(x_ini, y, x_end, y);
- }
+ if( i >= 0 ) {
+ // Make zero point wider on left
+ if( i == 0 ) {
+ x_ini -= zero_offset;
+ x_end2 +=zero_offset;
+ } else {
+ if(climb_dive_ladder){
+ // Zero or above draw solid lines
+ Line(x_end, y-5.0, x_end, y);
+ Line(x_ini2, y-5.0, x_ini2, y);
+ }
+ }
+
+ Line(x_ini, y, x_end, y);
+ Line(x_ini2, y, x_end2, y);
+
+ } else {
+ // Below zero draw dashed lines.
+ if(climb_dive_ladder) {
+ Line(x_end, y+5.0, x_end, y);
+ Line(x_ini2, y+5.0, x_ini2, y);
+ }
+ StippleLine(x_ini, y, x_end, y);
+ StippleLine(x_ini2, y, x_end2, y);
+ }
- // Calculate the location and draw the right side label
- Text( x_end+text_offset, y-label_height, TextLadder );
- }
- }
-
- // draw appraoch glide slope marker - for landing only (tied to hook)
- if (ihook) {
- Line(-half_span+15, (-4-actslope)*factor, -half_span + hole, (-4-actslope)*factor);
- Line(half_span-15, (-4-actslope)*factor, half_span - hole, (-4-actslope)*factor);
- }
+ // Now calculate the location of the left side label using
+ Text( x_ini-label_length, y-label_height, TextLadder );
+ Text (x_end2+text_offset, y-label_height, TextLadder );
- }
+ }
+ }
+ // OBJECT LADDER MARK
+ // TYPE LINE
+ // ATTRIB - ON CONDITION
+ // draw appraoch glide slope marker
+ if (glide_slope_marker) {
+ if (ihook) {
+ Line(-half_span+15, (glide_slope-actslope)*factor, -half_span + hole, (glide_slope-actslope)*factor);
+ Line(half_span-15, (glide_slope-actslope)*factor, half_span - hole, (glide_slope-actslope)*factor);
+ }
+ }// if glide_slope_marker
+ }
TextList.draw();
glLineWidth(0.2);
glDisable(GL_CLIP_PLANE0);
glDisable(GL_CLIP_PLANE1);
glDisable(GL_CLIP_PLANE2);
-// glDisable(GL_SCISSOR_TEST);
+ // glDisable(GL_SCISSOR_TEST);
glPopMatrix();
-//*************************************************************
-// waypoint marker
-if (fabs(brg-psi) > 10.0) {
- glPushMatrix();
- glTranslatef( centroid.x, centroid.y, 0);
- glTranslatef( vel_x, vel_y, 0);
- glRotatef(brg - psi,0.0,0.0,-1.0);
- glBegin(GL_LINE_LOOP);
- glVertex2f(-2.5,20.0);
- glVertex2f(-2.5,30.0);
- glVertex2f(-5.0,30.0);
- glVertex2f(0.0,35.0);
- glVertex2f(5.0,30.0);
- glVertex2f(2.5,30.0);
- glVertex2f(2.5,20.0);
- glEnd();
- glPopMatrix();
-}
-// waypoint marker on heading scale
-if (fabs(brg-psi) < 12.0) {
- glBegin(GL_LINE_LOOP);
- glVertex2f(((brg-psi)*60/25)+320,240.0);
- glVertex2f(((brg-psi)*60/25)+326,240.0-4);
- glVertex2f(((brg-psi)*60/25)+323,240.0-4);
- glVertex2f(((brg-psi)*60/25)+323,240.0-8);
- glVertex2f(((brg-psi)*60/25)+317,240.0-8);
- glVertex2f(((brg-psi)*60/25)+317,240.0-4);
- glVertex2f(((brg-psi)*60/25)+314,240.0-4);
- glEnd();
-}
-//*************************************************************
-
-}
-#else
-// $$$ end - added VS Renganathan, 13 Oct 2K
-
-// draw DEFAULT_HUD
-void HudLadder :: draw( void )
-{
- POINT centroid = get_centroid();
-
- float roll_value = current_ch2();
-
- glPushMatrix();
- glTranslatef( centroid.x, centroid.y, 0);
- // Alex's panel patch
-// glScalef( globals->get_options()->get_fov()/55.0, 1.0, 1.0 );
- glRotatef(roll_value * RAD_TO_DEG, 0.0, 0.0, 1.0);
-
- // Draw the target spot.
-#define CENTER_DIAMOND_SIZE 6.0f
-
- glBegin(GL_LINE_LOOP);
- glVertex2f( CENTER_DIAMOND_SIZE, 0.0);
- glVertex2f( 0.0, CENTER_DIAMOND_SIZE);
- glVertex2f( -CENTER_DIAMOND_SIZE, 0.0);
- glVertex2f( 0.0, -CENTER_DIAMOND_SIZE);
- glEnd();
-
- if( minimal || ! div_units ) {
- glPopMatrix();
- return;
- }
-
- float x_ini;
- float x_end;
- float y;
-
- float pitch_value = current_ch1() * RAD_TO_DEG;
- vmin = pitch_value - (float)width_units * 0.5f;
- vmax = pitch_value + (float)width_units * 0.5f;
-
- RECT box = get_location();
-
- float half_span = box.right * 0.5f ;
-
- char TextLadder[8] ;
- float label_length ;
- float label_height ;
- float left ;
- float right ;
- float bot ;
- float top ;
- float text_offset = 4.0f ;
- float zero_offset = 10.0f ;
-
- fntFont *font = HUDtext->getFont();
- float pointsize = HUDtext->getPointSize();
- float italic = HUDtext->getSlant();
-
- TextList.setFont( HUDtext );
- TextList.erase();
- LineList.erase();
- StippleLineList.erase();
-
- int last = FloatToInt(vmax)+1;
- int i = FloatToInt(vmin);
-
- if( !scr_hole ) {
- x_end = half_span;
- for( ; i<last ; i++ ) {
-
- y = (((float)(i - pitch_value) * factor) + .5f);
- if( !(i % div_units )) { // At integral multiple of div
-
- sprintf( TextLadder, "%d", i );
- font->getBBox ( TextLadder, pointsize, italic,
- &left, &right, &bot, &top ) ;
-
- label_length = right - left;
- label_length += text_offset;
- label_height = (top - bot) * 0.5f;
-
- x_ini = -half_span;
-
- if( i >= 0 ) {
- // Make zero point wider on left
- if( i == 0 )
- x_ini -= zero_offset;
- // Zero or above draw solid lines
- Line(x_ini, y, x_end, y);
- } else {
- // Below zero draw dashed lines.
- StippleLine(x_ini, y, x_end, y);
- }
-
- // Calculate the position of the left text and write it.
- Text( x_ini-label_length, y-label_height, TextLadder );
- Text( x_end+text_offset, y-label_height, TextLadder );
- }
- }
- } else { // scr_hole != 0
- // Draw ladder with space in the middle of the lines
- float x_ini2;
- float x_end2;
- float hole = (float)((scr_hole)*0.5f);
-
- x_end = -half_span + hole;
- x_ini2 = half_span - hole;
-
- for( ; i<last ; i++ ) {
-
- y = (((float)(i - pitch_value) * factor) + .5);
- if( !(i % div_units )) { // At integral multiple of div
-
- sprintf( TextLadder, "%d", i );
- font->getBBox ( TextLadder, pointsize, italic,
- &left, &right, &bot, &top ) ;
- label_length = right - left;
- label_length += text_offset;
- label_height = (top - bot) * 0.5f;
-
- // Start by calculating the points and drawing the
- // left side lines.
- x_ini = -half_span;
- x_end2 = half_span;
-
- if( i >= 0 ) {
- // Make zero point wider on left
- if( i == 0 ) {
- x_ini -= zero_offset;
- x_end2 += zero_offset;
- }
- // Zero or above draw solid lines
- Line(x_ini, y, x_end, y);
- Line(x_ini2, y, x_end2, y);
- } else {
- // Below zero draw dashed lines.
- StippleLine(x_ini, y, x_end, y);
- StippleLine(x_ini2, y, x_end2, y);
- }
- // Calculate the location of the left side label using
- Text( x_ini-label_length, y-label_height, TextLadder );
- // Calculate the location and draw the right side label
- Text( x_end2+text_offset, y-label_height, TextLadder );
- }
- }
+ //*************************************************************
+ //*************************************************************
+ if(waypoint_marker) {
+ //waypoint marker computation
+ float fromwp_lat,towp_lat,fromwp_lon,towp_lon,dist,delx,dely,hyp,theta,brg;
+
+ fromwp_lon = get_longitude()*DEG_TO_RAD;
+ fromwp_lat = get_latitude()*DEG_TO_RAD;
+ towp_lon = get_aux5()*DEG_TO_RAD;
+ towp_lat = get_aux6()*DEG_TO_RAD;
+
+ dist = acos(sin(fromwp_lat)*sin(towp_lat)+cos(fromwp_lat)*cos(towp_lat)*cos(fabs(fromwp_lon-towp_lon)));
+ delx= towp_lat - fromwp_lat;
+ dely = towp_lon - fromwp_lon;
+ hyp = sqrt(pow(delx,2)+pow(dely,2));
+ if (hyp != 0) {
+ theta = asin(dely/hyp);
+ } else {
+ theta = 0.0;
}
- TextList.draw();
-
- LineList.draw();
-
- glEnable(GL_LINE_STIPPLE);
-#ifdef DO_PANEL_HACK
- glLineStipple( 1, fgPanelVisible() ? 0x0F0F : 0x00FF );
-#else
- glLineStipple( 1, 0x00FF );
-#endif
-
- StippleLineList.draw( );
- glDisable(GL_LINE_STIPPLE);
-
-// } // if(div_units)
- glPopMatrix();
-}
-
-#endif // DEFAULT_HUD
+ brg = theta*RAD_TO_DEG;
+ if (brg > 360.0) brg = 0.0;
+ if (delx < 0) brg = 180 - brg;
+
+ // {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
+ // Brg = Brg * RAD_TO_DEG; }
+ dist = dist*RAD_TO_DEG * 60.0*1852.0; //rad->deg->nm->m
+ // end waypoint marker computation
+ //*********************************************************
+ // OBJECT MOVING RETICLE
+ // TYPE ARROW
+ // waypoint marker
+ if (fabs(brg-psi) > 10.0) {
+ glPushMatrix();
+ glTranslatef( centroid.x, centroid.y, 0);
+ glTranslatef( vel_x, vel_y, 0);
+ glRotatef(brg - psi,0.0,0.0,-1.0);
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(-2.5,20.0);
+ glVertex2f(-2.5,30.0);
+ glVertex2f(-5.0,30.0);
+ glVertex2f(0.0,35.0);
+ glVertex2f(5.0,30.0);
+ glVertex2f(2.5,30.0);
+ glVertex2f(2.5,20.0);
+ glEnd();
+ glPopMatrix();
+ }
+ // waypoint marker on heading scale
+ if (fabs(brg-psi) < 12.0) {
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(((brg-psi)*60/25)+320,240.0);
+ glVertex2f(((brg-psi)*60/25)+326,240.0-4);
+ glVertex2f(((brg-psi)*60/25)+323,240.0-4);
+ glVertex2f(((brg-psi)*60/25)+323,240.0-8);
+ glVertex2f(((brg-psi)*60/25)+317,240.0-8);
+ glVertex2f(((brg-psi)*60/25)+317,240.0-4);
+ glVertex2f(((brg-psi)*60/25)+314,240.0-4);
+ glEnd();
+ }
+ //*************************************************************
+ }// if waypoint_marker
+}//draw