PanoramaMakefilelibExport.h

Go to the documentation of this file.
00001 /*
00002 This file is part of hugin.
00003 
00004 hugin is free software: you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation, either version 2 of the License, or
00007 (at your option) any later version.
00008 
00009 hugin is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with hugin.  If not, see <http://www.gnu.org/licenses/>.
00016 */
00017 
00025 #ifndef PANORAMAMAKEFILELIBEXPORT_H_
00026 #define PANORAMAMAKEFILELIBEXPORT_H_
00027 
00028 #include <hugin_shared.h>
00029 #include <algorithms/PanoramaAlgorithm.h>
00030 #include <panodata/PanoramaData.h>
00031 #include <iosfwd>
00032 #include <makefilelib/Manager.h>
00033 #include <makefilelib/Makefile.h>
00034 #include <makefilelib/Variable.h>
00035 #include <makefilelib/Rule.h>
00036 
00037 
00041 namespace HuginBase
00042 {
00043 class IMPEX PanoramaMakefilelibExport : public PanoramaAlgorithm
00044 {
00045 public:
00046     struct PTPrograms
00047     {
00048         std::string nona;
00049         std::string hdrmerge;
00050         std::string PTStitcher;
00051         std::string PTmender;
00052         std::string PTblender;
00053         std::string PTmasker;
00054         std::string PTroller;
00055         std::string enblend;
00056         std::string enblend_opts;
00057         std::string enfuse;
00058         std::string enfuse_opts;
00059         std::string smartblend;
00060         std::string smartblend_opts;
00061         std::string exiftool;
00062         std::string exiftool_opts;
00063 
00064         PTPrograms()
00065         {
00066                 // default programs
00067                 nona = "nona";
00068                 PTStitcher = "PTStitcher";
00069                 PTmender = "PTmender";
00070                 PTblender = "PTblender";
00071                 PTmasker = "PTmasker";
00072                 PTroller = "PTroller";
00073                 enblend = "enblend";
00074                 enfuse = "enfuse";
00075                 smartblend = "smartblend.exe";
00076                 hdrmerge = "hugin_hdrmerge";
00077                 exiftool = "exiftool";
00078         }
00079     };
00080 private:
00081         PanoramaData & pano;
00082         UIntSet images;
00083         const std::string & ptofile;
00084         const std::string & outputPrefix;
00085         const PTPrograms & progs;
00086         const std::string & includePath;
00087         std::vector<std::string> & outputFiles;
00088         std::ostream & makefile;
00089         const std::string& tmpDir;
00090     const bool copyMetadata;
00091     const int nrThreads;
00092 
00093         makefile::Manager mgr;
00094         std::ostringstream valuestream;
00095 
00096         bool createItems();
00097 
00098         void createstacks(const std::vector<UIntSet> stackdata,
00099                         const std::string stkname,
00100                         const std::string filenamecenter, const std::string inputfilenamecenter, const std::string filenameext,
00101                         std::vector<makefile::Variable*>& stacks,
00102                         std::vector<makefile::Variable*>& stacks_shell,
00103                         std::vector<makefile::Variable*>& stacks_input,
00104                         std::vector<makefile::Variable*>& stacks_input_shell,
00105                         makefile::Variable*& vstacks,
00106                         makefile::Variable*& vstacksshell,
00107                         std::vector<std::string>& allfiles);
00108         void createexposure(const std::vector<UIntSet> stackdata,
00109                         const std::string stkname,
00110                         const std::string filenamecenter, const std::string inputfilenamecenter, const std::string filenameext,
00111                         std::vector<makefile::Variable*>& stacks,
00112                         std::vector<makefile::Variable*>& stacks_shell,
00113                         std::vector<makefile::Variable*>& stacks_input,
00114                         std::vector<makefile::Variable*>& stacks_input_shell,
00115                         std::vector<makefile::Variable*>& stacks_input_pt,
00116                         std::vector<makefile::Variable*>& stacks_input_pt_shell,
00117                         makefile::Variable*& vstacks,
00118                         makefile::Variable*& vstacksshell,
00119                         makefile::Variable*& vstacksrem,
00120                         makefile::Variable*& vstacksremshell,
00121                         std::vector<std::string>& inputs);
00122 
00123         void createcheckProgCmd(makefile::Rule& testrule, const std::string& progName, const std::string& progCommand);
00124     void echoInfo(makefile::Rule& inforule, const std::string& info);
00125     void printSystemInfo(makefile::Rule& inforule);
00126         bool writeMakefile()
00127         {
00128                 return makefile::Makefile::getSingleton().writeMakefile(makefile) != 0;
00129         }
00130 public:
00131     PanoramaMakefilelibExport(PanoramaData & pano_,
00132             const UIntSet & images_,
00133             const std::string & ptofile_,
00134             const std::string & outputPrefix_,
00135             const PTPrograms & progs_,
00136             const std::string & includePath_,
00137             std::vector<std::string> & outputFiles_,
00138             std::ostream & makefile_,
00139             const std::string& tmpDir_,
00140             const bool copyMetadata_,
00141             const int nrThreads_);
00142 
00143         static void createMakefile(PanoramaData & pano_,
00144             const UIntSet & images_,
00145             const std::string & ptofile_,
00146             const std::string & outputPrefix_,
00147             const PTPrograms & progs_,
00148             const std::string & includePath_,
00149             std::vector<std::string> & outputFiles_,
00150             std::ostream & makefile_,
00151             const std::string& tmpDir_,
00152             const bool copyMetadata_,
00153             const int nrThreads_)
00154         {
00155                 PanoramaMakefilelibExport* instance = new PanoramaMakefilelibExport(
00156                                 pano_, images_, ptofile_, outputPrefix_, progs_, includePath_,
00157                 outputFiles_, makefile_, tmpDir_, copyMetadata_, nrThreads_);
00158                 instance->createItems();
00159                 instance->writeMakefile();
00160                 delete instance;
00161         }
00162 
00163         virtual bool modifiesPanoramaData() const
00164         {
00165                 return false;
00166         }
00167         bool runAlgorithm()
00168         {
00169                 return createItems() && writeMakefile();
00170         }
00171 
00172         virtual ~PanoramaMakefilelibExport()
00173         {
00174                 // TODO Auto-generated destructor stub
00175         }
00176 
00177 
00178 };
00183 void IMPEX printstacks(const std::vector<UIntSet>& stackdata);
00189 template<typename T>
00190 void append(std::vector<T>& vec, const T& element);
00197 template<typename T>
00198 void append(std::vector<T>& dst, const std::vector<T>& src);
00199 }
00200 
00201 #endif /* PANORAMAMAKEFILELIBEXPORT_H_ */

Generated on Wed Sep 17 01:25:38 2014 for Hugintrunk by  doxygen 1.3.9.1