From: <da...@us...> - 2008-01-03 13:56:35
|
Revision: 2603 http://hugin.svn.sourceforge.net/hugin/?rev=2603&view=rev Author: dangelo Date: 2008-01-03 05:56:33 -0800 (Thu, 03 Jan 2008) Log Message: ----------- Fixed problems with filenames containing dots (bug #1848419) Modified Paths: -------------- hugin/trunk/src/hugin1/common/wxPlatform.h hugin/trunk/src/hugin1/hugin/PanoPanel.cpp hugin/trunk/src/hugin1/stitch_project/hugin_stitch_project.cpp hugin/trunk/src/hugin_base/nona/Stitcher.h hugin/trunk/src/hugin_base/panodata/PanoramaOptions.h Modified: hugin/trunk/src/hugin1/common/wxPlatform.h =================================================================== --- hugin/trunk/src/hugin1/common/wxPlatform.h 2008-01-03 13:53:33 UTC (rev 2602) +++ hugin/trunk/src/hugin1/common/wxPlatform.h 2008-01-03 13:56:33 UTC (rev 2603) @@ -100,7 +100,6 @@ return wxString(t.c_str(), *wxConvCurrent); } - } // namespace #endif // HUGIN_WXPLATFORM_H Modified: hugin/trunk/src/hugin1/hugin/PanoPanel.cpp =================================================================== --- hugin/trunk/src/hugin1/hugin/PanoPanel.cpp 2008-01-03 13:53:33 UTC (rev 2602) +++ hugin/trunk/src/hugin1/hugin/PanoPanel.cpp 2008-01-03 13:56:33 UTC (rev 2603) @@ -623,7 +623,15 @@ #else wxString hugin_stitch_project = wxT("hugin_stitch_project"); #endif - wxString command = hugin_stitch_project + wxT(" ") + wxQuoteFilename(ptofile); + wxFileName prefixFN(ptofile); + wxString outputPrefix; + if (prefixFN.GetExt() == wxT("pto")) { + outputPrefix = prefixFN.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, wxPATH_NATIVE) + prefixFN.GetName(); + } else { + outputPrefix = ptofile; + } + + wxString command = hugin_stitch_project + wxT(" -o ") + wxQuoteFilename(outputPrefix) + wxT(" ") + wxQuoteFilename(ptofile); wxProcess *my_process = new wxProcess(this); my_process->Redirect(); Modified: hugin/trunk/src/hugin1/stitch_project/hugin_stitch_project.cpp =================================================================== --- hugin/trunk/src/hugin1/stitch_project/hugin_stitch_project.cpp 2008-01-03 13:53:33 UTC (rev 2602) +++ hugin/trunk/src/hugin1/stitch_project/hugin_stitch_project.cpp 2008-01-03 13:56:33 UTC (rev 2603) @@ -278,7 +278,9 @@ wxString basename; wxString outpath; - wxFileName::SplitPath(outname, &outpath, &basename, NULL); + wxFileName outputPrefix(outname); + outpath = outputPrefix.GetPath(); + basename = outputPrefix.GetFullName(); cout << "output path: " << outpath.mb_str() << " file:" << basename.mb_str() << endl; long nThreads = wxThread::GetCPUCount(); @@ -293,6 +295,7 @@ // stitch only active images UIntSet activeImgs = pano.getActiveImages(); + bool keepWindow = true; if (imgsFromCmdline) { if (parser.GetParamCount() -1 != activeImgs.size()) { wxLogError(_("Wrong number of images specified on command line")); @@ -340,8 +343,7 @@ std::string ptoFn = (const char *) tmpPTOfn.mb_str(); - std::string resultFn(outname.mb_str()); - resultFn = utils::stripPath(utils::stripExtension(resultFn)); + std::string resultFn(basename.mb_str()); std::string tmpPTOfnC = (const char *) tmpPTOfn.mb_str(); @@ -366,8 +368,9 @@ #if 1 int ret = MyExecuteCommandOnDialog(wxT("make"), args, NULL, caption); if (ret != 0) { + keepWindow = true; wxMessageBox(wxString::Format(_("Error while stitching project\n%s"), scriptFile.c_str()), - wxT("Error during stitching"), wxICON_ERROR | wxOK ); + _("Error during stitching"), wxICON_ERROR | wxOK ); } #else // This crashes.. Don't know why.. @@ -375,8 +378,9 @@ int ret = execDlg.ShowModal(cmd); cout << " exit code: " << ret << std::endl; if (ret != 0) { + keepWindow = true; wxMessageBox(wxString::Format(_("Error while stitching project\n%s"), scriptFile.c_str()), - wxT("Error during stitching"), wxICON_ERROR | wxOK ); + _("Error during stitching"), wxICON_ERROR | wxOK ); } #endif @@ -387,10 +391,13 @@ #endif } catch (std::exception & e) { cerr << "caught exception: " << e.what() << std::endl; - return false; + wxMessageBox(wxString(e.what(), wxConvLocal), + _("Error during stitching"), wxICON_ERROR | wxOK ); + + return true; } - return false; + return keepWindow; } Modified: hugin/trunk/src/hugin_base/nona/Stitcher.h =================================================================== --- hugin/trunk/src/hugin_base/nona/Stitcher.h 2008-01-03 13:53:33 UTC (rev 2602) +++ hugin/trunk/src/hugin_base/nona/Stitcher.h 2008-01-03 13:56:33 UTC (rev 2603) @@ -33,6 +33,8 @@ #include <iomanip> #include <vector> #include <utility> +#include <cctype> +#include <algorithm> #include <vigra/stdimage.hxx> #include <vigra/rgbvalue.hxx> @@ -216,8 +218,7 @@ || opts.outputFormat == PanoramaOptions::HDR_m || opts.outputFormat == PanoramaOptions::EXR_m); - m_basename = hugin_utils::stripExtension(basename); - DEBUG_DEBUG("created basename: " << basename << " -> " << m_basename); + m_basename = basename; // setup the output. prepareOutputFile(opts); @@ -319,6 +320,13 @@ std::string ext = opts.getOutputExtension(); + std::string cext = hugin_utils::getExtension(m_basename); + std::transform(cext.begin(),cext.end(), cext.begin(), (int(*)(int))std::tolower); + // remove extension only if it specifies the same file type, otherwise + // its probably part of the filename. + if (cext == ext) { + m_basename = hugin_utils::stripExtension(m_basename); + } std::ostringstream filename; filename << m_basename << std::setfill('0') << std::setw(4) << imgNr << "." + ext; @@ -557,7 +565,7 @@ { Base::stitch(opts, imgSet, filename, remapper); - std::string basename = hugin_utils::stripExtension(filename); + std::string basename = filename; // create panorama canvas ImageType pano(opts.getWidth(), opts.getHeight()); @@ -565,28 +573,17 @@ stitch(opts, imgSet, vigra::destImageRange(pano), vigra::destImage(panoMask), remapper); - std::string outputfile; - // save the remapped image - switch (opts.outputFormat) { - case PanoramaOptions::JPEG: - outputfile = basename + ".jpg"; - break; - case PanoramaOptions::PNG: - outputfile = basename + ".png"; - break; - case PanoramaOptions::TIFF: - outputfile = basename + ".tif"; - break; - case PanoramaOptions::HDR: - outputfile = basename + ".hdr"; - break; - case PanoramaOptions::EXR: - outputfile = basename + ".exr"; - break; - break; - default: - DEBUG_ERROR("unsupported output format: " << opts.outputFormat); + std::string ext = opts.getOutputExtension(); + std::string cext = hugin_utils::getExtension(basename); + std::transform(cext.begin(),cext.end(), cext.begin(), (int(*)(int))std::tolower); + // remove extension only if it specifies the same file type, otherwise + // its probably part of the filename. + if (cext == ext) { + basename = hugin_utils::stripExtension(basename); } + std::string outputfile = basename + "." + ext; + + // save the remapped image Base::m_progress.setMessage("saving result: " + hugin_utils::stripPath(outputfile)); DEBUG_DEBUG("Saving panorama: " << outputfile); vigra::ImageExportInfo exinfo(outputfile.c_str()); @@ -701,7 +698,7 @@ { Base::stitch(opts, imgSet, filename, remapper); - std::string basename = hugin_utils::stripExtension(filename); + std::string basename = filename; // create panorama canvas ImageType pano(opts.getWidth(), opts.getHeight()); @@ -710,27 +707,16 @@ stitch(opts, imgSet, vigra::destImageRange(pano), vigra::destImage(panoMask), remapper, reduce); - std::string outputfile; - // save the remapped image - switch (opts.outputFormat) { - case PanoramaOptions::JPEG: - outputfile = basename + ".jpg"; - break; - case PanoramaOptions::PNG: - outputfile = basename + ".png"; - break; - case PanoramaOptions::TIFF: - outputfile = basename + ".tif"; - break; - case PanoramaOptions::HDR: - outputfile = basename + ".hdr"; - break; - case PanoramaOptions::EXR: - outputfile = basename + ".exr"; - break; - default: - DEBUG_ERROR("unsupported output format: " << opts.outputFormat); + std::string ext = opts.getOutputExtension(); + std::string cext = hugin_utils::getExtension(basename); + std::transform(cext.begin(),cext.end(), cext.begin(), (int(*)(int))std::tolower); + // remove extension only if it specifies the same file type, otherwise + // its probably part of the filename. + if (cext == ext) { + basename = hugin_utils::stripExtension(basename); } + std::string outputfile = basename + "." + ext; + // Base::m_progress.setMessage("saving result: " + hugin_utils::stripPath(outputfile)); DEBUG_DEBUG("Saving panorama: " << outputfile); vigra::ImageExportInfo exinfo(outputfile.c_str()); @@ -905,7 +891,7 @@ SingleImageRemapper<ImageType, AlphaType> & remapper, BlendFunctor & blend) { - std::string basename = hugin_utils::stripExtension(filename); + std::string basename = filename; // create panorama canvas ImageType pano(opts.getWidth(), opts.getHeight()); @@ -913,22 +899,17 @@ stitch(opts, imgSet, vigra::destImageRange(pano), vigra::destImage(panoMask), remapper, blend); - std::string outputfile; - // save the remapped image - switch (opts.outputFormat) { - case PanoramaOptions::JPEG: - outputfile = basename + ".jpg"; - break; - case PanoramaOptions::PNG: - outputfile = basename + ".png"; - break; - case PanoramaOptions::TIFF: - outputfile = basename + ".tif"; - break; - default: - DEBUG_ERROR("unsupported output format: " << opts.outputFormat); + std::string ext = opts.getOutputExtension(); + std::string cext = hugin_utils::getExtension(basename); + std::transform(cext.begin(),cext.end(), cext.begin(), (int(*)(int))std::tolower); + // remove extension only if it specifies the same file type, otherwise + // its probably part of the filename. + if (cext == ext) { + basename = hugin_utils::stripExtension(basename); } - Base::m_progress.setMessage("saving result: " + hugin_utils::stripPath(outputfile)); + std::string outputfile = basename + "." + ext; + + Base::m_progress.setMessage("saving result: " + hugin_utils::stripPath(outputfile)); DEBUG_DEBUG("Saving panorama: " << outputfile); vigra::ImageExportInfo exinfo(outputfile.c_str()); exinfo.setXResolution(150); Modified: hugin/trunk/src/hugin_base/panodata/PanoramaOptions.h =================================================================== --- hugin/trunk/src/hugin_base/panodata/PanoramaOptions.h 2008-01-03 13:53:33 UTC (rev 2602) +++ hugin/trunk/src/hugin_base/panodata/PanoramaOptions.h 2008-01-03 13:56:33 UTC (rev 2603) @@ -224,8 +224,10 @@ outputHDRLayers = false; outputHDRStacks = false; + intermediateImageType = "tif"; + intermediateImageTypeCompression = "DEFLATE"; outputImageType = "tif"; - outputImageTypeCompression = "LZW"; + outputImageTypeCompression = "DEFLATE"; outputImageTypeHDR= "exr"; outputImageTypeHDRCompression = ""; @@ -374,6 +376,8 @@ bool outputHDRLayers; ///< save remapped layers (HDR) bool outputHDRStacks; ///< save image stacks (HDR) + std::string intermediateImageType; + std::string intermediateImageTypeCompression; std::string outputImageType; std::string outputImageTypeCompression; std::string outputImageTypeHDR; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |