/* * ScaleBoxAction.cpp * * Created on: May 8, 2010 * Author: heber */ #include "Actions/WorldAction/ScaleBoxAction.hpp" #include "atom.hpp" #include "log.hpp" #include "vector.hpp" #include "verbose.hpp" #include "World.hpp" #include #include using namespace std; #include "UIElements/UIFactory.hpp" #include "UIElements/Dialog.hpp" #include "Actions/MapOfActions.hpp" const char WorldScaleBoxAction::NAME[] = "scale-box"; WorldScaleBoxAction::WorldScaleBoxAction() : Action(NAME) {} WorldScaleBoxAction::~WorldScaleBoxAction() {} Action::state_ptr WorldScaleBoxAction::performCall() { Dialog *dialog = UIFactory::getInstance().makeDialog(); Vector Scaler; double x[NDIM]; int j=0; dialog->queryVector(NAME, &Scaler, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription(NAME)); if(dialog->display()) { DoLog(1) && (Log() << Verbose(1) << "Scaling all atomic positions by factor." << endl); for (int i=0;i AllAtoms = World::getInstance().getAllAtoms(); for(vector::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) { (*AtomRunner)->x.ScaleAll(x); } j = -1; double * const cell_size = World::getInstance().getDomain(); for (int i=0;i(_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 WorldScaleBoxAction::performRedo(Action::state_ptr _state){ return Action::failure; } bool WorldScaleBoxAction::canUndo() { return false; } bool WorldScaleBoxAction::shouldUndo() { return false; } const string WorldScaleBoxAction::getName() { return NAME; }