- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MoleculeAction/BondFileAction.cpp
r112b09 r047878 9 9 10 10 #include "Actions/MoleculeAction/BondFileAction.hpp" 11 #include "Actions/ActionRegistry.hpp" 12 #include "log.hpp" 13 #include "molecule.hpp" 14 #include "verbose.hpp" 15 #include "World.hpp" 11 16 12 17 #include <iostream> … … 18 23 #include "UIElements/UIFactory.hpp" 19 24 #include "UIElements/Dialog.hpp" 20 #include " Actions/MapOfActions.hpp"25 #include "UIElements/ValueStorage.hpp" 21 26 22 #include "atom.hpp"23 #include "bondgraph.hpp"24 #include "config.hpp"25 #include "defs.hpp"26 #include "log.hpp"27 #include "molecule.hpp"28 #include "vector.hpp"29 #include "World.hpp"30 27 31 28 /****** MoleculeBondFileAction *****/ … … 52 49 {} 53 50 51 void MoleculeBondFile(std::string &bondfile) { 52 ValueStorage::getInstance().setCurrentValue(MoleculeBondFileAction::NAME, bondfile); 53 ActionRegistry::getInstance().getActionByName(MoleculeBondFileAction::NAME)->call(Action::NonInteractive); 54 }; 55 56 Dialog* MoleculeBondFileAction::fillDialog(Dialog *dialog) { 57 ASSERT(dialog,"No Dialog given when filling action dialog"); 58 59 dialog->queryString(NAME, MapOfActions::getInstance().getDescription(NAME)); 60 61 return dialog; 62 } 63 54 64 Action::state_ptr MoleculeBondFileAction::performCall() { 55 65 string filename; 56 Dialog *dialog = UIFactory::getInstance().makeDialog();57 66 molecule *mol = NULL; 58 67 59 dialog->queryString(NAME, &filename, MapOfActions::getInstance().getDescription(NAME)); 60 dialog->queryMolecule("molecule-by-id", &mol, MapOfActions::getInstance().getDescription("molecule-by-id")); 68 ValueStorage::getInstance().queryCurrentValue(NAME, filename); 61 69 62 if(dialog->display()) { 70 if(World::getInstance().countSelectedMolecules() == 1) { 71 mol = World::getInstance().beginMoleculeSelection()->second; 63 72 DoLog(0) && (Log() << Verbose(0) << "Parsing bonds from " << filename << "." << endl); 64 73 ifstream input(filename.c_str()); 65 74 mol->CreateAdjacencyListFromDbondFile(&input); 66 75 input.close(); 67 delete dialog;68 76 return Action::success; 69 } 70 delete dialog; 71 return Action::failure; 77 } else 78 return Action::failure; 72 79 } 73 80
Note:
See TracChangeset
for help on using the changeset viewer.