From: <bru...@us...> - 2010-01-22 23:59:35
|
Revision: 1240 http://panotools.svn.sourceforge.net/panotools/?rev=1240&view=rev Author: brunopostle Date: 2010-01-22 23:59:28 +0000 (Fri, 22 Jan 2010) Log Message: ----------- Allow creating tile output in sub-directories. clean target Modified Paths: -------------- trunk/Panotools-Script/bin/gigatile Modified: trunk/Panotools-Script/bin/gigatile =================================================================== --- trunk/Panotools-Script/bin/gigatile 2010-01-20 20:39:09 UTC (rev 1239) +++ trunk/Panotools-Script/bin/gigatile 2010-01-22 23:59:28 UTC (rev 1240) @@ -3,6 +3,7 @@ use warnings; use Getopt::Long; use Pod::Usage; +use File::Spec; use Panotools::Script; use Panotools::Makefile; @@ -25,6 +26,11 @@ my $pto = new Panotools::Script; $pto->Read ($path_input); +for my $image (@{$pto->Image}) +{ + $image->{n} = '"'. $image->Path ($path_input) .'"'; +} + my $pix_width = $pto->Panorama->{w}; my $pix_height = $pto->Panorama->{h}; @@ -36,6 +42,9 @@ $levels +=1; } +my ($v, $d, $f) = File::Spec->splitpath ($path_prefix); +mkdir File::Spec->catpath ($v, $d) if ($d); + my $mk = new Panotools::Makefile; my $rule_all = $mk->Rule ('all'); @@ -45,9 +54,10 @@ my $rule_tile_mk = $mk->Rule ('mks'); my $rule_tile_tiff = $mk->Rule ('tiffs'); my $rule_tile_jpeg = $mk->Rule ('jpegs'); +my $rule_clean = $mk->Rule ('clean'); my $rule_phony = $mk->Rule ('.PHONY'); -$rule_phony->Prerequisites ('all', 'ptos', 'mks', 'tiffs', 'jpegs'); +$rule_phony->Prerequisites ('all', 'ptos', 'mks', 'tiffs', 'jpegs', 'clean'); dotile ($path_prefix, 0, $pix_size, 0, $pix_size); @@ -59,10 +69,14 @@ # don't bother rendering tiles outside panorama area return if ($left > $pto->Panorama->{w} or $top > $pto->Panorama->{h}); + # don't bother rendering tiles outside Crop area + my @S = split (/,/, $pto->Panorama->{S}); + return if ($right < $S[0] or $left > $S[1] or $bottom < $S[2] or $top > $S[3]); if ($right - $left == $pix_tiff and $bottom - $top == $pix_tiff) { $pto_tmp->Panorama->{S} = "$left,$right,$top,$bottom"; + $pto_tmp->Option->{enblendOptions} = '--no-optimize'; $pto_tmp->Write ($prefix .'.pto'); $rule_tile_pto->Prerequisites ($prefix .'.pto'); @@ -76,11 +90,15 @@ $rule->Command ('$(MAKE)', '-f', $prefix .'.pto.mk', $prefix .'.tif'); $rule_tile_tiff->Prerequisites ($prefix .'.tif'); + $rule_clean->Command ('-', '$(MAKE)', '-f', $prefix .'.pto.mk', 'clean'); + $rule = $mk->Rule ($prefix); $rule->Prerequisites ($prefix .'.tif'); $rule->Command ('entile', $prefix .'.tif', $prefix, $pix_jpeg); $rule_phony->Prerequisites ($prefix); $rule_tile_jpeg->Prerequisites ($prefix); + + $rule_clean->Command ('-', 'rm', $prefix .'.tif'); } elsif (($right - $left) > $pix_tiff and ($bottom - $top) > $pix_tiff) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |