3 #=======================================================================
5 # File ID: 58ece940-08f3-11de-ab14-000475e441b9
6 # View GPX files in gnuplot(1)
9 # ©opyleft 2009– Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later, see end of
11 # file for legal stuff.
12 #=======================================================================
36 $progname =~ s/^.*\/(.*?)$/$1/;
39 my $id_date = $rcs_id;
40 $id_date =~ s/^.*?\d+ (\d\d\d\d-.*?\d\d:\d\d:\d\d\S+).*/$1/;
42 push(@main::version_array
, $rcs_id);
45 Getopt
::Long
::Configure
("bundling");
48 "debug" => \
$Opt{'debug'},
49 "help|h" => \
$Opt{'help'},
50 "time|t" => \
$Opt{'time'},
51 "verbose|v+" => \
$Opt{'verbose'},
52 "version" => \
$Opt{'version'},
54 ) || die("$progname: Option error. Use -h for help.\n");
56 $Opt{'debug'} && ($Debug = 1);
57 $Opt{'help'} && usage
(0);
58 if ($Opt{'version'}) {
63 my $cmdl_str = join(" ", @cmdl);
66 my $dat_file = "/tmp/vg-t.tmp";
67 open(FP
, ">$dat_file") || die("$progname: $dat_file: Cannot open file for write: $!\n");
68 my @gpst_array = ("gpst", "-o", "csv", "-rt", "-e", "-d", "-t", @ARGV, "|", "rmspcall", "|", "uniq");
69 print(FP
`@gpst_array`);
71 my $cmd_file = "/tmp/vg-t-cmd.tmp";
72 open(FP
, ">$cmd_file") || die("$progname: $cmd_file: Cannot open file for write: $!\n");
75 # load "/tmp/label.gnuplot"
77 # set timefmt "%Y-%m-%dT%H:%M:%SZ"
79 splot "$dat_file" using 2:3:1 w l palette
80 pause -1 "Trykk Enter..."
83 system("gnuplot -persist $cmd_file");
85 my $dat_file = "/tmp/vg.tmp";
86 open(FP
, ">$dat_file") || die("$progname: $dat_file: Cannot open file for write: $!\n");
87 my @gpst_array = ("gpst", "-o", "clean", "-ret", "-d", "-t", @ARGV, "|", "rmspcall", "|", "uniq");
88 print(FP
`@gpst_array`);
90 my $cmd_file = "/tmp/vg-cmd.tmp";
91 open(FP
, ">$cmd_file") || die("$progname: $cmd_file: Cannot open file for write: $!\n");
94 # load "/tmp/label.gnuplot"
95 splot "$dat_file" w l palette
96 pause -1 "Trykk Enter..."
99 system("gnuplot -persist $cmd_file");
103 # Print program version {{{
104 for (@main::version_array
) {
111 # Send the help message to stdout {{{
114 if ($Opt{'verbose'}) {
120 Usage: $progname [options] [file [files [...]]]
127 Use time as Z axis instead of elevation.
129 Increase level of verbosity. Can be repeated.
131 Print version information.
133 Print debugging messages.
141 # Print a status message to stderr based on verbosity level {{{
142 my ($verbose_level, $Txt) = @_;
144 if ($Opt{'verbose'} >= $verbose_level) {
145 print(STDERR
"$progname: $Txt\n");
151 # Print a debugging message {{{
153 my @call_info = caller;
154 chomp(my $Txt = shift);
155 my $File = $call_info[1];
157 $File =~ s
#^.*/(.*?)$#$1#;
158 print(STDERR
"$File:$call_info[2] $$ $Txt\n");
165 # Plain Old Documentation (POD) {{{
179 [options] [file [files [...]]]
189 =item B<-h>, B<--help>
191 Print a brief help summary.
193 =item B<-v>, B<--verbose>
195 Increase level of verbosity. Can be repeated.
199 Print version information.
203 Print debugging messages.
213 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
217 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
218 This is free software; see the file F<COPYING> for legalese stuff.
222 This program is free software; you can redistribute it and/or modify it
223 under the terms of the GNU General Public License as published by the
224 Free Software Foundation; either version 2 of the License, or (at your
225 option) any later version.
227 This program is distributed in the hope that it will be useful, but
228 WITHOUT ANY WARRANTY; without even the implied warranty of
229 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
230 See the GNU General Public License for more details.
232 You should have received a copy of the GNU General Public License along
233 with this program; if not, write to the Free Software Foundation, Inc.,
234 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
242 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :