- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MoleculeAction/SaveAdjacencyAction.cpp
r112b09 r047878 9 9 10 10 #include "Actions/MoleculeAction/SaveAdjacencyAction.hpp" 11 #include "Actions/ActionRegistry.hpp" 12 #include "bondgraph.hpp" 13 #include "config.hpp" 14 #include "log.hpp" 15 #include "molecule.hpp" 16 #include "verbose.hpp" 17 #include "World.hpp" 18 11 19 12 20 #include <iostream> … … 18 26 #include "UIElements/UIFactory.hpp" 19 27 #include "UIElements/Dialog.hpp" 20 #include "Actions/MapOfActions.hpp" 21 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 "verbose.hpp" 30 #include "World.hpp" 28 #include "UIElements/ValueStorage.hpp" 31 29 32 30 /****** MoleculeSaveAdjacencyAction *****/ … … 53 51 {} 54 52 53 void MoleculeSaveAdjacency(std::string &adjacencyfile) { 54 ValueStorage::getInstance().setCurrentValue(MoleculeSaveAdjacencyAction::NAME, adjacencyfile); 55 ActionRegistry::getInstance().getActionByName(MoleculeSaveAdjacencyAction::NAME)->call(Action::NonInteractive); 56 }; 57 58 Dialog* MoleculeSaveAdjacencyAction::fillDialog(Dialog *dialog) { 59 ASSERT(dialog,"No Dialog given when filling action dialog"); 60 61 dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME)); 62 63 return dialog; 64 } 65 55 66 Action::state_ptr MoleculeSaveAdjacencyAction::performCall() { 56 67 string filename; 57 Dialog *dialog = UIFactory::getInstance().makeDialog();58 68 molecule *mol = NULL; 59 69 60 dialog->queryString(NAME, &filename, MapOfActions::getInstance().getDescription(NAME)); 61 dialog->queryMolecule("molecule-by-id", &mol, MapOfActions::getInstance().getDescription("molecule-by-id")); 70 ValueStorage::getInstance().queryCurrentValue(NAME, filename); 62 71 63 if(dialog->display()) { 72 for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) { 73 mol = iter->second; 64 74 DoLog(0) && (Log() << Verbose(0) << "Storing adjacency to path " << filename << "." << endl); 65 75 World::getInstance().getConfig()->BG->ConstructBondGraph(mol); 66 76 // TODO: sollte stream nicht filename benutzen, besser fuer unit test 67 char outputname[MAXSTRINGSIZE]; 68 strcpy(outputname, filename.c_str()); 69 mol->StoreAdjacencyToFile(NULL, outputname); 70 delete dialog; 71 return Action::success; 77 mol->StoreAdjacencyToFile(filename); 72 78 } 73 delete dialog; 74 return Action::failure; 79 return Action::success; 75 80 } 76 81
Note:
See TracChangeset
for help on using the changeset viewer.