/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2010 University of Bonn. All rights reserved. * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. */ /* * ManipulateAtomsProcess.cpp * * Created on: Feb 18, 2010 * Author: crueger */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/MemDebug.hpp" #include "ManipulateAtomsProcess.hpp" #include #include "World.hpp" #include "CodePatterns/Assert.hpp" using namespace std; ManipulateAtomsProcess::ManipulateAtomsProcess( boost::function _operation, AtomDescriptor _descr, const ActionTraits &_trait, bool _doRegister) : Process(0,_trait,_doRegister), descr(_descr), operation(_operation) {} ManipulateAtomsProcess::~ManipulateAtomsProcess() {} void ManipulateAtomsProcess::getParametersfromValueStorage() {}; Dialog* ManipulateAtomsProcess::fillDialog(Dialog *dialog){ ASSERT(dialog,"No Dialog given when filling action dialog"); return dialog; } Action::state_ptr ManipulateAtomsProcess::performCall(){ World::getInstance().doManipulate(this); return Action::success; } Action::state_ptr ManipulateAtomsProcess::performUndo(Action::state_ptr){ ASSERT(0,"Undo called for a ManipulateAtomsProcess"); return Action::success; } Action::state_ptr ManipulateAtomsProcess::performRedo(Action::state_ptr){ ASSERT(0,"Redo called for a ManipulateAtomsProcess"); return Action::success; } bool ManipulateAtomsProcess::canUndo(){ return false; } bool ManipulateAtomsProcess::shouldUndo(){ return true; } void ManipulateAtomsProcess::doManipulate(World *world){ setMaxSteps(world->numAtoms()); start(); for(World::internal_AtomIterator iter=world->getAtomIter_internal(descr); iter!=world->atomEnd_internal(); ++iter){ setCurrStep(iter.getCount()); operation(*iter); } stop(); }