Changeset 25d9d9 for src/Actions/MoleculeAction/CenterInBoxAction.cpp
- Timestamp:
- Jun 12, 2016, 8:48:21 AM (10 years ago)
- Branches:
- Fix_BoundInBox_CenterInBox_MoleculeActions
- Parents:
- 996ef1
- git-author:
- Frederik Heber <heber@…> (06/11/16 16:43:54)
- git-committer:
- Frederik Heber <heber@…> (06/12/16 08:48:21)
- File:
-
- 1 moved
-
src/Actions/MoleculeAction/CenterInBoxAction.cpp (moved) (moved from src/Actions/WorldAction/CenterInBoxAction.cpp ) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MoleculeAction/CenterInBoxAction.cpp
r996ef1 r25d9d9 53 53 #include <vector> 54 54 55 #include "Actions/ WorldAction/CenterInBoxAction.hpp"55 #include "Actions/MoleculeAction/CenterInBoxAction.hpp" 56 56 57 57 using namespace MoleCuilder; … … 61 61 #include "Action_impl_pre.hpp" 62 62 /** =========== define the function ====================== */ 63 ActionState::ptr WorldCenterInBoxAction::performCall() {63 ActionState::ptr MoleculeCenterInBoxAction::performCall() { 64 64 // create undo state 65 65 std::stringstream undostream; … … 69 69 std::vector< boost::shared_ptr<Vector> > OldPositions; 70 70 { 71 std::vector<const molecule*> AllMolecules = const_cast<const World &>(World::getInstance()).72 get AllMolecules();73 for (std::vector<const molecule*>::iterator MolRunner = AllMolecules.begin();74 MolRunner != AllMolecules.end();71 std::vector<const molecule*> SelectedMolecules = const_cast<const World &>(World::getInstance()). 72 getSelectedMolecules(); 73 for (std::vector<const molecule*>::iterator MolRunner = SelectedMolecules.begin(); 74 MolRunner != SelectedMolecules.end(); 75 75 ++MolRunner) { 76 76 for(molecule::const_iterator AtomRunner = (*MolRunner)->begin(); … … 90 90 91 91 // center atoms 92 std::vector<molecule*> AllMolecules = World::getInstance().getAllMolecules();93 for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {92 std::vector<molecule*> SelectedMolecules = World::getInstance().getSelectedMolecules(); 93 for (std::vector<molecule*>::iterator MolRunner = SelectedMolecules.begin(); MolRunner != SelectedMolecules.end(); ++MolRunner) { 94 94 (*MolRunner)->CenterInBox(); 95 95 } … … 99 99 100 100 // create undo state 101 WorldCenterInBoxState *UndoState =102 new WorldCenterInBoxState(101 MoleculeCenterInBoxState *UndoState = 102 new MoleculeCenterInBoxState( 103 103 undostream.str(), 104 104 OldPositions, … … 109 109 } 110 110 111 ActionState::ptr WorldCenterInBoxAction::performUndo(ActionState::ptr _state) {112 WorldCenterInBoxState *state = assert_cast<WorldCenterInBoxState*>(_state.get());111 ActionState::ptr MoleculeCenterInBoxAction::performUndo(ActionState::ptr _state) { 112 MoleculeCenterInBoxState *state = assert_cast<MoleculeCenterInBoxState*>(_state.get()); 113 113 114 114 // restore domain … … 121 121 // place atoms on old positions 122 122 std::vector< boost::shared_ptr<Vector> >::const_iterator OldPositionsIter = state->OldPositions.begin(); 123 std::vector<molecule*> AllMolecules = World::getInstance().getAllMolecules();124 for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin();125 MolRunner != AllMolecules.end();123 std::vector<molecule*> SelectedMolecules = World::getInstance().getSelectedMolecules(); 124 for (std::vector<molecule*>::iterator MolRunner = SelectedMolecules.begin(); 125 MolRunner != SelectedMolecules.end(); 126 126 ++MolRunner) { 127 127 for(molecule::iterator AtomRunner = (*MolRunner)->begin(); … … 140 140 } 141 141 142 ActionState::ptr WorldCenterInBoxAction::performRedo(ActionState::ptr _state){143 WorldCenterInBoxState *state = assert_cast<WorldCenterInBoxState*>(_state.get());142 ActionState::ptr MoleculeCenterInBoxAction::performRedo(ActionState::ptr _state){ 143 MoleculeCenterInBoxState *state = assert_cast<MoleculeCenterInBoxState*>(_state.get()); 144 144 145 145 // set new domain … … 147 147 148 148 // center atoms 149 std::vector<molecule *> AllMolecules = World::getInstance().getAllMolecules();150 for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {149 std::vector<molecule *> SelectedMolecules = World::getInstance().getSelectedMolecules(); 150 for (std::vector<molecule*>::iterator MolRunner = SelectedMolecules.begin(); MolRunner != SelectedMolecules.end(); ++MolRunner) { 151 151 (*MolRunner)->CenterInBox(); 152 152 } … … 158 158 } 159 159 160 bool WorldCenterInBoxAction::canUndo() {160 bool MoleculeCenterInBoxAction::canUndo() { 161 161 return true; 162 162 } 163 163 164 bool WorldCenterInBoxAction::shouldUndo() {164 bool MoleculeCenterInBoxAction::shouldUndo() { 165 165 return true; 166 166 }
Note:
See TracChangeset
for help on using the changeset viewer.
