- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MoleculeAction/SuspendInWaterAction.cpp
r112b09 r047878 9 9 10 10 #include "Actions/MoleculeAction/SuspendInWaterAction.hpp" 11 #include "Actions/ActionRegistry.hpp" 12 #include "boundary.hpp" 13 #include "config.hpp" 14 #include "log.hpp" 15 #include "verbose.hpp" 16 #include "World.hpp" 11 17 12 18 #include <iostream> … … 17 23 #include "UIElements/UIFactory.hpp" 18 24 #include "UIElements/Dialog.hpp" 19 #include "Actions/MapOfActions.hpp" 20 21 #include "atom.hpp" 22 #include "boundary.hpp" 23 #include "config.hpp" 24 #include "log.hpp" 25 #include "config.hpp" 26 #include "World.hpp" 25 #include "UIElements/ValueStorage.hpp" 27 26 28 27 /****** MoleculeSuspendInWaterAction *****/ … … 49 48 {} 50 49 50 void MoleculeSuspendInWater(double density) { 51 ValueStorage::getInstance().setCurrentValue(MoleculeSuspendInWaterAction::NAME, density); 52 ActionRegistry::getInstance().getActionByName(MoleculeSuspendInWaterAction::NAME)->call(Action::NonInteractive); 53 }; 54 55 Dialog* MoleculeSuspendInWaterAction::fillDialog(Dialog *dialog) { 56 ASSERT(dialog,"No Dialog given when filling action dialog"); 57 58 dialog->queryDouble(NAME, ValueStorage::getInstance().getDescription(NAME)); 59 60 return dialog; 61 } 62 51 63 Action::state_ptr MoleculeSuspendInWaterAction::performCall() { 52 64 molecule *mol = NULL; 53 Dialog *dialog = UIFactory::getInstance().makeDialog();54 65 double density; 55 66 double volume = 0.; 56 67 57 dialog->queryMolecule(NAME, &mol, MapOfActions::getInstance().getDescription(NAME)); 58 dialog->queryDouble("density", &density, MapOfActions::getInstance().getDescription("density")); 68 ValueStorage::getInstance().queryCurrentValue(NAME, density); 59 69 60 if(dialog->display()) { 70 for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) { 71 mol = iter->second; 61 72 DoLog(0) && (Log() << Verbose(0) << "Evaluating necessary cell volume for a cluster suspended in water."); 62 73 if (density < 1.0) { … … 64 75 } else { 65 76 PrepareClustersinWater(World::getInstance().getConfig(), mol, volume, density); // if volume == 0, will calculate from ConvexEnvelope 66 delete dialog;67 return Action::success;68 77 } 69 78 } 70 delete dialog; 71 return Action::failure; 79 return Action::success; 72 80 } 73 81
Note:
See TracChangeset
for help on using the changeset viewer.