diff --git a/docs-mini/README.xmlhud b/docs-mini/README.xmlhud deleted file mode 100644 index b982687fb..000000000 --- a/docs-mini/README.xmlhud +++ /dev/null @@ -1,409 +0,0 @@ -Users' Guide to FlightGear Hud configuration -December 22 2000 -Neetha Girish - -This document describes the reconfigurable HUD of -FlightGear implemented through XML config files. -The present reconfigurable HUD code uses most of the code -of version 0.6.1 vintage and I have adapted the same to provide -a reconfigurable HUD for fgfs. -Corrections and additions are welcome. - -Some History: - -Older versions of FGFS had a hard coded display of HUD. -This was a less than ideal state of affairs when it came to -using different aircraft Huds. I remember, somewhere in the 0.6.1 HUD code -it was written that the HUD code is 'presently' hard coded but ideally should -be moved into the aircraft configuration dataset, so that when you choose -an aircraft, its HUD loads. -This implementation make that possible, all you have to do is to -create appropriate 'my_aircraft.xml' files in the HUD directory and -without re-compiling the code you could have 'your_aircraft' HUD, by choosing that -in the .fgfsrc file or as a command line option as described later. Of course, -as of now, I have only implemented those HUD instruments in .xml readable form -as was available in version 0.7.6 + few more used by ADA, Bangalore for our -aircraft carrier take-off/landing simulation studies . -To use the ADA specific reticles/HUD objects, please contact me/ you can figure it out -yourself by studying the code. All of them are relevant 'only' if you use the conformal -climb/dive ladder, since they are all referenced to it. -The rewrite of Hud display code was done using pre and post release v0.7.6 code -allowing for configuration of the hud via XML. - -The present Configurable Hud implements the entire functionality of -fgfs HUD (called default HUD) till this date. - -Using Default/Custom Hud: - -The default HUD location is $FG_ROOT/Huds/Default. -$FG_ROOT is the place on your filesystem where you installed FG -data files. Alternate huds can be specified on the command line -or set as the default in the $HOME/.fgfsrc or $FG_ROOT/preferences.xml -using a property specification. The command line format is as follows: - ---prop:/sim/hud/path=Huds/Default/default.xml - -The path description shown is relative to $FG_ROOT. An absolute -path may also be used for locations outside $FG_ROOT. -For the custom Hud the path will be Huds/Custom/default.xml - - -Hud - Implementation: - -All of the hud configuration files are XML-encoded property lists. -The root element of each file is always named . Tags are -always found in pairs, with the closing tag having a slash prefixing -the tag name, i.e . The top level panel configuration -file is composed of a and zero or more . -Instruments are used by including a <"unique_name"> and a to the -instruments configuration file. -Comments are bracketed with . - - Example Top Level Hud Config - - - Default Aircraft Hud - - - - Huds/Instruments/Default/hudladder.xml - - - - Huds/Instruments/Default/hudcard.xml - - - - Huds/Instruments/Default/instrlabel.xml - - - - Huds/Instruments/Default/fgtbi.xml - - - - - - -The default location for instrument files is $FG_ROOT/Huds/Instruments/Default. -The location for custom instrument files is $FG_ROOT/Huds/Instruments/Custom. -The location for minimal instrument files is $FG_ROOT/Huds/Instruments/Minimal. -Alternate locations may be specified in the hud configuration, paths -must be absolute to use files outside $FG_ROOT. - -About Instrument Placement: - -For the sake of simplicity the FGFS HUD overlay is always 640 x 480 res. -so all x/y values for instrument placement should fall within these bounds. -Being an OpenGL program, 0,0 represents the lower left hand corner of the -screen. - -Instrument Implementation: - -Instruments are defined in separate configuration files. -The Instruments are basically classified into 4 types( Each of them an xml file) : -The Hud Ladder, -The Hud Card, -The Hud Label and -The Turn Bank Indicator -.... (Note that that the earlier HUD classes/objects have been retained) -Newer objects may be instantiated using the above classes, Unless a totally -new object is required). - -The Default as well as the Custom directory have the same (in terms of properties) -set of configuration files (but with different values to suit the aircraft). - -We have a Base class - Hud Instrument Item. -We derive two more base classes - Instrument Scale and Dual Instrument Item from this. -(This implementation owes its existence to all those who wrote the HUD code for 0.6.1) - -The Hud Instrument Label is an instantiable class derived from Hud Instrument Item - for -displaying alphanumeric labels (altitude, velocity, Mach no and/or anything else as long you -have a call back function to pass the value using the property 'data_source'). - -The Hud Card is an instantiable class derived from Instrument scale - for displaying -tapes and guages (single variable display, for displaying aoa, g's, vsi, elevator_posn, etc.). - -The Hud Ladder is an instantiable class derived from Dual Instrument Item - for displaying -pitch reference ladder or climb/dive ladder (two variable display, for dislaying two types of -ladders, the pitch reference ladder or the climb/dive ladder as defined by MIL-1787b). - -The fgTBI Instrument is an instantiable class derived from Dual Instrument scale again -- for display of Bank angle and Sideslip (two variable display, for display of TSI info, kept -different from the two variable ladder object basically because of its totally different -draw member function). - -Most Hud instruments may be instantiated using above. It is proposed to provide all -Hud objects as defined in MIL-STD-1797A, soon. - -Here is how you position 'any' object: - -x ____________ x+width - | | - | | -y ------------ y+height - -this defines the objects position centered about the centroid of above rectangle -in HUD overlay plane (640x480) coordinates with 0,0 at bottom-left corner. - -One more, pixels per degree in the ladder class represents the compression factor of the -pitch ladder. In case of conformal HUD (climd/dive ladder) it is <640/horizontal_fov> -or <480/vertical_fov>. In case of pitch reference ladder it is -. - -Example of Hud Ladder xml file. - - - - - - - Pitch Ladder - 260 - 150 - 120 - 180 - 2.68 - roll - pitch - 45.0 - 10.0 - 70 - 0 - false - true - false - false - false - false - false - false - 0.0 - true - - - - - - -Before you read this, _____ this is tick_top | | - | | | - | |__________________| - | this is cap_right,tick_left cap_bottom tick_right - | - _____| this is tick_bottom - -Example of Hud Card xml file. - - - - - - - Gyrocompass - 220 - 430 - 200 - 28 - heading - 4 - 360.0 - 0.0 - 1.0 - 5 - 1 - 360 - 25.0 - tape - false - false - true - true - true - false - false - false - 0.0 - true - fixed - true - - - - - - -Tape Options: - -HUDS_AUTOTICKS = 0x0001 -HUDS_VERT = 0x0002 -HUDS_HORZ = 0x0000 -HUDS_TOP = 0x0004 -HUDS_BOTTOM = 0x0008 -HUDS_LEFT = HUDS_TOP -HUDS_RIGHT = HUDS_BOTTOM -HUDS_BOTH = (HUDS_LEFT | HUDS_RIGHT) -HUDS_NOTICKS = 0x0010 -HUDS_ARITHTIC = 0x0020 -HUDS_DECITICS = 0x0040 -HUDS_NOTEXT = 0x0080 -HUDS_LEFT | HUDS_VERT = 0x0006 -HUDS_RIGHT | HUDS_VERT = 0x0010 -HUDS_TOP | HUDS_NOTEXT = 0x0084 -HUDS_BOTTOM | HUDS_NOTEXT = 0x0088 -HUDS_VERT | HUDS_LEFT | HUDS_NOTEXT = 0x0086 -HUDS_RIGHT | HUDS_VERT | HUDS_NOTEXT = 0x0090 - - -For clarity, I repeat, Ticks and Caps : - - -1. Left Tick ->|_____|<- Right Tick - | - v - Bottom Cap - -2. Top Cap - | - v - _____ - | | - - -3. Top Tick - | - v - --- - | - |<- Right Cap - | - --- - | - v - Bottom Tick - -4. --- - | - Left Cap -> | - | - --- - -Marker Offset : - -To Draw pointer on the scale markings. In the case of a our hud with offset 10.0 -The pointer is away from the scale and points at the markings. - - -| - - -| - - <| -< - -| - - -| - -Marker offset = 0.0 Marker offset = 10.0 - -This should be useful when I implement the fixed tape/moving pointer. - - -Example of a Label xml file. - - - - - - - machno - 25 - 130 - 40 - 30 - mach - %4.2f - blank - NULL - 1.0 - 4 - 2 - 0 - true - false - false - - - - - - - -Example of a Turn Bank Indicator xml file. - - - - - - - fgTBI_Instrument - 290 - 45 - 60 - 10 - roll - sideslip - 45.0 - 5.0 - 5 - true - - - - - - -I have still got to implement dials (as in MIL-STD-1787b). - -REMEMBER IF YOU NEED TO INDICATE ANY OTHER PARAMETER ON THE HUD OTHER THAN WHAT IS PROVIDED AS -CALLBACK FUNCTIONS (PROPERTY NAMES LISTED BELOW) YOU HAVE TO FIDDLE WITH THE CODE, AS YET. LET ME -KNOW AND I SHALL INCLUDE THAT. - -anzg -heading -aoa -climb -altitude -agl -speed -view_direction -aileronval -elevatorval -rudderval -throttleval -aux16 -aux17 -aux9 -aux11 -aux12 -aux10 -aux13 -aux14 -aux15 -aux8 -ax -mach -framerate -fov -vfc_tris_culled -vfc_tris_drawn -latitude -longitude - - - - - - - - - - - - diff --git a/src/Main/fg_io.cxx b/src/Main/fg_io.cxx index 36ca64433..dda35d069 100644 --- a/src/Main/fg_io.cxx +++ b/src/Main/fg_io.cxx @@ -29,6 +29,7 @@ #include // atoi() #include +#include #include #include @@ -76,15 +77,13 @@ FGIO::FGIO() { } -#include -using std::for_each; -static void delete_ptr( FGProtocol* p ) { delete p; } + + FGIO::~FGIO() { - shutdown_all(); - for_each( io_channels.begin(), io_channels.end(), delete_ptr ); + } @@ -94,7 +93,7 @@ FGIO::parse_port_config( const string& config ) { SG_LOG( SG_IO, SG_INFO, "Parse I/O channel request: " << config ); - vector tokens = simgear::strutils::split( config, "," ); + string_list tokens = simgear::strutils::split( config, "," ); if (tokens.empty()) { SG_LOG( SG_IO, SG_ALERT, @@ -315,9 +314,8 @@ FGIO::init() // parse the configuration strings and store the results in the // appropriate FGIOChannel structures - typedef vector container; - container::iterator i = globals->get_channel_options_list()->begin(); - container::iterator end = globals->get_channel_options_list()->end(); + string_list::iterator i = globals->get_channel_options_list()->begin(); + string_list::iterator end = globals->get_channel_options_list()->end(); for (; i != end; ++i ) { p = parse_port_config( *i ); @@ -339,7 +337,6 @@ FGIO::reinit() { } - // process any IO channel work void FGIO::update( double delta_time_sec ) @@ -347,9 +344,8 @@ FGIO::update( double delta_time_sec ) // cout << "processing I/O channels" << endl; // cout << " Elapsed time = " << delta_time_sec << endl; - typedef vector< FGProtocol* > container; - container::iterator i = io_channels.begin(); - container::iterator end = io_channels.end(); + ProtocolVec::iterator i = io_channels.begin(); + ProtocolVec::iterator end = io_channels.end(); for (; i != end; ++i ) { FGProtocol* p = *i; @@ -369,24 +365,24 @@ FGIO::update( double delta_time_sec ) } } - void -FGIO::shutdown_all() { +FGIO::shutdown() +{ FGProtocol *p; - // cout << "shutting down all I/O channels" << endl; - - typedef vector< FGProtocol* > container; - container::iterator i = io_channels.begin(); - container::iterator end = io_channels.end(); + ProtocolVec::iterator i = io_channels.begin(); + ProtocolVec::iterator end = io_channels.end(); for (; i != end; ++i ) { - p = *i; - - if ( p->is_enabled() ) { - p->close(); - } + p = *i; + if ( p->is_enabled() ) { + p->close(); + } + + delete p; } + + io_channels.clear(); } void diff --git a/src/Main/fg_io.hxx b/src/Main/fg_io.hxx index c4eff1b8b..5637c5df5 100644 --- a/src/Main/fg_io.hxx +++ b/src/Main/fg_io.hxx @@ -45,7 +45,7 @@ public: void unbind(); void update( double dt ); - void shutdown_all(); + void shutdown(); private: @@ -55,7 +55,9 @@ private: // define the global I/O channel list //io_container global_io_list; - std::vector< FGProtocol* > io_channels; + + typedef std::vector< FGProtocol* > ProtocolVec; + ProtocolVec io_channels; }; diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index c28c9f5d2..29b791fe5 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -172,6 +172,7 @@ FGGlobals::~FGGlobals() delete ai; } + subsystem_mgr->shutdown(); subsystem_mgr->unbind(); delete subsystem_mgr;