- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/TextUI/TextDialog.cpp
r84c494 rcd8e55 25 25 #include "molecule.hpp" 26 26 #include "vector.hpp" 27 #include "Matrix.hpp"28 #include "Box.hpp"29 27 30 28 using namespace std; … … 60 58 } 61 59 60 void TextDialog::queryStrings(const char* title, vector<string>* target, string description){ 61 registerQuery(new StringsTextQuery(title,target,description)); 62 } 63 62 64 void TextDialog::queryAtom(const char* title, atom **target, string description) { 63 65 registerQuery(new AtomTextQuery(title,target,description)); … … 68 70 } 69 71 70 void TextDialog::queryVector(const char* title, Vector *target, bool check, string description) {71 registerQuery(new VectorTextQuery(title,target,c heck,description));72 } 73 74 void TextDialog::queryBox(const char* title, Box*cellSize, string description) {72 void TextDialog::queryVector(const char* title, Vector *target,const double *const cellSize, bool check, string description) { 73 registerQuery(new VectorTextQuery(title,target,cellSize,check,description)); 74 } 75 76 void TextDialog::queryBox(const char* title,double ** const cellSize, string description) { 75 77 registerQuery(new BoxTextQuery(title,cellSize,description)); 76 78 } … … 158 160 } 159 161 162 TextDialog::StringsTextQuery::StringsTextQuery(string title,vector<string> *_target, std::string _description) : 163 Dialog::StringsQuery(title,_target,_description) 164 {} 165 166 TextDialog::StringsTextQuery::~StringsTextQuery() {} 167 168 bool TextDialog::StringsTextQuery::handle() { 169 Log() << Verbose(0) << getTitle(); 170 getline(cin,temp); 171 // dissect by "," 172 string::iterator olditer = temp.begin(); 173 for(string::iterator iter = temp.begin(); iter != temp.end(); ++iter) { 174 if (*iter == ' ') { 175 tmp.push_back(string(iter, olditer)); 176 olditer = iter; 177 } 178 } 179 if (olditer != temp.begin()) // insert last part also 180 tmp.push_back(string(olditer, temp.end())); 181 182 return true; 183 } 184 160 185 TextDialog::DoubleTextQuery::DoubleTextQuery(string title,double *_target, std::string _description) : 161 186 Dialog::DoubleQuery(title,_target,_description) … … 245 270 } 246 271 247 TextDialog::VectorTextQuery::VectorTextQuery(std::string title, Vector *_target, bool _check, std::string _description) :248 Dialog::VectorQuery(title,_target,_c heck,_description)272 TextDialog::VectorTextQuery::VectorTextQuery(std::string title, Vector *_target, const double *const _cellSize, bool _check, std::string _description) : 273 Dialog::VectorQuery(title,_target,_cellSize,_check,_description) 249 274 {} 250 275 … … 255 280 Log() << Verbose(0) << getTitle(); 256 281 257 const Matrix &M = World::getInstance().getDomain().getM();258 282 char coords[3] = {'x','y','z'}; 283 int j = -1; 259 284 for (int i=0;i<3;i++) { 285 j += i+1; 260 286 do { 261 Log() << Verbose(0) << coords[i] << "[0.." << M.at(i,i)<< "]: ";287 Log() << Verbose(0) << coords[i] << "[0.." << cellSize[j] << "]: "; 262 288 cin >> (*tmp)[i]; 263 } while ((((*tmp)[i] < 0) || ((*tmp)[i] >= M.at(i,i))) && (check));289 } while ((((*tmp)[i] < 0) || ((*tmp)[i] >= cellSize[j])) && (check)); 264 290 } 265 291 return true; 266 292 } 267 293 268 TextDialog::BoxTextQuery::BoxTextQuery(std::string title, Box*_cellSize, std::string _description) :294 TextDialog::BoxTextQuery::BoxTextQuery(std::string title, double ** const _cellSize, std::string _description) : 269 295 Dialog::BoxQuery(title,_cellSize,_description) 270 296 {}
Note:
See TracChangeset
for help on using the changeset viewer.