Added option to save data from canvas a quit for non-interactive mode (web).

This commit is contained in:
salman 2015-01-23 17:17:08 +01:00
parent be9bfdf091
commit 8035bafec4

View File

@ -67,6 +67,8 @@ void musrview_syntax()
cout << endl << " eps, pdf, gif, jpg, png, svg, xpm, root"; cout << endl << " eps, pdf, gif, jpg, png, svg, xpm, root";
cout << endl << " example: musrview 3310.msr --png, will produce a files 3310_X.png"; cout << endl << " example: musrview 3310.msr --png, will produce a files 3310_X.png";
cout << endl << " where 'X' stands for the plot number (starting form 0)"; cout << endl << " where 'X' stands for the plot number (starting form 0)";
cout << endl << " --ascii: ";
cout << endl << " will produce an ascii dump of the data and fit as plotted.";
cout << endl << " --timeout <timeout>: <timeout> given in seconds after which musrview terminates."; cout << endl << " --timeout <timeout>: <timeout> given in seconds after which musrview terminates.";
cout << endl << " If <timeout> <= 0, no timeout will take place. Default <timeout> is 0."; cout << endl << " If <timeout> <= 0, no timeout will take place. Default <timeout> is 0.";
cout << endl; cout << endl;
@ -100,6 +102,7 @@ int main(int argc, char *argv[])
bool success = true; bool success = true;
char fileName[128]; char fileName[128];
bool graphicsOutput = false; bool graphicsOutput = false;
bool asciiOutput = false;
char graphicsExtension[128]; char graphicsExtension[128];
int timeout = 0; int timeout = 0;
@ -135,6 +138,8 @@ int main(int argc, char *argv[])
graphicsOutput = true; graphicsOutput = true;
strcpy(graphicsExtension, argv[i]+2); strcpy(graphicsExtension, argv[i]+2);
} else if (!strcmp(argv[i], "--ascii")) {
asciiOutput = true;
} else if (!strcmp(argv[i], "--timeout")) { } else if (!strcmp(argv[i], "--timeout")) {
if (i+1 < argc) { if (i+1 < argc) {
TString str(argv[i+1]); TString str(argv[i+1]);
@ -334,6 +339,10 @@ int main(int argc, char *argv[])
musrCanvas->SaveGraphicsAndQuit(fileName, graphicsExtension); musrCanvas->SaveGraphicsAndQuit(fileName, graphicsExtension);
} }
if (asciiOutput) {
musrCanvas->SaveDataAsciiAndQuit();
}
// keep musrCanvas objects // keep musrCanvas objects
canvasVector.push_back(musrCanvas); canvasVector.push_back(musrCanvas);
} }