⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 commandinput.cpp

📁 linux的gps应用
💻 CPP
📖 第 1 页 / 共 4 页
字号:
   // pseudorange solution   CommandOption dashprsnit(CommandOption::hasArgument, CommandOption::stdType,      0,"PRSniter","\n# Pseudorange solution (PRS) configuration:\n"      " --PRSniter <n>        PRS: Limit on number of iterations ("      + StringUtils::asString(PRSnIter) + ")");   dashprsnit.setMaxCount(1);   {      ostringstream oss;      oss << scientific << setprecision(2) << PRSconverge;      msg = oss.str();   }   CommandOption dashprscon(CommandOption::hasArgument, CommandOption::stdType,      0,"PRSconverge",      " --PRSconverge <cl>    PRS: Convergence limit (m) (" + msg + ")");   dashprscon.setMaxCount(1);   CommandOption dashprsrms(CommandOption::hasArgument, CommandOption::stdType,      0,"PRSrmsLimit",      " --PRSrmsLimit <rms>   PRS: RMS residual limit (m) ("      + StringUtils::asString(PRSrmsLimit,2) + ")");   dashprsrms.setMaxCount(1);   CommandOption dashprsalg(CommandOption::hasArgument, CommandOption::stdType,      0,"PRSalgebra",      " --PRSalgebra          PRS: Use algebraic algorithm (don't)");   dashprsalg.setMaxCount(1);   CommandOption dashprselev(CommandOption::hasArgument, CommandOption::stdType,      0,"PRSMinElev"," --PRSMinElev <elev>   PRS: Reject data below elevation "      "<elev> degrees ("      + StringUtils::asString(PRSMinElevation,2) + ")");   dashprselev.setMaxCount(1);   //dont CommandOptionNoArg dashnoprs(0, "noPRS",      //dont " --noPRS               Skip the pseudorange solution (!)");   //dont dashnoprs.setMaxCount(1);   // output flags   CommandOption dashrawout(CommandOption::hasArgument, CommandOption::stdType,      0,"RAWFileOut","\n# Output files:\n --RAWFileOut <file>   "      "Filename for output of raw data ()");   dashrawout.setMaxCount(1);   CommandOption dashprsout(CommandOption::hasArgument, CommandOption::stdType,      0,"PRSFileOut"," --PRSFileOut <file>   "      "Filename for output of pseudorange solution ()");   dashprsout.setMaxCount(1);   CommandOption dashclkout(CommandOption::hasArgument, CommandOption::stdType,      0,"CLKFileOut"," --CLKFileOut <file>   "      "Filename for output of Rx clock bias and model ()");   dashclkout.setMaxCount(1);   CommandOption dashrddout(CommandOption::hasArgument, CommandOption::stdType,      0,"RDDFileOut",      " --RDDFileOut <file>   Filename for output of raw DD data ()");   dashrddout.setMaxCount(1);   CommandOption dashdddout(CommandOption::hasArgument, CommandOption::stdType,      0,"DDDFileOut"," --DDDFileOut <file>   Filename for output of (edited) DD data"      " ()");   dashdddout.setMaxCount(1);   CommandOption dashtddout(CommandOption::hasArgument, CommandOption::stdType,      0,"TDDFileOut"," --TDDFileOut <file>   Filename for output of triple "      "difference data ()");   dashtddout.setMaxCount(1);   CommandOption dashddrout(CommandOption::hasArgument, CommandOption::stdType,      0,"DDRFileOut"," --DDRFileOut <file>   Filename for output of DD post-fit "      "residuals ()");   dashddrout.setMaxCount(1);   CommandOption dashbaseout(CommandOption::hasArgument, CommandOption::stdType,      0,"BaseOut","\n# Output misc:\n --BaseOut <id-id,x,y,z> Baseline to output;"      " <id>s are station labels, '-' is\n                          "      "required, <x,y,z> are optional baseline coordinates.");   CommandOptionNoArg dashvalid('0', "validate",         " --validate            Read input and validate it, then quit.");   dashvalid.setMaxCount(1);   CommandOptionNoArg dashv('v', "verbose",         " --verbose             (also -v) print extended output info.");   CommandOptionNoArg dashd('d', "debug",         " --debug               (also -d) print very extended output info "         "(for developers).");   CommandOptionNoArg dashh('h', "help",         " --help                (also -h) print this help message and quit.");   // ... other options   CommandOptionRest Rest("");   // --------------------------------------------------------------------------------   // Define the parser here: before the options -- this is the "prgm description" ...   CommandOptionParser Par(PrgmDesc);   // parse the command line   // allow user to put all options in a file   // PreProcessArgs pulls out help, Debug, Verbose   vector<string> Args;   for(j=1; j<argc; j++) PreProcessArgs(argv[j],Args);   argc = Args.size();   if(argc==0)      help = true;      // pass the rest   argc = Args.size()+1;   char **CArgs=new char*[argc];   if(!CArgs) { cerr << "Failed to allocate CArgs\n"; return -1; }   CArgs[0] = argv[0];   for(j=1; j<argc; j++) {      CArgs[j] = new char[Args[j-1].size()+1];      if(!CArgs[j]) { cerr << "Failed to allocate CArgs[j]\n"; return -1; }      strcpy(CArgs[j],Args[j-1].c_str());   }   if(Debug) {      cout << "Argument list passed to parser:\n";      for(j=0; j<argc; j++) cout << j << " " << CArgs[j] << endl;   }   Par.parseOptions(argc, CArgs);   for(j=1; j<argc; j++) delete[] CArgs[j];   delete[] CArgs;   // check for errors on the command line   // hasErrors() returns invalid commands   // Rest contains things not recognized   if (Par.hasErrors() || Rest.getCount()) {      cerr << "\nErrors found in command line input:\n";      if(Par.hasErrors()) Par.dumpErrors(cerr);      if(Rest.getCount()) {         cerr << "The following command line fields were not recognized:\n";         values = Rest.getValue();         for(i=0; i<values.size(); i++) cerr << " " << values[i] << endl;      }      cerr << "...end of Errors\nAbort.\n";      help = true;   }   // if help, print usage   if(help) {      Par.displayUsage(cout,false);      cout << endl;   }   if(help && argc > 1) cout << endl << "--------- parsed input:" << endl;   // --------------------------------------------------------------------------------   // pull out the parsed input   // these already parsed by PreProcessArgs   //if(dashh.getCount()) help   //if(dashv.getCount()) verbose   //if(dashd.getCount()) debug   if(help && Verbose) cout << " Input: turn on verbose flag" << endl;   if(help && Debug) cout << " Input: turn on debug flag" << endl;      // open the log file first   if(dashl.getCount()) {      values = dashl.getValue();      LogFile = values[0];      if(help) cout << " Input: log file name " << LogFile << endl;   }   if(Debug) cout << " Log file name is " << LogFile << endl;   oflog.open(LogFile.c_str(),ios_base::out);   if(!oflog) {      cerr << "Failed to open log file " << LogFile << endl;      return -1;   }   if(Debug) cout << " Opened log file " << LogFile << endl;   oflog << Title << endl;   if(Par.hasErrors()) {      oflog << "\nErrors found in command line input:\n";      Par.dumpErrors(oflog);      oflog << "...end of Errors\n\n";   }   // paths   if(dashop.getCount()) {      values = dashop.getValue();      if(help) cout << " Input: obs path name: " << values[0] << endl;      InputPath = values[0];   }   else InputPath = string("");   if(dashnp.getCount()) {      values = dashnp.getValue();      if(help) cout << " Input: nav path name: " << values[0] << endl;      NavPath = values[0];   }   else NavPath = string("");   if(dashep.getCount()) {      values = dashep.getValue();      if(help) cout << " Input: EOP path name: " << values[0] << endl;      EOPPath = values[0];   }   else EOPPath = string("");   // files   // obs   if(dashof.getCount()) {      values = dashof.getValue();      for(i=0; i<values.size(); i++) {         field.clear();         while(values[i].size() > 0)            field.push_back(StringUtils::stripFirstWord(values[i],','));         if(field.size() < 2) {            oflog << "Error: no label in --obsfile input: " << values[i] << endl;            cerr << "Error: no label in --obsfile input: " << values[i] << endl;            continue;         }         Station& st=findStationInList(Stations,field[1]);         // create new ObsFile and add to list         ObsFile of;         of.name = field[0];         of.label = field[1];         of.nread = -1;         of.valid = false;         ObsFileList.push_back(of);         if(help) cout << " Input: Obs file (" << field[1] << ") : "            << field[0] << endl;      }   }   // nav   if(dashnf.getCount()) {      values = dashnf.getValue();      NavFileNames = values;      if(help) {         cout << " Input: Nav files :";         for(j=0; j<NavFileNames.size(); j++) cout << " " << NavFileNames[j];         cout << endl;      }   }   // eop   if(dashef.getCount()) {      values = dashef.getValue();      EOPFileNames = values;      if(help) {         cout << " Input: Earth orientation files :";         for(j=0; j<EOPFileNames.size(); j++) cout << " " << EOPFileNames[j];         cout << endl;      }   }   // positions   if(dashXYZ.getCount()) {      values = dashXYZ.getValue();      for(i=0; i<values.size(); i++) {         field.clear();         while(values[i].size() > 0)            field.push_back(StringUtils::stripFirstWord(values[i],','));         if(field.size() < 4) {            oflog << "Error: less than four fields in --PosXYZ input: "               << values[i] << endl;            cerr << "Error: less than four fields in --PosXYZ input: "               << values[i] << endl;            continue;         }         Station& st=findStationInList(Stations,field[3]);         Position p(StringUtils::asDouble(field[0]),                    StringUtils::asDouble(field[1]),                    StringUtils::asDouble(field[2]));         st.pos = p;         if(help) cout << " Input: XYZ for station " << field[3] << ":"            << " " << field[0] << " " << field[1] << " " << field[2] << endl;      }   }   if(dashLLH.getCount()) {      values = dashLLH.getValue();      for(i=0; i<values.size(); i++) {         field.clear();         while(values[i].size() > 0)            field.push_back(StringUtils::stripFirstWord(values[i],','));         if(field.size() < 4) {            oflog << "Error: less than four fields in --PosLLH input: "               << values[i] << endl;            cerr << "Error: less than four fields in --PosLLH input: "               << values[i] << endl;            continue;         }         Station& st=findStationInList(Stations,field[3]);         Position p;         p.setGeodetic(StringUtils::asDouble(field[0]),                       StringUtils::asDouble(field[1]),                       StringUtils::asDouble(field[2]));         st.pos = p;         if(help) cout << " Input: LLH for station " << field[3] << ":"            << " " << field[0] << " " << field[1] << " " << field[2] << endl;      }   }   if(dashPRS.getCount()) {      values = dashPRS.getValue();      for(i=0; i<values.size(); i++) {         field.clear();         field.push_back(StringUtils::stripFirstWord(values[i],','));         Station& st=findStationInList(Stations,field[0]);         st.usePRS = true;         if(help) cout << " Input: pos for station " << field[0]            << ": use average PR solution" << endl;      }   }   if(dashtrop.getCount()) {      values = dashtrop.getValue();      for(i=0; i<values.size(); i++) {         field.clear();         while(values[i].size() > 0)            field.push_back(StringUtils::stripFirstWord(values[i],','));         if(field.size() < 2) {            oflog << "Error: less than two fields in --TropModel input: "               << values[i] << endl;            cerr << "Error: less than two fields in --TropModel input: "               << values[i] << endl;            continue;         }         Station& st=findStationInList(Stations,field[1]);         st.TropType = field[0];         if(help) cout << " Input: Trop model " << field[0]            << " at Station " << field[1] << endl;      }   }   if(dashWx.getCount()) {      values = dashWx.getValue();      for(i=0; i<values.size(); i++) {         field.clear();         while(values[i].size() > 0)            field.push_back(StringUtils::stripFirstWord(values[i],','));         if(field.size() < 4) {            oflog << "Error: less than four fields in --Weather input: "               << values[i] << endl;            cerr << "Error: less than four fields in --Weather input: "               << values[i] << endl;            continue;         }         Station& st=findStationInList(Stations,field[3]);         st.temp = StringUtils::asDouble(field[0]);         st.press = StringUtils::asDouble(field[1]);         st.rhumid = StringUtils::asDouble(field[2]);         if(help) cout << " Weather input for station " << field[3] << ":"            << " " << field[0] << " " << field[1] << " " << field[2] << endl;      }   }   if(dashfix.getCount()) {      values = dashfix.getValue();      for(i=0; i<values.size(); i++) {         Station& st=findStationInList(Stations,values[i]);         st.fixed = true;         if(help) cout << " Input: Hold Station " << values[i] << " fixed." << endl;      }   }   //if(dashant.getCount()) {   //   values = dashant.getValue();   //   for(i=0; i<values.size(); i++) {   //      field.clear();   //      while(values[i].size() > 0)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -