[Kst] extragear/graphics/kst/kst
Barth Netterfield
netterfield at astro.utoronto.ca
Tue Aug 30 03:41:18 CEST 2005
SVN commit 454835 by netterfield:
Start of Matrix/Image from command line: loads matrixes, but doesn't
yet create images.
M +32 -24 main.cpp
--- trunk/extragear/graphics/kst/kst/main.cpp #454834:454835
@@ -38,19 +38,17 @@
#include "kstsvector.h"
#include "kstavector.h"
#include "kstvcurve.h"
+#include "kstrmatrix.h"
#include "plugincollection.h"
-// George is going to freak out if main() gets more complicated. :-)
-// Let's try to come up with a KstCommandLineProcessor class that can
-// properly and cleanly deal with all of this.
-
static const char description[] = I18N_NOOP("Kst: a data viewing program.");
static QStringList strErrors;
static KCmdLineOptions options[] = {
{"F <dataFile>", I18N_NOOP("Specify data file: used to override a kst file default"), "|"},
{ "y <Y>", I18N_NOOP("Field for Y axis (multiple allowed)"), 0 },
+ { "M <M>", I18N_NOOP("Field for a Matrix (multiple allowed)"), 0 },
{ "ye <equation>", I18N_NOOP("Equation for Y axis (multiple allowed)"), 0 },
{ "e <E>", I18N_NOOP("Field for Y errors (multiple allowed)"), 0 },
{ "x <X>", I18N_NOOP("Field or range for X axis"), "INDEX"},
@@ -365,6 +363,7 @@
QColor color;
KstDataSourcePtr file;
QCStringList ycolList;
+ QCStringList matrixList;
QCStringList yEqList;
QCStringList psdList;
QCStringList hsList;
@@ -372,6 +371,7 @@
unsigned int i_ycol;
QCStringList::Iterator hs_string;
QCStringList::Iterator eq_i;
+ QCStringList::Iterator mat_i;
bool showQuickStart = false;
bool showDataWizard = false;
bool nOK;
@@ -385,22 +385,6 @@
QString pngfile = args->getOption("png");
bool print_and_exit = false;
-
-#if 0
- // test code
- KstAVectorPtr tmpav = new KstAVector(3, "tmpV" );
- tmpav->value()[0] = 0;
- tmpav->value()[1] = 10;
- tmpav->value()[2] = 4;
-
- KST::addVectorToList(KstVectorPtr(tmpav));
-
- KstVectorPtr tmpv;
- tmpv = new KstSVector(-5,5,100,"tmpV");
- KST::addVectorToList( tmpv );
-#endif
- // end test code...
-
if (printfile != "<none>") {
print_and_exit = true;
}
@@ -418,13 +402,14 @@
// get Y axis columns
ycolList = args->getOptionList("y");
+ matrixList = args->getOptionList("M");
yEqList = args->getOptionList("ye");
psdList = args->getOptionList("p");
hsList = args->getOptionList("h");
errorList = args->getOptionList("e");
// y axis or PSD specified, so the files are data files, not kst files.
- n_y = ycolList.count() + psdList.count() + hsList.count() + yEqList.count();
+ n_y = ycolList.count() + psdList.count() + hsList.count() + yEqList.count() + matrixList.count();
if (n_y > 0) {
QString creatingEquations = i18n("Creating equations");
QString creatingCurves = i18n("Creating curves");
@@ -454,9 +439,9 @@
i_plot = 0;
Kst2DPlotPtr plot = *plist.at(i_plot);
-
+
KstVCurveList vcurves = kstObjectSubList<KstBaseCurve,KstVCurve>(plot->Curves);
-
+
// make stand alone equations if there are no files
if (args->count() < 1) {
if (!yEqList.isEmpty()) {
@@ -683,6 +668,29 @@
}
} // next histogram
} // end (if there are some histograms)
+
+ if (matrixList.count() >0) { // if there are some matrixes
+ for (mat_i = matrixList.begin(); mat_i != matrixList.end(); ++mat_i) {
+ QString tag_name = KST::suggestMatrixName(*mat_i);
+ if (!file->isValidMatrix(*mat_i)) {
+ strErrors.append(i18n("Failed to create matrix '%1' from file '%2'.").arg(*mat_i).arg(file->fileName()));
+ }
+ KstRMatrixPtr matrix = new KstRMatrix(file, *mat_i, tag_name,
+ 0,0,-1,-1,false,false,0);
+ // xStart, yStart, xNumSteps, yNumSteps,
+ //doAve, doSkip, skip);
+ KST::addMatrixToList(KstMatrixPtr(matrix));
+
+
+ if (in.sep_plots) {
+ plot->setTagName(matrix->tagName());
+ i_plot++;
+ if (i_plot < in.n_plots) {
+ plot = *plist.at(i_plot);
+ }
+ }
+ }
+ }
} else {
strErrors.append(i18n("Failed to load file '%1'.").arg(args->arg(i_file)));
}
@@ -726,7 +734,7 @@
showDataWizard = true;
showQuickStart = false;
}
-
+
if (printfile != "<none>") {
kst->forceUpdate();
kst->immediatePrintToFile(printfile);
More information about the Kst
mailing list