/* * ScaleBoxAction.cpp * * Created on: May 8, 2010 * Author: heber */ #include "Helpers/MemDebug.hpp" #include "Actions/WorldAction/ScaleBoxAction.hpp" #include "Actions/ActionRegistry.hpp" #include "atom.hpp" #include "Helpers/Log.hpp" #include "LinearAlgebra/Vector.hpp" #include "Helpers/Verbose.hpp" #include "World.hpp" #include "Box.hpp" #include "LinearAlgebra/Matrix.hpp" #include #include using namespace std; #include "UIElements/UIFactory.hpp" #include "UIElements/Dialog.hpp" #include "Actions/ValueStorage.hpp" const char WorldScaleBoxAction::NAME[] = "scale-box"; WorldScaleBoxAction::WorldScaleBoxAction() : Action(NAME) {} WorldScaleBoxAction::~WorldScaleBoxAction() {} void WorldScaleBox(Vector &Scaler) { ValueStorage::getInstance().setCurrentValue(WorldScaleBoxAction::NAME, Scaler); ActionRegistry::getInstance().getActionByName(WorldScaleBoxAction::NAME)->call(Action::NonInteractive); }; Dialog* WorldScaleBoxAction::fillDialog(Dialog *dialog) { ASSERT(dialog,"No Dialog given when filling action dialog"); dialog->queryVector(NAME, false, ValueStorage::getInstance().getDescription(NAME)); return dialog; } Action::state_ptr WorldScaleBoxAction::performCall() { Vector Scaler; double x[NDIM]; ValueStorage::getInstance().queryCurrentValue(NAME, Scaler); 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); } Matrix M = World::getInstance().getDomain().getM(); Matrix scale; 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; }