- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/CommandLineUI/CommandLineDialog.cpp
r0286bc r5079a0 15 15 #include <Descriptors/MoleculeIdDescriptor.hpp> 16 16 #include "CommandLineUI/CommandLineDialog.hpp" 17 18 #include "Actions/Values.hpp"19 17 20 18 #include "element.hpp" … … 118 116 119 117 bool CommandLineDialog::BooleanCommandLineQuery::handle() { 120 if (CommandLineParser::getInstance().vm.count(getTitle())) { 121 tmp = CommandLineParser::getInstance().vm[getTitle()].as<bool>(); 122 return true; 123 } else 124 return false; 118 bool badInput = false; 119 char input = ' '; 120 do{ 121 badInput = false; 122 Log() << Verbose(0) << getTitle(); 123 cin >> input; 124 if ((input == 'y' ) || (input == 'Y')) { 125 tmp = true; 126 } else if ((input == 'n' ) || (input == 'N')) { 127 tmp = false; 128 } else { 129 badInput=true; 130 cin.clear(); 131 cin.ignore(std::numeric_limits<streamsize>::max(),'\n'); 132 Log() << Verbose(0) << "Input was not of [yYnN]!" << endl; 133 } 134 } while(badInput); 135 // clear the input buffer of anything still in the line 136 cin.ignore(std::numeric_limits<streamsize>::max(),'\n'); 137 return true; 125 138 } 126 139 … … 179 192 if (CommandLineParser::getInstance().vm.count(getTitle())) { 180 193 IdxOfMol = CommandLineParser::getInstance().vm[getTitle()].as<int>(); 181 cout << "IdxOfMol " << IdxOfMol << endl; 182 if (IdxOfMol >= 0) 183 tmp = World::getInstance().getMolecule(MoleculeById(IdxOfMol)); 184 else 185 tmp = NULL; 194 tmp = World::getInstance().getMolecule(MoleculeById(IdxOfMol)); 186 195 return true; 187 196 } else … … 197 206 198 207 bool CommandLineDialog::VectorCommandLineQuery::handle() { 199 VectorValuetemp;200 if (CommandLineParser::getInstance().vm.count(getTitle())) { 201 temp = CommandLineParser::getInstance().vm[getTitle()].as< VectorValue>();202 tmp->at(0) = temp.x;203 tmp->at(1) = temp.y;204 tmp->at(2) = temp.z;208 vector<double> temp; 209 if (CommandLineParser::getInstance().vm.count(getTitle())) { 210 temp = CommandLineParser::getInstance().vm[getTitle()].as<vector<double> >(); 211 assert((temp.size() == 3) && "Vector from command line does not have three components."); 212 for (int i=0;i<NDIM;i++) 213 tmp->at(i) = temp[i]; 205 214 return true; 206 215 } else … … 217 226 218 227 bool CommandLineDialog::BoxCommandLineQuery::handle() { 219 BoxValue temp; 220 if (CommandLineParser::getInstance().vm.count(getTitle())) { 221 temp = CommandLineParser::getInstance().vm[getTitle()].as< BoxValue >(); 222 tmp[0] = temp.xx; 223 tmp[1] = temp.xy; 224 tmp[2] = temp.xz; 225 tmp[3] = temp.yy; 226 tmp[4] = temp.yz; 227 tmp[5] = temp.zz; 228 vector<double> temp; 229 if (CommandLineParser::getInstance().vm.count(getTitle())) { 230 temp = CommandLineParser::getInstance().vm[getTitle()].as<vector<double> >(); 231 assert((temp.size() == 6) && "Symmetric box matrix from command line does not have six components."); 232 for (int i=0;i<6;i++) 233 tmp[i] = temp[i]; 228 234 return true; 229 235 } else
Note:
See TracChangeset
for help on using the changeset viewer.
