diff --git a/Plot.cc b/Plot.cc index 13c6522dc3b4473c60864d30c0a60c6a7785cdd7..0402b03cf88399b92499334def9f7efbd76574d0 100644 --- a/Plot.cc +++ b/Plot.cc @@ -4,8 +4,8 @@ #include -Plot :: Plot(Profile profile_) : - profile(&profile_) +Plot :: Plot(Profile *profile_) : + profile(profile_) { for (int i = 0; i < profile->nProjs(); i++) { @@ -31,6 +31,7 @@ void Plot :: eventloop() execute(new SetDecorCommand); execute(new SetLinesCommand); + changemode(1); while ( cont ) @@ -113,6 +114,7 @@ void Plot :: eventloop() optionMenu(); console::consolecolor(); break; +/* case 82: // 'R' - reset range int p2; if ( projection[p2]->sRange() ) @@ -122,6 +124,7 @@ void Plot :: eventloop() } replot = true; break; +*/ case 82: // 'R' - reset range int p2; changemode(0); @@ -195,9 +198,6 @@ void Plot :: eventloop() cin >> p1; changemode(1); if ( p1 >= projection.size() || p1 < 0) - { - changemode(0); - if ( p1 >= projection.size() || p1 < 0) { cout << "There's no projection " << p1 << "!!" << endl; changemode(1); @@ -221,7 +221,6 @@ void Plot :: eventloop() replot = true; break; case 115: // 's' - print eps image - { float xdim, ydim, fontSize; string p_; changemode(0); @@ -243,7 +242,6 @@ void Plot :: eventloop() console::eraser(); execute(new PrintEpsCommand); break; - } /* case 116: // 't' - draw triangle int in; @@ -257,6 +255,7 @@ void Plot :: eventloop() // DEBUG routine break; */ +/* case 119: // 'w' - line width float linew; changemode(0); @@ -271,6 +270,7 @@ void Plot :: eventloop() } replot = true; break; +*/ } } diff --git a/Plot.h b/Plot.h index 4b3fe51239f3fc993864d9ac56dcca81d7db15c6..efcadc1e7423bb7b28ab47902d80482d9e1c395e 100644 --- a/Plot.h +++ b/Plot.h @@ -15,7 +15,7 @@ private: Profile *profile; public: - Plot(Profile); + Plot(Profile *); void eventloop(void); void execute(Command * cmd); void optionMenu(void); diff --git a/Profile.cc b/Profile.cc index 72bddc549eee8ccad588026441a2df4a8eb1de88..d815fb389b5920b4c0d5049e92d91741059b2a45 100644 --- a/Profile.cc +++ b/Profile.cc @@ -7,6 +7,7 @@ #include #include +#define MAX_COMPS 50 Profile :: Profile(int argc, char **argv) { @@ -40,9 +41,21 @@ Profile :: Profile(int argc, char **argv) fileName_ = optarg; break; case 'p': // projection + { + optind--; +/* + // Use the code below to get multiple entries for an option. + string comps(""); + for( ;optind < argc && *argv[optind] != '-'; optind++){ + if ( comps != "" ) comps = comps + " "; + comps = comps + string(argv[optind]); + } + argvComps_.push_back(comps); +*/ argvComps_.push_back(optarg); argvTypes_.push_back(PROJECTION); break; + } case 't': // triangular projection argvComps_.push_back(optarg); argvTypes_.push_back(TRIANGLE); @@ -94,7 +107,7 @@ Profile :: Profile(int argc, char **argv) cout << "No projection: " << argvComps_.size() << endl; for ( int i = 0; i < argvComps_.size(); i++ ) { - cout << " Projection components " << i << ": " << argvComps_[i] << endl; + cout << " Projection " << i << " components: " << argvComps_[i] << endl; } cout << endl; cout << endl; @@ -500,7 +513,7 @@ void Profile :: toggleVerbose() void Profile :: printUsage(int exitCode = -1) { - cerr << "\n Usage: %s -i [ -c ] [-p ] [-t ] [...] \n\n"; + cerr << "\n Usage: nplot -i [ -c ] [-p ] [-t ] [...] \n\n"; if ( exitCode != -1 ) exit(exitCode); diff --git a/command/PlotCommand.cc b/command/PlotCommand.cc index a45b336dea18ccc5ce2ed3ebc10f91e1bb37d5ce..5c1656ac26ff8b55a840c07b5506cfef58350b03 100644 --- a/command/PlotCommand.cc +++ b/command/PlotCommand.cc @@ -22,6 +22,7 @@ string PlotCommand :: execute(Projection *projection, Profile *profile, int inde Gnuplot * gplt = projection->projection(); stringstream lineStyle, ii; + if ( profile->decoration() ) withTitle = ""; else diff --git a/command/tpl b/command/tpl index 06d2b3ff3b03652546fafb98211f5a080fd10d61..6f7f5521dd549f1ee08772ede08a604e9a76ac82 100755 --- a/command/tpl +++ b/command/tpl @@ -1,7 +1,15 @@ #!/bin/bash +if [ "$1" == "" ]; then + echo "Create source code for a new command." + echo "Usage: $0 " + exit 0 +fi + cp TCommand.h $1Command.h cp TCommand.cc $1Command.cc sed -i -e "s/Sin/$1/g" $1Command.h sed -i -e "s/Sin/$1/g" $1Command.cc + +echo "Command source files '$1Command.[h,cc]' created!" diff --git a/main.cc b/main.cc index c64699e15f8dd29e0a34ccf69ce8fbcb70e2e6bf..2919db8487e70de2bf0e86a032a2cebaf37b0c62 100644 --- a/main.cc +++ b/main.cc @@ -9,10 +9,10 @@ using namespace std; int main (int argc, char ** argv) { - Profile profile(argc, argv); + Profile *profile = new Profile(argc, argv); Plot plot(profile); + cout << "Begin." << endl; plot.eventloop(); - cout << "End." << endl; } diff --git a/test.dat b/test.dat index 2bfd8ab164b0ed4cdcc55475e96e1e0884c049a7..56dede46ee6c81f51724bd7ba1fb6899eb9d08c5 100644 --- a/test.dat +++ b/test.dat @@ -403621,3 +403621,5 @@ 1.000000e+01 5.000000e-01 2.000000e+00 2.500000e+00 + +