$ svn cp $SR/utils/trunk/src/gpstools $SR/utils/branches/gpst.postgis
[gpstools.git] / branches / gpst.postgis / Patch / xgraph-fix_plus_more.patch
blob71db8fa313c6a1b99b8bfeca6a4b4e97bfe203c4
1 Index: tests/run-tests.pl
2 ===================================================================
3 --- tests/run-tests.pl (revision 1817)
4 +++ tests/run-tests.pl (working copy)
5 @@ -56,6 +56,29 @@
6 $Opt{'help'} && usage(0);
7 $Opt{'version'} && print_version();
9 +testcmd("../gpst -o xgraph multitrack.gpx", # {{{
10 + <<END,
11 +-0.1448208 51.4968987
12 +-0.1448824 51.4968266
13 +-0.1449938 51.4968227
14 +-0.1453202 51.4969040
15 +move -0.1453398 51.4969214
16 +-0.1455514 51.4969816
17 +-0.1457489 51.4970224
18 +-0.1457804 51.4970452
19 +move -0.1458608 51.4970680
20 +-0.1460047 51.4971658
21 +-0.1461614 51.4972469
22 +move -0.1462394 51.4972731
23 +-0.1463232 51.4973437
24 +-0.1462949 51.4973337
25 +-0.1462825 51.4973218
26 +-0.1462732 51.4973145
27 +END
28 +);
30 +# }}}
32 diag("Testing XML routines...");
34 # txt_to_xml() and xml_to_txt() {{{
35 Index: gpst
36 ===================================================================
37 --- gpst (revision 1817)
38 +++ gpst (working copy)
39 @@ -517,24 +517,18 @@
40 print_entry(%Dat);
41 # }}}
42 } elsif (/^xmaplog /) {
43 - ($Opt{'output-format'} eq "csv")
44 - && ($Opt{'save-to-file'} eq "\n")
45 - && print("\n");
46 + $found_move = 1;
47 } elsif (/^$/) {
48 - ($Opt{'output-format'} eq "csv")
49 - && ($Opt{'save-to-file'} eq "\n")
50 - && print("\n");
51 + ($Opt{'output-format'} eq "csv") && ($found_move = 1);
52 } elsif (/^Pause: /) {
53 # NOP, is here to cope with old files I’ve lying around.
54 } elsif ($Dat{'error'} eq "desc") {
55 my $Comment = $_;
56 if (defined($Comment)) {
57 $Comment =~ s/^\s*(.*?)\s*$/$1/;
58 - if ($Opt{'output-format'} eq "gpsml") {
59 - $Dat{'desc'} = txt_to_xml($Comment);
60 - $Dat{'type'} = "desc";
61 - print_entry(%Dat);
62 - }
63 + $Dat{'desc'} = txt_to_xml($Comment);
64 + $Dat{'type'} = "desc";
65 + print_entry(%Dat);
67 } else {
68 $Opt{'verbose'} && warn("Line $.: Unknown: \"$_\"\n");
69 @@ -870,7 +864,7 @@
70 $Line .= sprintf("<pause>%s</pause>\n",
71 sec_to_readable($ep_time-$last_time));
72 } elsif ($Opt{'output-format'} eq "csv") {
73 - $Line .= sprintf("# Pause: %s\n# move\n",
74 + $Line .= sprintf("# Pause: %s\n",
75 sec_to_readable($ep_time-$last_time));
78 @@ -896,8 +890,10 @@
79 $1);
81 } elsif ($Opt{'output-format'} eq "xgraph") {
82 - $pause_len && ($Line .= "move ");
83 - ($Line .= "$Dat{'lon'} $Dat{'lat'}\n");
84 + if ($print_pos) {
85 + $pause_len && ($Line .= "move ");
86 + ($Line .= "$Dat{'lon'} $Dat{'lat'}\n");
87 + }
88 } elsif($Opt{'output-format'} eq "gpstrans") {
89 my ($gpt_lat, $gpt_lon) =
90 (ddd_to_dms($Dat{'lat'}), ddd_to_dms($Dat{'lon'}));
91 @@ -976,8 +972,8 @@
92 if ($Opt{'output-format'} eq "gpsml") {
93 $Line = "<break/>\n$Line";
95 - (!$pause_len && ($Opt{'output-format'} eq "xgraph"))
96 - && ($Line .= "move $Line");
97 + # (!$pause_len && ($Opt{'output-format'} eq "xgraph"))
98 + # && ($Line .= "move $Line");
99 ($Opt{'output-format'} eq "clean") && ($Line .= "\n");
100 if ($Opt{'output-format'} eq "gpx") {
101 $Line .= "$Spc$Spc$Spc$Spc</trkseg>\n" .