Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/TextUI/TextDialog.cpp

    r84c494 rcd8e55  
    2525#include "molecule.hpp"
    2626#include "vector.hpp"
    27 #include "Matrix.hpp"
    28 #include "Box.hpp"
    2927
    3028using namespace std;
     
    6058}
    6159
     60void TextDialog::queryStrings(const char* title, vector<string>* target, string description){
     61  registerQuery(new StringsTextQuery(title,target,description));
     62}
     63
    6264void TextDialog::queryAtom(const char* title, atom **target, string description) {
    6365  registerQuery(new AtomTextQuery(title,target,description));
     
    6870}
    6971
    70 void TextDialog::queryVector(const char* title, Vector *target, bool check, string description) {
    71   registerQuery(new VectorTextQuery(title,target,check,description));
    72 }
    73 
    74 void TextDialog::queryBox(const char* title,Box* cellSize, string description) {
     72void 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
     76void TextDialog::queryBox(const char* title,double ** const cellSize, string description) {
    7577  registerQuery(new BoxTextQuery(title,cellSize,description));
    7678}
     
    158160}
    159161
     162TextDialog::StringsTextQuery::StringsTextQuery(string title,vector<string> *_target, std::string _description) :
     163    Dialog::StringsQuery(title,_target,_description)
     164{}
     165
     166TextDialog::StringsTextQuery::~StringsTextQuery() {}
     167
     168bool 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
    160185TextDialog::DoubleTextQuery::DoubleTextQuery(string title,double *_target, std::string _description) :
    161186    Dialog::DoubleQuery(title,_target,_description)
     
    245270}
    246271
    247 TextDialog::VectorTextQuery::VectorTextQuery(std::string title, Vector *_target, bool _check, std::string _description) :
    248     Dialog::VectorQuery(title,_target,_check,_description)
     272TextDialog::VectorTextQuery::VectorTextQuery(std::string title, Vector *_target, const double *const _cellSize, bool _check, std::string _description) :
     273    Dialog::VectorQuery(title,_target,_cellSize,_check,_description)
    249274{}
    250275
     
    255280  Log() << Verbose(0) << getTitle();
    256281
    257   const Matrix &M = World::getInstance().getDomain().getM();
    258282  char coords[3] = {'x','y','z'};
     283  int j = -1;
    259284  for (int i=0;i<3;i++) {
     285    j += i+1;
    260286    do {
    261       Log() << Verbose(0) << coords[i] << "[0.." << M.at(i,i) << "]: ";
     287      Log() << Verbose(0) << coords[i] << "[0.." << cellSize[j] << "]: ";
    262288      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));
    264290  }
    265291  return true;
    266292}
    267293
    268 TextDialog::BoxTextQuery::BoxTextQuery(std::string title, Box* _cellSize, std::string _description) :
     294TextDialog::BoxTextQuery::BoxTextQuery(std::string title, double ** const _cellSize, std::string _description) :
    269295    Dialog::BoxQuery(title,_cellSize,_description)
    270296{}
Note: See TracChangeset for help on using the changeset viewer.