|
Isis 3.0 Application Source Code Reference |
Home |
00001 #include <cmath> 00002 00003 #include "Isis.h" 00004 #include "FileList.h" 00005 #include "Cube.h" 00006 #include "Process.h" 00007 #include "Pvl.h" 00008 #include "SpiceKernel.h" 00009 #include "SpkSegment.h" 00010 #include "Commentor.h" 00011 #include "SpkKernelWriter.h" 00012 00013 using namespace std; 00014 using namespace Isis; 00015 00016 void IsisMain() { 00017 Process p; 00018 00019 // Get the list of names of input CCD cubes to stitch together 00020 FileList flist; 00021 UserInterface &ui = Application::GetUserInterface(); 00022 if (ui.WasEntered("FROM")) flist.push_back(ui.GetFileName("FROM")); 00023 if (ui.WasEntered("FROMLIST")) flist.read(ui.GetFileName("FROMLIST")); 00024 if (flist.size() < 1) { 00025 QString msg = "Files must be specified in FROM and/or FROMLIST - none found!"; 00026 throw IException(IException::User,msg,_FILEINFO_); 00027 } 00028 00029 SpiceKernel<SpkSegment> kernel; 00030 Progress prog; 00031 prog.SetMaximumSteps(flist.size()); 00032 prog.CheckStatus(); 00033 00034 for (int i = 0 ; i < flist.size() ; i++) { 00035 // Add and process each image 00036 kernel.add(SpkSegment(flist[i].toString())); 00037 prog.CheckStatus(); 00038 } 00039 00040 // Process CK kernel requests 00041 QString comfile(""); 00042 if (ui.WasEntered("COMFILE")) comfile = ui.GetFileName("COMFILE"); 00043 00044 SpkKernelWriter kwriter(ui.GetInteger("TYPE")); 00045 00046 // Write the output file if requested 00047 if (ui.WasEntered("TO")) { 00048 kwriter.write(kernel, ui.GetFileName("TO"), comfile); 00049 } 00050 00051 // Write a summary of the documentation 00052 if (ui.WasEntered("SUMMARY")) { 00053 QString fFile = FileName(ui.GetFileName("SUMMARY")).expanded(); 00054 ofstream os; 00055 os.open(fFile.toAscii().data(),ios::out); 00056 if (!os) { 00057 QString mess = "Cannot create SPK SUMMARY output file " + fFile; 00058 throw IException(IException::User, mess, _FILEINFO_); 00059 } 00060 os << kwriter.getComment(kernel, comfile) << endl; 00061 os.close(); 00062 } 00063 p.EndProcess(); 00064 }