diff --git a/perl/GPLIGC.pl b/perl/GPLIGC.pl index 1289211..c6a53ed 100755 --- a/perl/GPLIGC.pl +++ b/perl/GPLIGC.pl @@ -58,8 +58,6 @@ $config{'optimizer_debug'} = 0; $config{'maps'} = "1"; $config{'map_type'}= "osm"; $config{'map_gms_v'}=130; # as of 12/2013 v132 seems to be the lowest number -$map_gms_v_min=10000; -$map_gms_v_max=$config{'map_gms_v'}; $config{'maps_zoomlevel'}= 8; $config{'map_max_scalesize'}=750; $config{'map_max_tiles'}=30; @@ -138,19 +136,19 @@ along with this program. If not, see . ENDE ### Global variables -$altmode = 'baro'; -$filestat='closed'; -$file='No file opened'; -#$sigusr2flag=0; -$optimized_for = "none"; -$zoom = 0; -$cut_track = 0; -$hide_mm = 0; # if 1 hide pictures and mm -$delta_photo_time = 0; # offset between GPS time and camera clock -$savname = 'no'; # not set -$zl = 0; -$tiles = 0; -$map_reload = 0; +my $altmode = 'baro'; +my $filestat='closed'; +my $file='No file opened'; +#my $sigusr2flag=0; +my $optimized_for = "none"; +my $zoom = 0; +my $cut_track = 0; +my $hide_mm = 0; # if 1 hide pictures and mm +my $delta_photo_time = 0; # offset between GPS time and camera clock +my $savname = 'no'; # not set +my $zl = 0; +my $tiles = 0; +my $map_reload = 0; # flag for Tk::JPEG module my $have_jpeg = 0; @@ -162,15 +160,28 @@ my $have_EXIF = 0; my $have_imager = 0; my $have_png = 0; +# Temporary directory +my $pfadftmp; + +my $map_gms_v_min=10000; +my $map_gms_v_max=$config{'map_gms_v'}; + +my %gpi; + $gpi{'qnh'} = 1013.25; # just to avoid an error if the pressure plot is issued without igc file # all temp-files to be cleaned later # these are the data files used for Gnuplot -@clearlist=qw(zyl.dat speed.dat press.dat plot.bat vario.dat gpsvario.dat deltah.dat +my @clearlist=qw(zyl.dat speed.dat press.dat plot.bat vario.dat gpsvario.dat deltah.dat baro.dat gpsalt.dat 3d.dat lonproj.dat latproj.dat befehl.dat km.dat lonlat.dat enl.dat ias.dat tas.dat iashisto.dat tashisto.dat shisto.dat vhisto.dat vhistogps.dat plot.gpl plot.bat barohisto.dat gpshisto.dat wind.dat sat.dat tmp.png); +# More stuff that's not properly passed around. +my $FDR; +my $task_state; +my $wpcyl_state; + # ===16=== is this all needed... socket connection!!! # this is used for Communication with openGLIGCexplorer # use IPC::SysV qw(IPC_RMID IPC_CREAT S_IRWXU ftok); @@ -424,6 +435,19 @@ MainLoop; ### ############################################################################### +# Global state +my ($FlightView, $canvas, $WPPlotWindow, $barocanvas); +my ($minlat, $minlon, $dxp, $dyp); +my @introtext; +my @trackplot; +my @mapplot; +my @baroplot; +my @baroplot_task; +my @wpcyl_lines; +my @acc_lines; +my @task_lines; +my @marks_lines; + sub updateCyl { if (Exists($FlightView)) { if ($wpcyl_state == 1) {wpcyldraw(0); wpcyldraw(1);} @@ -464,6 +488,70 @@ sub updateCoor { if (Exists($WPPlotWindow)) {WPPlotUpdate();} } +# More global crap.. +my @DECLAT; +my @DECTIME; +my @DECLON; +my @FIX; +my @FIXb; +my @LAT; +my @LON; +my @IAS; +my @TAS; +my @SIU; +my @FXA; +my @VXA; +my @RPM; +my @KMY; +my @KMX; +my @ENL; +my @BARO; +my @TIME; +my @GPSALT; +my @TASK; +my @TASK_info; +my @HEADER; +my @IVARIO; +my @IVARIOGPS; +my @ASPEED; +my @WPNAME; +my @WPLAT; +my @WPLON; +my @WPRADFAC; +my @WPIGCLAT; +my @WPIGCLON; +my @nonIVARIO; +my @nonIVARIOGPS; +my @nonISPEED; +my @compVARIO; + +my $VXAEXISTS; +my $RPMEXISTS; +my $TASKEXISTS; +my $FXAEXISTS; +my $SIUEXISTS; +my $ENLEXISTS; +my $TASEXISTS; +my $IASEXISTS; + +my ($BARO_max, $BARO_min); +my ($GPSALT_max, $GPSALT_min); +my ($IAS_max, $IAS_min); +my ($TAS_max, $TAS_min); +my ($nonIVARIO_max, $nonIVARIO_min); +my ($nonIVARIOGPS_max, $nonIVARIOGPS_min); +my ($nonISPEED_max, $nonISPEED_min); + +my $busy; +my ($task_start_time_index, $task_finish_time_index); + +my ($xmin, $xmax, $zmin, $zmax, $ymin, $ymax); +my ($AKTWP, $MAXWP, $freeWP); +my ($com1, $com2); +my ($nr, $offset); +my ($liftsexist); +my ($stat_start, $stat_end); + sub oeffnen { ### open a File my $backup=$file; @@ -499,7 +587,7 @@ sub oeffnen { ### open a File $freeWP=1; $offset=0; #elevation offset, used as openGLIGCexplorer option... after using elevation calibration of FVW! - $nr = 0 ; + $nr = 0; # reset additional info in gpi-data $gpi{'month'}="00"; @@ -527,7 +615,7 @@ sub oeffnen { ### open a File ($gpi{'year'}, $gpi{'month'}, $gpi{'day'}) = GPLIGCfunctions::guessdatefromfilename($file); ### Einsaugen der IGC-Datei von File - @file=; ###global! file fuer alle!!! + my @file=; ###global! file fuer alle!!! close (FILE); $filestat='open'; ### Status : File geoeffnet @@ -548,7 +636,7 @@ sub oeffnen { ### open a File @LAT=(); @LON=(); @FIX=(); - my @FIXb=(); + @FIXb=(); @HEADER=(); @TASK=(); @ENL=(); #noise level @@ -564,8 +652,6 @@ sub oeffnen { ### open a File $TAS_min=100000; @ASPEED=(); - # $ASPEED_max=-10000; - # $ASPEED_min=100000; @compVARIO=(); @nonIVARIO=(); $nonIVARIO_max=-100; @@ -588,19 +674,26 @@ sub oeffnen { ### open a File # I-extensions to the B-record $IASEXISTS = "no"; - $IASLENGTH = 0; + my $IASSTART = 0; + my $IASLENGTH = 0; $TASEXISTS = "no"; - $TASLENGTH = 0; + my $TASSTART = 0; + my $TASLENGTH = 0; $ENLEXISTS = "no"; - $ENLLENGTH = 0; + my $ENLSTART = 0; + my $ENLLENGTH = 0; $SIUEXISTS = "no"; - $SIULENGTH = 0; + my $SIUSTART = 0; + my $SIULENGTH = 0; $FXAEXISTS = "no"; - $FXALENGTH = 0; + my $FXASTART = 0; + my $FXALENGTH = 0; $VXAEXISTS = "no"; - $VXALENGTH = 0; + my $VXASTART = 0; + my $VXALENGTH = 0; $RPMEXISTS = "no"; - $RPMLENGTH = 0; + my $RPMSTART = 0; + my $RPMLENGTH = 0; $TASKEXISTS = "no"; @@ -628,7 +721,7 @@ sub oeffnen { ### open a File # check for I_extensions to the Brecords (more here to be added SIU, FXA etc) if ($zeile=~/^I(.+)\S?/) { - $izeile=$1; + my $izeile=$1; if ($izeile =~/(\d{2})(\d{2})ENL/) { $ENLSTART = $1 - 2; @@ -755,7 +848,7 @@ sub oeffnen { ### open a File # convert time to decimal foreach (@TIME) { - $tmptime=GPLIGCfunctions::time2dec($_); + my $tmptime=GPLIGCfunctions::time2dec($_); push(@DECTIME, $tmptime); } @@ -771,15 +864,15 @@ sub oeffnen { ### open a File # Find reference point (center between max and min lat/lon) my ($maxlat, $minlat)=GPLIGCfunctions::MaxKoor(\@DECLAT); my ($maxlon, $minlon)=GPLIGCfunctions::MaxKoor(\@DECLON); - $centrex = ($minlon + $maxlon)/2; - $centrey = ($minlat + $maxlat)/2; + my $centrex = ($minlon + $maxlon)/2; + my $centrey = ($minlat + $maxlat)/2; print "OEFFNEN: init maxlat minlat maxlon minlon: $maxlat $minlat $maxlon $minlon\n" if ($config{'DEBUG'}); # KMY and KMX are km distances in X ynd Y from refernece point - for ($i=0; $i<=$#DECLAT; $i++){ + for (my $i=0; $i<=$#DECLAT; $i++){ my $dist=GPLIGCfunctions::dist($centrey,$DECLON[$i],$DECLAT[$i],$DECLON[$i]); if($centrey>$DECLAT[$i]){ $dist = -$dist; @@ -789,7 +882,7 @@ sub oeffnen { ### open a File push(@KMY, $dist); } - for ($i=0; $i<=$#DECLON; $i++){ + for (my $i=0; $i<=$#DECLON; $i++){ my $dist=GPLIGCfunctions::dist($DECLAT[$i],$centrex,$DECLAT[$i],$DECLON[$i]); if($centrex>$DECLON[$i]){ $dist = -$dist; @@ -798,7 +891,7 @@ sub oeffnen { ### open a File } # average speed, vario, gpsvario (averaged by $config{'integrate_over'} position fixes) - for ($i=0; $i<=$#DECLAT; $i++){ + for (my $i=0; $i<=$#DECLAT; $i++){ if ($i >= $config{'integrate_over'}) { my $dist=GPLIGCfunctions::dist($DECLAT[$i-$config{'integrate_over'}],$DECLON[$i-$config{'integrate_over'}],$DECLAT[$i],$DECLON[$i]); push(@ASPEED, ($dist/($DECTIME[$i]-$DECTIME[$i-$config{'integrate_over'}]))); @@ -813,7 +906,7 @@ sub oeffnen { ### open a File } # non averaged speed, vario. gpsvario TE vario(compVARIO) - for ($i=0; $i<=$#DECLAT; $i++) { + for (my $i=0; $i<=$#DECLAT; $i++) { if ($i >= 1) {# && $i <$#DECLAT) { my $dist=GPLIGCfunctions::dist($DECLAT[$i-1],$DECLON[$i-1],$DECLAT[$i],$DECLON[$i]); @@ -907,8 +1000,8 @@ sub oeffnen { ### open a File {Errorbox("total energy compensation was calculated from gps groundspeed!\nTo turn off this warning set te_warning = 0.\nAlso see te_vario_fallback");} # Maximum/minimum height: - ($maxbaro, $minbaro)=GPLIGCfunctions::MaxKoor(\@BARO); - ($maxgpsalt, $mingpsalt)=GPLIGCfunctions::MaxKoor(\@GPSALT); + my ($maxbaro, $minbaro)=GPLIGCfunctions::MaxKoor(\@BARO); + my ($maxgpsalt, $mingpsalt)=GPLIGCfunctions::MaxKoor(\@GPSALT); # write tmp-files tmpfileout(); @@ -1236,8 +1329,8 @@ sub oeffnen { ### open a File ### BARO HISTO - @baroBEREICH=(); - @baroHISTO=(); + my @baroBEREICH=(); + my @baroHISTO=(); $i = 0; # initialize the histo-arrays @@ -1305,7 +1398,7 @@ sub oeffnen { ### open a File ################## # This is a work-around for files without pressure altitude... # hell knows how that can happen, but I have seen such. - $dybaro = ($maxbaro - $minbaro); + my $dybaro = ($maxbaro - $minbaro); if($dybaro == 0){ #some sick files only have GPS altitude... Errorbox("Work-around enabled! NO PRESSURE ALTITUDE FOUND IN FILE! USING GPS ALTITUDE"); @@ -1330,12 +1423,12 @@ sub oeffnen { ### open a File # $_ is a task-definition ! - $TASK_ID=substr($_,18,4); + my $TASK_ID=substr($_,18,4); my $zwisch_date=GPLIGCfunctions::time2human(substr($_,0,6),'d'); my $zwisch_zeit=GPLIGCfunctions::time2human(substr($_,6,6),'t'); - $TASK_TIME=$zwisch_date." ".$zwisch_zeit; - $TASK_DATE=GPLIGCfunctions::time2human(substr($_,12,6),'d'); - $TASK_WPs=substr($_,22,2); + my $TASK_TIME=$zwisch_date." ".$zwisch_zeit; + my $TASK_DATE=GPLIGCfunctions::time2human(substr($_,12,6),'d'); + my $TASK_WPs=substr($_,22,2); #$MAXWP=$MAXWP+($TASK_WPs+4); # + start, abflug, finish, landing @@ -1393,7 +1486,7 @@ sub oeffnen { ### open a File } # convert all wp's to decimal format! - for ($i=1; $i<=$#WPIGCLAT; $i++){ + for (my $i=1; $i<=$#WPIGCLAT; $i++){ $WPLAT[$i]=GPLIGCfunctions::igc2dec($WPIGCLAT[$i]); $WPLON[$i]=GPLIGCfunctions::igc2dec($WPIGCLON[$i]); } @@ -1478,7 +1571,7 @@ sub Ausgabe { ### Ausgabe der Plots mit Gnuplot my $mode = shift; - $bereich='['.$xmin.':'.$xmax.']['.$ymin.':'.$ymax.']['.$zmin.':'.$zmax.']'; + my $bereich='['.$xmin.':'.$xmax.']['.$ymin.':'.$ymax.']['.$zmin.':'.$zmax.']'; # Linux/Unix Gnupot 3.x if ( $^O ne "MSWin32" && $config{'gnuplot_major_version'} != 4 ) { @@ -1576,7 +1669,7 @@ sub Ausgabe { ### Ausgabe der Plots mit Gnuplot # give out an error message sub Errorbox { my $fm=$_[0]; - my $Errorbox=$FlightView->messageBox(-message=>$fm, -type=>OK, -icon=>'error'); + my $Errorbox=$FlightView->messageBox(-message=>$fm, -type=>'OK', -icon=>'error'); return ; } @@ -1688,6 +1781,8 @@ sub directory { ############################################################################### +my ($FF, $FI, $MF, $thermal_statistik, $glide_statistik); + ###schliessen # used if new file is opened sub schliessen { @@ -1757,6 +1852,10 @@ sub FVWsetInfo { $canvas->update(); } +# Global stat, bleh. +my $infoFenster; +my $helpFenster; + ### subroutine info sub info { @@ -1858,6 +1957,11 @@ ENDE ############################################################################### +my @PHOTO_FILES; +my @PHOTO_FILES_INDICES; +my @PHOTO_FILES_TIMES; +my $oGLePID; + sub OpenGLexplorer { if ($filestat eq 'closed') {$FlightView->bell; return;} @@ -1877,14 +1981,14 @@ sub OpenGLexplorer { $DEBUGOGIE = "--debug" if ($config{'DEBUG'}); my $lifts=""; - $liftfile = substr($file, 0, -3)."lif"; + my $liftfile = substr($file, 0, -3)."lif"; if (-r $liftfile) {$lifts= "--lifts \"$liftfile\"";} # so far lifts or photos else { if ($config{'photos'} && !$hide_mm && $#PHOTO_FILES > 0) { - $pfile = substr($file, 0, -3)."photocoord"; + my $pfile = substr($file, 0, -3)."photocoord"; open (PF, ">$pfile"); for (my $z=0; $z<=$#PHOTO_FILES;$z++) { @@ -1989,6 +2093,8 @@ sub FlightInfo { ############################################################################### ### Flight Statistics +my $fstattext; + sub FlightStatistics { if (Exists($FF)) {$FF->destroy;} @@ -2012,7 +2118,6 @@ sub FlightStatistics { } ################################################################################ - sub FSupdate { if (!Exists($FF)) {return;} @@ -2074,13 +2179,14 @@ sub FSupdate { my $taskstt=GPLIGCfunctions::time2human($TIME[$task_start_time_index],'t'); my $taskft=GPLIGCfunctions::time2human($TIME[$task_finish_time_index],'t'); + my $task_speed; $fstattext.="Begin of task/unpowered flight (s-marker): $taskstt \nEnd of task/unpowered flight (f-marker): $taskft\n"; - $task_time=GPLIGCfunctions::dec2time($DECTIME[$task_finish_time_index]-$DECTIME[$task_start_time_index]); + my $task_time=GPLIGCfunctions::dec2time($DECTIME[$task_finish_time_index]-$DECTIME[$task_start_time_index]); $fstattext.="Task time (unpowered flight time): $task_time\n"; - $dec_task_time=$DECTIME[$task_finish_time_index]-$DECTIME[$task_start_time_index]; + my $dec_task_time=$DECTIME[$task_finish_time_index]-$DECTIME[$task_start_time_index]; if ($dec_task_time != 0) { $task_speed= $entf / $dec_task_time ;} else { $task_speed = "42";} #this is an egg :) @@ -2259,8 +2365,8 @@ sub zylinder { open (ZYLOUT,">${pfadftmp}zyl.dat"); - for ($i=0; $i<=$#dlat; $i++) { - for ($j=0; $j<=$h; $j=$j+100) { ###make it a zylinder! + for (my $i=0; $i<=$#dlat; $i++) { + for (my $j=0; $j<=$h; $j=$j+100) { ###make it a zylinder! print ZYLOUT $lon+$dlon[$i]," ",$lat+$dlat[$i]," $j \n"; } } @@ -2273,6 +2379,15 @@ sub zylinder { ############################################################################################################################################## ############################################################################################################################################## ################################# FLIGHTVIEW ################################################################################################# +my $lastphoto_idx; +my $mmlist; +my $savename; +my $trackheight; +my $fvwtext; +my $baroheight; +my $canvas_frame; +my @debugboxlist; + sub FlightView { if ($config{'fvw_baro_fraction'} < 1.1 || $config{'fvw_baro_fraction'} > 10) { @@ -2338,7 +2453,7 @@ sub FlightView { $menu_options->separator(); - $mapmenu = $menu_options->cget(-menu)->Menu(); + my $mapmenu = $menu_options->cget(-menu)->Menu(); $menu_options->cascade(-label=>"Map settings", -menu=> $mapmenu); $mapmenu->checkbutton(-label =>"Use maps", -variable=>\$config{'maps'},-command=>sub{if (Exists($FlightView)) {updateFVW('i');} }); @@ -2352,7 +2467,7 @@ sub FlightView { #$menu_options->seperator(); - $gpmenu = $menu_options->cget(-menu)->Menu(); + my $gpmenu = $menu_options->cget(-menu)->Menu(); $menu_options->cascade(-label=>"Gnuplot settings", -menu=> $gpmenu); if ($^O ne "MSWin32") { @@ -2368,14 +2483,14 @@ sub FlightView { $gpmenu->separator; - $drawmenu = $gpmenu->Menu(); + my $drawmenu = $gpmenu->Menu(); $gpmenu->cascade(-label=>"Draw options", -menu=> $drawmenu); $drawmenu->radiobutton(-label => "Lines",-variable => \$config{'gnuplot_draw_style'},-value => "with lines"); $drawmenu->radiobutton(-label => "Dots",-variable => \$config{'gnuplot_draw_style'},-value => "with dots"); $drawmenu->radiobutton(-label => "Linespoints",-variable => \$config{'gnuplot_draw_style'},-value => "with linespoints"); - $termmenu = $gpmenu->Menu(); + my $termmenu = $gpmenu->Menu(); $gpmenu->cascade(-label=>"Gnuplot terminal", -menu=> $termmenu); $termmenu->radiobutton(-label => "x11",-variable => \$config{'gnuplot_terminal'},-value => "x11"); @@ -2390,12 +2505,12 @@ sub FlightView { $termmenu->radiobutton(-label => "fig monochrome",-variable => \$config{'gnuplot_terminal'},-value => "fig monochrome"); $termmenu->radiobutton(-label => "fig color",-variable => \$config{'gnuplot_terminal'},-value => "fig color"); - $optmenu = $menu_options->cget(-menu)->Menu(); + my $optmenu = $menu_options->cget(-menu)->Menu(); $menu_options->cascade(-label=>"Optimizer method", -menu=> $optmenu); $optmenu->radiobutton(-label => "Metropolis Montecarlo",-variable => \$config{'optimizer_method'},-value => "mmc"); $optmenu->radiobutton(-label => "Simulated Annealing",-variable => \$config{'optimizer_method'},-value => "sa"); - $zylmenu = $menu_options->cget(-menu)->Menu(); + my $zylmenu = $menu_options->cget(-menu)->Menu(); $menu_options->cascade(-label=>"WP Cylinder/Sector", -menu=> $zylmenu); $zylmenu->radiobutton(-label => "FAI Sectors", -variable=>\$config{'zylinder_wp_type'}, -value=>"sec",-command=>\&updateCyl); @@ -2409,7 +2524,7 @@ sub FlightView { $zylmenu->radiobutton(-label => "1km - DMSt start/finish", -variable=>\$config{'zylinder_radius'},-value=>1.0,-command=>\&updateCyl); $zylmenu->checkbutton(-label => "Show names", -variable=>\$config{'zylinder_names'}, -command=>sub{updateCyl(); baroplot();});#_task();}); - $zoommenu = $menu_options->cget(-menu)->Menu(); + my $zoommenu = $menu_options->cget(-menu)->Menu(); $menu_options->cascade(-label=>"WP-Plot/Zoom sidelength", -menu=> $zoommenu); #$menu_options->separator(); @@ -2419,7 +2534,7 @@ sub FlightView { $zoommenu->radiobutton(-label=>"5km",-variable=>\$config{'zoom_sidelength'},-value=>"5",-command=>\&updateZoom); $zoommenu->radiobutton(-label=>"10km",-variable=>\$config{'zoom_sidelength'},-value=>"10",-command=>\&updateZoom); - $noiselevelmenu = $menu_options->cget(-menu)->Menu(); + my $noiselevelmenu = $menu_options->cget(-menu)->Menu(); $menu_options->cascade(-label=>"Noise Level Limit", -menu=> $noiselevelmenu); $noiselevelmenu->radiobutton(-label=>"50", -variable=>\$config{'ENL_noise_limit'},-value=>"50",-command=>\&updateFVW); @@ -2428,9 +2543,9 @@ sub FlightView { $noiselevelmenu->radiobutton(-label=>"500",-variable=>\$config{'ENL_noise_limit'},-value=>"500",-command=>\&updateFVW); $noiselevelmenu->radiobutton(-label=>"750",-variable=>\$config{'ENL_noise_limit'},-value=>"750",-command=>\&updateFVW); - $datfile="3d.dat"; ###default + my $datfile="3d.dat"; ###default - $coormenu = $menu_options->cget(-menu)->Menu(); + my $coormenu = $menu_options->cget(-menu)->Menu(); $menu_options->cascade(-label=>"Coordinate format", -menu=> $coormenu); #$menu_options->separator(); @@ -2440,7 +2555,7 @@ sub FlightView { $coormenu->radiobutton(-label=>"dd.ddddd", -variable=>\$config{'coordinate_print_format'},-value=>"deg",-command=>\&updateCoor); # SPEED UNITS - $speed_menu = $menu_options->cget(-menu)->Menu(); + my $speed_menu = $menu_options->cget(-menu)->Menu(); $menu_options->cascade(-label=>"Speed units", -menu=> $speed_menu); $speed_menu->radiobutton(-label=>"km/h", -variable=>\$config{'speed_unit_name'},-value=>"km/h",-command=>sub{ $config{'speed_unit_factor'}=1.0; @@ -2465,7 +2580,7 @@ sub FlightView { }); # VERTICAL SPEED UNITS - $vspeed_menu = $menu_options->cget(-menu)->Menu(); + my $vspeed_menu = $menu_options->cget(-menu)->Menu(); $menu_options->cascade(-label=>"Vertical speed units", -menu=> $vspeed_menu); $vspeed_menu->radiobutton(-label=>"m/s", -variable=>\$config{'vertical_speed_unit_name'},-value=>"m/s",-command=>sub{ $config{'vertical_speed_unit_factor'}=1.0; @@ -2485,7 +2600,7 @@ sub FlightView { }); # ALTITUDE UNITS - $alt_menu = $menu_options->cget(-menu)->Menu(); + my $alt_menu = $menu_options->cget(-menu)->Menu(); $menu_options->cascade(-label=>"Altitude units", -menu=> $alt_menu); $alt_menu->radiobutton(-label=>"m", -variable=>\$config{'altitude_unit_name'},-value=>"m",-command=>sub{ $config{'altitude_unit_factor'}=1.0; @@ -2499,7 +2614,7 @@ sub FlightView { }); # DISTANCE UNITS - $dist_menu = $menu_options->cget(-menu)->Menu(); + my $dist_menu = $menu_options->cget(-menu)->Menu(); $menu_options->cascade(-label=>"Distance units", -menu=> $dist_menu); $dist_menu->radiobutton(-label=>"km", -variable=>\$config{'distance_unit_name'},-value=>"km",-command=>sub{ $config{'distance_unit_factor'}=1.0; @@ -2507,8 +2622,7 @@ sub FlightView { FSupdate(); }); $dist_menu->radiobutton(-label=>"Miles", -variable=>\$config{'distance_unit_name'},-value=>"miles",-command=>sub{ - $config{'distance_unit_factor'}=0.621504; - FVWausg(); + $config{'distance_unit_factor'}=0.621504; FVWausg(); FSupdate(); }); $dist_menu->radiobutton(-label=>"Nautical Miles", -variable=>\$config{'distance_unit_name'},-value=>"NM",-command=>sub{ @@ -2701,9 +2815,11 @@ sub FlightView { baroplot(); #$fvwtextobj=$canvas->createText(0,0,text=>" "); - $horizontal=$canvas->createLine(0,0,0,0); - $vertical=$canvas->createLine(0,0,0,0); - $barovertical = $barocanvas->createLine(0,0,0,0); + my $horizontal=$canvas->createLine(0,0,0,0); + my $vertical=$canvas->createLine(0,0,0,0); + my $barovertical = $barocanvas->createLine(0,0,0,0); + my $stat_start; + my $stat_end; FVWausg(); marksdraw(); @@ -2756,6 +2872,7 @@ sub FlightView { if ($cut_track == 0) {$cut_track=1;trackplot($dxp, $dyp, $minlat, $minlon);baroplot();FVWausg();return;} if ($cut_track == 1) {$cut_track=0;trackplot($dxp, $dyp, $minlat, $minlon);baroplot();FVWausg();} }); + my $olcFirstWPindex; $FlightView->bind("", sub { if ($filestat eq 'closed') { return; } @@ -2807,7 +2924,7 @@ sub FlightView { $mmlist->configure(-title=>"Media List"); setexit($mmlist); - $mm_list_box = $mmlist->ScrlListbox(-label=>"Media List", -selectmode=>"single",-height=>"0",-width=>"0")->pack(-side=>"left"); + my $mm_list_box = $mmlist->ScrlListbox(-label=>"Media List", -selectmode=>"single",-height=>"0",-width=>"0")->pack(-side=>"left"); $mm_list_box->bind("" => \&mm_click); for (my $z=0; $z<=$#PHOTO_FILES;$z++) { @@ -3091,6 +3208,9 @@ sub FlightView { $FlightView->bind("", sub{$FlightView->destroy; gpligcexit();} ); } +my @textplot; +my ($maxlat, $maxlon); + sub mapplot { if ($filestat eq 'closed') { return; } @@ -3143,8 +3263,8 @@ sub mapplot { my ($dxp, $dyp, $minlat, $minlon, $calledfrom) =@_; # calc maxima - my $maxlat = $minlat + $dyp * ($trackheight-1); - my $maxlon = $minlon + $dxp * ($config{'window_width'}-1); + $maxlat = $minlat + $dyp * ($trackheight-1); + $maxlon = $minlon + $dxp * ($config{'window_width'}-1); # jump address for reload at changed zl (if zl has to be changed because of limits) mapreload: @@ -3230,11 +3350,11 @@ sub mapplot { # seems not to work, yet? $dladdr = "http://t1.openseamap.org/seamark/$zl/$xt/$yt.png" if ($config{'map_type'} eq "oseam"); - $rand = int(rand(4)); + my $rand = int(rand(4)); $dladdr = "http://mt$rand.google.com/vt/lyrs=t,r&hl=en&x=$xt&y=$yt&z=$zl" if ($config{'map_type'} eq "gmt"); $dladdr = "http://mt$rand.google.com/vt/lyrs=m&hl=en&x=$xt&y=$yt&z=$zl" if ($config{'map_type'} eq "gmm" ); - $retry_gms_counter=-1; + my $retry_gms_counter=-1; retry_gms: $retry_gms_counter++; @@ -3251,7 +3371,7 @@ sub mapplot { $dladdr = "http://mt$rand.google.com/vt/lyrs=h&hl=en&x=$xt&y=$yt&z=$zl" if ($addlayer == 1); if (!-d "$osmpath/$zl/$xt") {File::Path::mkpath "$osmpath/$zl/$xt";} - $resp = LWP::Simple::getstore($dladdr, "$osmpath/$zl/$xt/$yt.png"); + my $resp = LWP::Simple::getstore($dladdr, "$osmpath/$zl/$xt/$yt.png"); print "$resp DOWNLOAD: \"$dladdr\" ==> $osmpath/$zl/$xt/$yt.png\n" if ($config{'DEBUG'}); if ($resp != 200) {print "$resp error: $dladdr\n" if ($config{'DEBUG'}); } @@ -3551,12 +3671,12 @@ sub wpcyldraw { GPLIGCfunctions::kurs( $WPLAT[$zaehl], $WPLON[$zaehl], $WPLAT[$zaehl+1], $WPLON[$zaehl+1]), GPLIGCfunctions::kurs( $WPLAT[$zaehl], $WPLON[$zaehl], $WPLAT[$zaehl-1], $WPLON[$zaehl-1])); } - $sec2up = $secdir +90; if ($sec2up < 0) { $sec2up = $sec2up + 360 ;} if ($sec2up > 360) { $sec2up = $sec2up - 360 ;} - $sec2down = $secdir -90; if ($sec2down < 0) { $sec2down = $sec2down + 360 ;} if ($sec2down > 360) { $sec2down = $sec2down - 360 ;} - $sec1up = $secdir +45; if ($sec1up < 0) { $sec1up = $sec1up + 360 ;} if ($sec1up > 360) { $sec1up = $sec1up - 360 ;} - $sec1down = $secdir -45; if ($sec1down < 0) { $sec1down = $sec1down + 360 ;} if ($sec1down > 360) { $sec1down = $sec1down - 360 ;} + my $sec2up = $secdir +90; if ($sec2up < 0) { $sec2up = $sec2up + 360 ;} if ($sec2up > 360) { $sec2up = $sec2up - 360 ;} + my $sec2down = $secdir -90; if ($sec2down < 0) { $sec2down = $sec2down + 360 ;} if ($sec2down > 360) { $sec2down = $sec2down - 360 ;} + my $sec1up = $secdir +45; if ($sec1up < 0) { $sec1up = $sec1up + 360 ;} if ($sec1up > 360) { $sec1up = $sec1up - 360 ;} + my $sec1down = $secdir -45; if ($sec1down < 0) { $sec1down = $sec1down + 360 ;} if ($sec1down > 360) { $sec1down = $sec1down - 360 ;} - ($cylref_lat, $cylref_lon) = GPLIGCfunctions::zylinder2($WPLAT[$zaehl], $WPLON[$zaehl], '3.0' , $sec2down, 180); # FAI = 3.0 km sector + my ($cylref_lat, $cylref_lon) = GPLIGCfunctions::zylinder2($WPLAT[$zaehl], $WPLON[$zaehl], '3.0' , $sec2down, 180); # FAI = 3.0 km sector for (my $xzaehl=0; $xzaehl<=$#$cylref_lat-1; $xzaehl++) { @@ -3635,6 +3755,7 @@ sub taskdraw { } } +my ($dxbaro, $dybaro, $minbaro, $maxbaro); sub baroplot { if ($filestat eq 'closed') { @@ -3878,6 +3999,8 @@ sub baroclick { $barocanvas->CanvasBind('<1>' => \&baroclick); } +my ($delta_lat, $delta_lon); + sub zoom { print "zoom()\n" if ($config{'DEBUG'}); if ($zoom == 1 || $zoom == 2) { @@ -3972,6 +4095,7 @@ sub unzoomed { } # end unzoomed +my $kl2; sub zoom2 { print "zoom2()\n" if ($config{'DEBUG'}); @@ -4419,6 +4543,8 @@ sub FVWausg { } ############################################################################# +my ($wppwlat, $wppwlon); +my ($myWPN, $myWPRF); sub WpPlot { @@ -6145,7 +6271,6 @@ sub geotag_photos { } ############################################################################### - sub phototimecalibration { if (!defined $lastphoto_idx) { @@ -6560,4 +6685,3 @@ sub olctaskinfo { return ($message_out, $stime, $ltime, $fstart, $ffinish, $deltaheight, $starttime, $finishtime); } -