#!/usr/bin/perl
use strict;
use warnings;
use Panotools::Script;
use Getopt::Long;
use Pod::Usage;
my $help = 0;
my $p;
my $m;
my $i;
my $v;
my $o;
GetOptions ('p|panorama=s' => \$p,
'm|mode=s' => \$m,
'i|image=s' => \$i,
'v|variable=s' => \$v,
'o|option=s' => \$o,
'h|help' => \$help);
pod2usage (-verbose => 2) if $help;
my $path_pto = shift || pod2usage;
die "Can't find $path_pto" unless -e $path_pto;
my $pto = new Panotools::Script;
$pto->Read ($path_pto);
print $pto->Panorama->{$p} . "\n"
if (defined $p and defined $pto->Panorama->{$p});
print $pto->Mode->{$m} . "\n"
if (defined $m and defined $pto->Mode->{$m});
if (defined $i and $i =~ /([0-9]+)[:,]([a-zA-Z]+)/)
{
print $pto->Image->[$1]->{$2} . "\n"
if (defined $pto->Image->[$1]->{$2});
}
if (defined $v and $v =~ /([0-9]+)[:,]([a-zA-Z]+)/)
{
print $pto->Variable->{$1}->{$2} . "\n"
if (defined $pto->Variable->{$1}->{$2});
}
print $pto->Option->{$o} . "\n"
if (defined $o and defined $pto->Option->{$o});
__END__
=head1 NAME
ptoget - query a pto project
=head1 SYNOPSIS
ptoget [options] project.pto
Options:
-p | --panorama query 'p' panorama lines
-m | --mode query 'm' mode lines
-i | --image query 'i' image lines
-v | --variable query 'v' optimisation variable lines
-o | --option query '#hugin_' option lines
-h | --help Outputs help documentation
=head1 DESCRIPTION
B<ptoget> queries global parameters from a hugin .pto project. Only one
parameter can be queried at once.
=head1 LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
=head1 SEE ALSO
L<http://hugin.sourceforge.net/>
L<ptoset>
=head1 AUTHOR
Bruno Postle - November 2008.
=cut