// ****************************************** // Track edit Script file - Version 18 // R.D.Pask // 01/09/2001 // Copyright 2001 R.D.Pask // ***************************************** // Purpose: // Developed for use with TrackEdit application // to read commands and create map files. // // Revisions: // Orig 31/12/00 - Original File // 3 14/01/01 - Added Continue loop to help debug. // 7 16/01/01 - Command interpreter added. // 8 18/01/01 - Map and bitmap saves added // 9 21/01/01 - Testing variable version of command interpreter // 10 17/02/01 - Added comments in script for maintainability purposes // 11 17/02/01 - More Updates to comments // 12 03/04/01 - Added Change to Map Display for Command 3. Allows scale to be modified // Interface added for Center and scale of Map. // 13 14/04/01 - Added Protection for Lat/Long and Scale when not set to valid inputs. // Temporary values for acf.cdat (%output1) added after definition // before map is displayed. // 14 16/04/01 - Added Wait to end of Script between processing. // 15 23/08/01 - Low resolution Display updated. // 17 01/09/01 - Command 1 change to include center. // Command 3 and 4 now use map 1 and 2. Map 3 and 4 not loaded. // 18 01/09/01 - Command 1 Center Removed. TrackEdit does not provide center // and scale for Map plots. Intended for Chart Map with no aircraft // symbol. Modified Command 1 to save bitmap in a1bitmap to debug // actual map being used. // // 1.0 Set up Initial conditions // debug() // set this on while debugging your script minimize() // optionally, start AGIS in minimized mode sendmessage() // // 2.0 Initialise Variables // variables($var1,$debug,$version) variables($icommand,$imapfile,$ibitmap) variables($isymbol,$ilat,$ilong,$iheading) variables($iclat,$iclong,$icscale) variables($endflag) // Debug: 0 - No Messages, 1 - Detail, 2 - All Messages $debug=0 $var1=ONE $version=15 $endflag=0 // // Track Edit Interface File // // 3.0 Inform user AGIS started // if($debug>0) message(Trackedit Version $version, First AGIS_OK sent) endif($debug>0) // if($debug=1) message(Trackedit Version $version, First AGIS_OK sent, Sending 6 more) endif($debug=1) // // 4.0 Debug Message Loop // if($debug=1) while($var1 < 6) wait(1000) message(sending AGIS_OK $var1) sendmessage() $var1=$var1+ONE endwhile($var1 < 6) message(5 off AGIS_OK messages sent) endif($debug=1) // // 4.1 Define input and output files // // 4.1.1 Input and output files // infile(#interface,PRGPATH\trackedit.aif) outfile(%output1,DATAPATH\acf1.dat,replace) // 4.1.1.1 Write temporary Dat File %output1.open() %output1.print(0.0 0.0 1 0) %output1.close() // // 4.1.2 Map displays // display(@mapdisp1,ChartMap) display(@mapdisp2,aDisplayMap) //display(@mapdisp3,aalast) //display(@mapdisp4,aDisplayMap) // // 5.0 wait for Signal from external application // while($endflag=0) waitmessage() // wait for an AGIS_CONTINUE message // // 5.1 Export Debug message when message recevied. // if($debug>0) message(Message Received from Track Edit, Executing ....) endif($debug>0) // // 5.2 Open Interface file from external application // #interface.open() // // 5.3 Read interface messages from File // #interface.readline($icommand) #interface.readline($imapfile) #interface.readline($ibitmap) #interface.readline($isymbol) #interface.readline($ilong) #interface.readline($ilat) #interface.readline($iheading) #interface.readline($iclong) #interface.readline($iclat) #interface.readline($icscale) // // 5.4 Close Interface file // #interface.close() // // 5.5 Interpret commands // // 5.5.1 (0) Exit Command - tested 16/1/01 RDP if($icommand=0) if($debug=2) message(Executing Exit command (0)) endif($debug=2) exit() $endflag=1 endif($icommand=0) // // 5.5.2 (1) Generate Map Command if($icommand=1) if($debug=2) message(Executing Map Command (1) $imapfile , $ibitmap) endif($debug=2) // // 5.5.2 Display Map // if($icscale>0) @mapdisp1.coordinates($iclat, $iclong, $icscale) endif($icscale>0) @mapdisp1.show() // // Note AGIS does not allow variables to be used for File names. // @mapdisp1.savebitmap(chartbitmap) endif($icommand=1) // 5.5.3 (3) Generate Display Map if($icommand=3) if($debug=2) message(Executing Map Command (3) $imapfile , $ibitmap) endif($debug=2) // // 5.5.3.1 Display Map // if($icscale>0) @mapdisp2.coordinates($iclat, $iclong, $icscale) endif($icscale>0) @mapdisp2.show() @mapdisp2.savebitmap(display) endif($icommand=3) // 5.5.4 (2) Generate Map with Symbol if($icommand=2) if($debug=2) message(Executing Map Command (2)) endif($debug=2) // // 5.5.4.1 Create data file for Symbol // %output1.open() %output1.print($ilong $ilat $isymbol $iheading) %output1.close() // // 5.5.4.2 Display Map // if($icscale>0) @mapdisp1.coordinates($iclat, $iclong, $icscale) endif($icscale>0) @mapdisp1.show() @mapdisp1.savebitmap(a3bitmap) // End of Map Display endif($icommand=2) // 5.5.5 (4) Generate Display Map with Symbol if($icommand=4) if($debug=2) message(Executing Map Command (4)) endif($debug=2) // // 5.5.5.1 Create data file for Symbol // %output1.open() %output1.print($ilong $ilat $isymbol $iheading) %output1.close() // // 5.5.5.2 Display map // if($icscale>0) @mapdisp2.coordinates($iclat, $iclong, $icscale) endif($icscale>0) @mapdisp2.show() @mapdisp2.savebitmap(display) // End of Map Display endif($icommand=4) // End of Command Interpretation // // 5.6 Send end of command interpretation message to external application. // // wait(100) // Wait to allow Trakedit to catch up. sendmessage() // broadcast an AGIS_OK message endwhile($endflag=0) // // 6.0 Close displays // @mapdisp1.close() @mapdisp2.close() @mapdisp3.close() @mapdisp4.close() // end of Script file.