- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AtomAction/AddAction.cpp
r112b09 rf0a3ec 6 6 */ 7 7 8 #include "Helpers/MemDebug.hpp"9 10 8 #include "Actions/AtomAction/AddAction.hpp" 11 #include "CommandLineParser.hpp"12 9 #include "atom.hpp" 13 10 #include "element.hpp" 14 11 #include "log.hpp" 15 #include " periodentafel.hpp"12 #include "molecule.hpp" 16 13 #include "vector.hpp" 17 14 #include "verbose.hpp" … … 38 35 Action::state_ptr AtomAddAction::performCall() { 39 36 Dialog *dialog = UIFactory::getInstance().makeDialog(); 40 int Z = -1;37 std::vector<element *> elements; 41 38 Vector position; 42 39 43 dialog->query Int(NAME, &Z, MapOfActions::getInstance().getDescription(NAME));40 dialog->queryElement(NAME, &elements, MapOfActions::getInstance().getDescription(NAME)); 44 41 dialog->queryVector("position", &position, World::getInstance().getDomain(), true, MapOfActions::getInstance().getDescription("position")); 42 cout << "pre-dialog" << endl; 45 43 46 44 if(dialog->display()) { 45 cout << "post-dialog" << endl; 47 46 delete dialog; 48 atom * first = World::getInstance().createAtom();49 first->type = World::getInstance().getPeriode()->FindElement(Z);50 first->x = position;51 if (first->type != NULL) {47 if (elements.size() == 1) { 48 atom * first = World::getInstance().createAtom(); 49 first->type = *(elements.begin()); 50 first->x = position; 52 51 DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << first->type->name << " at " << (first->x) << "." << endl); 52 // TODO: remove when all of World's atoms are stored. 53 std::vector<molecule *> molecules = World::getInstance().getAllMolecules(); 54 if (!molecules.empty()) { 55 std::vector<molecule *>::iterator iter = molecules.begin(); 56 (*iter)->AddAtom(first); 57 } 53 58 return Action::success; 54 59 } else { 55 60 DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the specified element." << endl); 56 World::getInstance().destroyAtom(first);57 61 return Action::failure; 58 62 }
Note:
See TracChangeset
for help on using the changeset viewer.