📄 commandinput.cpp
字号:
// field.push_back(StringUtils::stripFirstWord(values[i],',')); // if(field.size() < 2) { // oflog << "Error: invalid AntAz input: " << values[i] << endl; // cerr << "Error: invalid AntAz input: " << values[i] << endl; // continue; // } // Station& st=findStationInList(Stations,field[1]); // st.ant_azimuth = StringUtils::asDouble(field[0]); // if(help) cout << " Input: antenna azimuth for station " << field[1] << ": " // << fixed << setprecision(2) << st.ant_azimuth << " degrees" << endl; // } //} // configuration if(dashfreq.getCount()) { values = dashfreq.getValue(); if(values[0] == string("L1") || values[0] == string("1")) Frequency = 1; else if(values[0] == string("L2") || values[0] == string("2")) Frequency = 2; else if(values[0] == string("L3") || values[0] == string("3")) Frequency = 3; else { cout << "Error: invalid input (" << values[0] << ") --Frequency must be followed by 'L1','L2' or 'L3'" << endl; return -1; } if(help) cout << " Input: process frequency L" << Frequency << endl; } if(dashRef.getCount()) { values = dashRef.getValue(); RefSat.fromString(values[0]); if(help) cout << " Input: set satellite " << RefSat << " as reference" << endl; } if(dashnoest.getCount()) { noEstimate = true; if(help) cout << " *** Turn OFF the estimation ***" << endl; } if(dashprsnit.getCount()) { values = dashprsnit.getValue(); PRSnIter = StringUtils::asInt(values[0]); if(help) cout << " Input: set PRS iteration limit to " << PRSnIter << endl; } if(dashprsrms.getCount()) { values = dashprsrms.getValue(); PRSrmsLimit = StringUtils::asDouble(values[0]); if(help) cout << " Input: set PRS RMS residual limit to " << scientific << setprecision(2) << PRSrmsLimit << endl; } if(dashprscon.getCount()) { values = dashprscon.getValue(); PRSconverge = StringUtils::asDouble(values[0]); if(help) cout << " Input: set PRS convergence limit to " << scientific << setprecision(2) << PRSconverge << endl; } if(dashprsalg.getCount()) { PRSalgebra = true; if(help) cout << " Input: use algebraic algorithm in pseudorange solution" << endl; } if(dashprselev.getCount()) { values = dashprselev.getValue(); PRSMinElevation = StringUtils::asDouble(values[0]); if(help) cout << " Input: set PRS elevation limit to " << fixed << setprecision(2) << PRSMinElevation << endl; } //dont if(dashnoprs.getCount()) { //dont noRAIM = true; //dont if(help) cout << " *** Turn OFF the pseudorange solution ***" << endl; //dont } if(dashnit.getCount()) { values = dashnit.getValue(); nIter = StringUtils::asInt(values[0]); if(help) cout << " Input: number of iterations in Estimation : " << nIter << endl; } if(dashconv.getCount()) { values = dashconv.getValue(); convergence = fabs(StringUtils::asDouble(values[0])); if(help) cout << " Input: convergence limit in Estimation : " << scientific << setprecision(3) << convergence << endl; } if(dashfixbias.getCount()) { FixBiases = true; if(help) cout << " Input: Turn ON fixing of biases in last iteration" << endl; } if(dashntrop.getCount()) { values = dashntrop.getValue(); NRZDintervals = StringUtils::asInt(values[0]); if(help) cout << " Input: " << NRZDintervals << " residual zenith delay intervals" << endl; } if(dashttrop.getCount()) { values = dashttrop.getValue(); RZDtimeconst = StringUtils::asDouble(values[0]); if(help) cout << " Input: RZD time constant " << fixed << setprecision(2) << RZDtimeconst << " hours" << endl; } if(dashstrop.getCount()) { values = dashstrop.getValue(); RZDsigma = StringUtils::asDouble(values[0]); if(help) cout << " Input: RZD sigma " << fixed << setprecision(2) << RZDsigma << " meters" << endl; } if(dashtight.getCount()) { values = dashtight.getValue(); TightConstraint = StringUtils::asDouble(values[0]); if(help) cout << " Input: tight constraint " << scientific << setprecision(2) << TightConstraint << " (fraction of baseline)" << endl; } if(dashloose.getCount()) { values = dashloose.getValue(); LooseConstraint = StringUtils::asDouble(values[0]); if(help) cout << " Input: loose constraint " << scientific << setprecision(2) << LooseConstraint << " (fraction of baseline)" << endl; } // times // TD put try {} around setToString and catch invalid formats... if(dashbt.getCount()) { values = dashbt.getValue(); msg = values[0]; field.clear(); while(msg.size() > 0) field.push_back(StringUtils::stripFirstWord(msg,',')); if(field.size() == 2) BegTime.setToString(field[0]+","+field[1], "%F,%g"); else if(field.size() == 6) BegTime.setToString(field[0]+","+field[1]+","+field[2]+","+field[3]+"," +field[4]+","+field[5], "%Y,%m,%d,%H,%M,%S"); else { cerr << "Error: invalid --BeginTime input: " << values[0] << endl; oflog << "Error: invalid --BeginTime input: " << values[0] << endl; } if(help) cout << " Input: begin time " << values[0] << " = " << BegTime.printf("%Y/%02m/%02d %2H:%02M:%06.3f = %F/%10.3g") << endl; } if(dashet.getCount()) { values = dashet.getValue(); msg = values[0]; field.clear(); while(msg.size() > 0) field.push_back(StringUtils::stripFirstWord(msg,',')); if(field.size() == 2) EndTime.setToString(field[0]+","+field[1], "%F,%g"); else if(field.size() == 6) EndTime.setToString(field[0]+","+field[1]+","+field[2]+","+field[3]+"," +field[4]+","+field[5], "%Y,%m,%d,%H,%M,%S"); else { cerr << "Error: invalid --EndTime input: " << values[0] << endl; oflog << "Error: invalid --EndTime input: " << values[0] << endl; } if(help) cout << " Input: end time " << values[0] << " = " << EndTime.printf("%Y/%02m/%02d %2H:%02M:%06.3f = %F/%10.3g") << endl; } // time table if(dashttab.getCount()) { values = dashttab.getValue(); TimeTableFile = values[0]; if(help) cout << " Input: time table file name " << TimeTableFile << endl; } // data editing if(dashelev.getCount()) { values = dashelev.getValue(); MinElevation = StringUtils::asDouble(values[0]); if(help) cout << " Input: minimum elevation for phases : " << values[0] << " degrees" << endl; } if(dashrotelev.getCount()) { values = dashrotelev.getValue(); RotatedAntennaElevation = StringUtils::asDouble(values[0]); if(help) cout << " Input: rotate antenna in elevation by : " << values[0] << " degrees" << endl; } if(dashrotaz.getCount()) { values = dashrotaz.getValue(); RotatedAntennaAzimuth = StringUtils::asDouble(values[0]); if(help) cout << " Input: rotate antenna in azimuth by : " << values[0] << " degrees" << endl; } if(dashgap.getCount()) { values = dashgap.getValue(); MaxGap = StringUtils::asInt(values[0]); if(help) cout << " Input: maximum acceptable gap (units DT): " << values[0] << endl; } if(dashmindd.getCount()) { values = dashmindd.getValue(); MinDDSeg = StringUtils::asInt(values[0]); if(help) cout << " Input: minimum acceptable double difference segment: " << values[0] << endl; } if(dashphbias.getCount()) { values = dashphbias.getValue(); PhaseBiasReset = StringUtils::asInt(values[0]); if(help) cout << " Input: phase bias reset limit (cycles) " << values[0] << endl; } if(dashXsat.getCount()) { values = dashXsat.getValue(); for(i=0; i<values.size(); i++) { GSatID p(values[i]); if(help) cout << " Exclude satellite " << p << endl; ExSV.push_back(p); } } if(dashDT.getCount()) { values = dashDT.getValue(); DataInterval = StringUtils::asDouble(values[0]); if(DataInterval < 0.0) DataInterval=fabs(DataInterval); if(help) cout << " Input: data interval " << fixed << setprecision(2) << DataInterval << " seconds" << endl; } // output if(dashrawout.getCount()) { values = dashrawout.getValue(); OutputRawFile = values[0]; if(help) cout << " Input: file name for raw data output ............... " << values[0] << endl; } if(dashprsout.getCount()) { values = dashprsout.getValue(); OutputPRSFile = values[0]; if(help) cout << " Input: file name for PRS output .................... " << values[0] << endl; } if(dashclkout.getCount()) { values = dashclkout.getValue(); OutputClkFile = values[0]; if(help) cout << " Input: file name for clock output .................. " << values[0] << endl; } if(dashrddout.getCount()) { values = dashrddout.getValue(); OutputRawDDFile = values[0]; if(help) cout << " Input: file name for raw DD data output ............ " << values[0] << endl; } if(dashdddout.getCount()) { values = dashdddout.getValue(); OutputDDDFile = values[0]; if(help) cout << " Input: file name for edited DD data output ......... " << values[0] << endl; } if(dashtddout.getCount()) { values = dashtddout.getValue(); OutputTDDFile = values[0]; if(help) cout << " Input: file name for triple differece data output .. " << values[0] << endl; } if(dashddrout.getCount()) { values = dashddrout.getValue(); OutputDDRFile = values[0]; if(help) cout << " Input: file name for DD post-fit residuals output .. " << values[0] << endl; } if(dashbaseout.getCount()) { values = dashbaseout.getValue(); for(i=0; i<values.size(); i++) { field.clear(); field.push_back(StringUtils::stripFirstWord(values[i],'-')); while(values[i].size() > 0) field.push_back(StringUtils::stripFirstWord(values[i],',')); if(field.size() != 2 && field.size() != 5) { oflog << "Error: invalid --BaseOut input: " << values[i] << endl; cerr << "Error: invalid --BaseOut input: " << values[i] << endl; continue; } CI.OutputBaselines.push_back(field[0] + string("-") + field[1]); if(help) cout << " Input: baseline for output " << field[0] << "-" << field[1]; Triple trip(0.0,0.0,0.0); if(field.size() == 5) { double x=StringUtils::asDouble(field[2]); double y=StringUtils::asDouble(field[3]); double z=StringUtils::asDouble(field[4]); trip = Triple(x,y,z); if(help) cout << " with offset " << field[2] << "," << field[3] << "," << field[4]; } else { if(help) cout << " ... no offset"; } CI.OutputBaselineOffsets.push_back(trip); if(help) cout << endl; } } if(dashvalid.getCount()) { Validate = true; if(help) cout << " Input: validate -- read, test input and quit" << endl; } if(help) { if(argc > 1) cout << "--------- end of parsed input, Quit." << endl << endl; return -1; } return 0;}catch(Exception& e) { GPSTK_RETHROW(e); }catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); }catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); }}//------------------------------------------------------------------------------------void CommandInput::PreProcessArgs(const char *arg, vector<string>& Args){try { if(string(arg) == string()) return; if(arg[0]=='-' && arg[1]=='f') { string filename(arg); filename.erase(0,2); if(Debug) cout << "Found a file of options: " << filename << endl; ifstream infile(filename.c_str()); if(!infile) { cerr << "Error: could not open options file " << filename << endl; } else { char c; string buffer,word; while(1) { getline(infile,buffer); StringUtils::stripTrailing(buffer,'\r'); // process the buffer before checking eof or bad b/c there can be // a line at EOF that has no CRLF... while(!buffer.empty()) { word = StringUtils::firstWord(buffer); if(word[0] == '#') { // skip to end of line break; } else if(word[0] == '"') { word = StringUtils::stripFirstWord(buffer,'"'); } else { word = StringUtils::stripFirstWord(buffer); } PreProcessArgs(word.c_str(),Args); if(buffer.empty()) break; } if(infile.eof() || !infile.good()) break; } } } else if(string(arg)==string("-h") || string(arg)==string("--help")) { help = true; if(Debug) cout << "Found the help switch" << endl; } else if(string(arg)==string("-d") || string(arg)==string("--debug")) { Debug = true;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -