| 1 | package Panotools::Script::Line::Option; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | Panotools::Script::Line::Option - Hugin Options | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | Option parameters are described by a line beginning with '#hugin_' | ||
| 13 | |||
| 14 | =head1 DESCRIPTION | ||
| 15 | |||
| 16 | =cut | ||
| 17 | |||
| 18 | sub new | ||
| 19 | { | ||
| 20 | my $class = shift; | ||
| 21 | $class = ref $class || $class; | ||
| 22 | my $self = bless {}, $class; | ||
| 23 | $self->_defaults; | ||
| 24 | return $self; | ||
| 25 | } | ||
| 26 | |||
| 27 | sub _defaults | ||
| 28 | { | ||
| 29 | my $self = shift; | ||
| 30 | %{$self} = | ||
| 31 | (optimizeReferenceImage => 0, | ||
| 32 | blender => 'enblend', | ||
| 33 | remapper => 'nona', | ||
| 34 | enblendOptions => '', | ||
| 35 | enfuseOptions => '', | ||
| 36 | hdrmergeOptions => '', | ||
| 37 | outputLDRBlended => 'true', | ||
| 38 | outputLDRLayers => 'false', | ||
| 39 | outputLDRExposureRemapped => 'false', | ||
| 40 | outputLDRExposureLayers => 'false', | ||
| 41 | outputLDRExposureBlended => 'false', | ||
| 42 | outputHDRBlended => 'false', | ||
| 43 | outputHDRLayers => 'false', | ||
| 44 | outputHDRStacks => 'false', | ||
| 45 | outputLayersCompression => 'PACKBITS', | ||
| 46 | outputImageType => 'tif', | ||
| 47 | outputImageTypeCompression => 'NONE', | ||
| 48 | outputJPEGQuality => 100, | ||
| 49 | outputImageTypeHDR => 'exr', | ||
| 50 | outputImageTypeHDRCompression => ''); | ||
| 51 | } | ||
| 52 | |||
| 53 | sub Identifier | ||
| 54 | { | ||
| 55 | my $self = shift; | ||
| 56 | return "#hugin_"; | ||
| 57 | } | ||
| 58 | |||
| 59 | sub Parse | ||
| 60 | { | ||
| 61 | my $self = shift; | ||
| 62 | my $string = shift || return 0; | ||
| 63 | my ($key, $value) = $string =~ /^#hugin_([[:alnum:]]+) *(.*)/g; | ||
| 64 | $self->{$key} = $value; | ||
| 65 | return 1; | ||
| 66 | } | ||
| 67 | |||
| 68 | sub Assemble | ||
| 69 | { | ||
| 70 | my $self = shift; | ||
| 71 | my @items; | ||
| 72 | for my $entry (sort keys %{$self}) | ||
| 73 | { | ||
| 74 | push @items, $self->Identifier . $entry .' '. $self->{$entry}; | ||
| 75 | } | ||
| 76 | return (join "\n", @items) ."\n" if (@items); | ||
| 77 | return ''; | ||
| 78 | } | ||
| 79 | |||
| 80 | sub Report | ||
| 81 | { | ||
| 82 | my $self = shift; | ||
| 83 | my @report; | ||
| 84 | for my $entry (sort keys %{$self}) | ||
| 85 | { | ||
| 86 | push @report, [$entry, $self->{$entry}] | ||
| 87 | unless ($self->{$entry} =~ /^(false)? *$/i); | ||
| 88 | } | ||
| 89 | [@report]; | ||
| 90 | } | ||
| 91 | |||
| 92 | |||
| 93 | 1; |