/* * BoundInBoxAction.cpp * * Created on: May 8, 2010 * Author: heber */ #include "Helpers/MemDebug.hpp" #include "Actions/WorldAction/BoundInBoxAction.hpp" #include "Actions/ActionRegistry.hpp" #include "Helpers/Log.hpp" #include "molecule.hpp" #include "World.hpp" #include #include #include using namespace std; #include "UIElements/UIFactory.hpp" #include "UIElements/Dialog.hpp" #include "Actions/ValueStorage.hpp" const char WorldBoundInBoxAction::NAME[] = "bound-in-box"; WorldBoundInBoxAction::WorldBoundInBoxAction() : Action(NAME) {} WorldBoundInBoxAction::~WorldBoundInBoxAction() {} void WorldBoundInBox() { ActionRegistry::getInstance().getActionByName(WorldBoundInBoxAction::NAME)->call(Action::NonInteractive); }; Dialog* WorldBoundInBoxAction::fillDialog(Dialog *dialog) { ASSERT(dialog,"No Dialog given when filling action dialog"); dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME)); return dialog; } Action::state_ptr WorldBoundInBoxAction::performCall() { // center vector AllMolecules = World::getInstance().getAllMolecules(); for (vector::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) { (*MolRunner)->BoundInBox(); } return Action::success; } Action::state_ptr WorldBoundInBoxAction::performUndo(Action::state_ptr _state) { // ParserLoadXyzState *state = assert_cast(_state.get()); return Action::failure; // string newName = state->mol->getName(); // state->mol->setName(state->lastName); // // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName)); } Action::state_ptr WorldBoundInBoxAction::performRedo(Action::state_ptr _state){ return Action::failure; } bool WorldBoundInBoxAction::canUndo() { return false; } bool WorldBoundInBoxAction::shouldUndo() { return false; } const string WorldBoundInBoxAction::getName() { return NAME; }