From 338938f205b12e981cdaadf4feb30c6fe184c7d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20A=2E=20Holm?= Date: Fri, 21 May 2010 23:25:37 +0200 Subject: [PATCH] gpst: Moving lots of code out of print_entry() into the new gen_entry() It receives lots of arguments, will fix that later. 93a7927c-651f-11df-9bad-90e6ba3022ac 20cdac12-66f7-11df-b2d9-90e6ba3022ac 030e4de2-66f9-11df-99e3-90e6ba3022ac --- gpst | 185 +++++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 97 insertions(+), 88 deletions(-) diff --git a/gpst b/gpst index ef4bb0c..a5499ba 100755 --- a/gpst +++ b/gpst @@ -934,94 +934,7 @@ sub print_entry { unless ($first_time) { $first_time = $ep_time; } - if ($Opt{'double-y-scale'} && length($Dat{'lat'})) { - $Dat{'lat'} *= 2; - } - if ($Opt{'output-format'} eq "gpsml") { - if ($Dat{'what'} eq "tp") { - $Dat{'format'} = "gpsml"; - $Line .= trackpoint(%Dat); - } elsif ($Dat{'what'} =~ /^(pause|desc|title)$/) { - $Line .= sprintf("<%s>%s\n", - $1, - $Dat{$1}, - $1); - } - } elsif ($Opt{'output-format'} eq "pgtab") { - if ($Dat{'what'} eq "tp" && !length($Dat{'error'})) { - $Dat{'format'} = "pgtab"; - $Line .= trackpoint(%Dat); - } - } elsif ($Opt{'output-format'} eq "xgraph") { - if ($print_pos && !length($Dat{'error'})) { - $Dat{'format'} = "xgraph"; - $Line .= trackpoint(%Dat); - } - } elsif($Opt{'output-format'} eq "gpstrans") { - if ($print_pos && !length($Dat{'error'})) { - $Dat{'format'} = "gpstrans"; - $Line .= trackpoint(%Dat); - } - } elsif($Opt{'output-format'} eq "gpx") { - if ($Dat{'what'} eq "tp") { - $Dat{'format'} = "gpx"; - $Line .= trackpoint(%Dat); - } - } elsif ($Opt{'output-format'} eq "clean") { - if ($Dat{'what'} eq "tp" && !length($Dat{'error'})) { - $Dat{'format'} = "clean"; - $Line .= trackpoint(%Dat); - } - } elsif ($Opt{'output-format'} eq "ps") { - $Line .= ( - $pause_len - ? "f\n$Dat{'lon'} $Dat{'lat'} m\n" - : "$Dat{'lon'} $Dat{'lat'} l\n" - ); - } elsif ($Opt{'output-format'} eq "svg") { - $Line .= ( - ($last_lon == 1000) || $pause_len - ? join("", - "$svg_start_thing%s\n", + $1, + $Dat{$1}, + $1); + } + } elsif ($Opt{'output-format'} eq "pgtab") { + if ($Dat{'what'} eq "tp" && !length($Dat{'error'})) { + $Dat{'format'} = "pgtab"; + $Line .= trackpoint(%Dat); + } + } elsif ($Opt{'output-format'} eq "xgraph") { + if ($print_pos && !length($Dat{'error'})) { + $Dat{'format'} = "xgraph"; + $Line .= trackpoint(%Dat); + } + } elsif($Opt{'output-format'} eq "gpstrans") { + if ($print_pos && !length($Dat{'error'})) { + $Dat{'format'} = "gpstrans"; + $Line .= trackpoint(%Dat); + } + } elsif($Opt{'output-format'} eq "gpx") { + if ($Dat{'what'} eq "tp") { + $Dat{'format'} = "gpx"; + $Line .= trackpoint(%Dat); + } + } elsif ($Opt{'output-format'} eq "clean") { + if ($Dat{'what'} eq "tp" && !length($Dat{'error'})) { + $Dat{'format'} = "clean"; + $Line .= trackpoint(%Dat); + } + } elsif ($Opt{'output-format'} eq "ps") { + $Line .= ( + $pause_len + ? "f\n$Dat{'lon'} $Dat{'lat'} m\n" + : "$Dat{'lon'} $Dat{'lat'} l\n" + ); + } elsif ($Opt{'output-format'} eq "svg") { + $Line .= ( + ($last_lon == 1000) || $pause_len + ? join("", + "$svg_start_thing