- Timestamp:
- Jul 5, 2017, 7:40:05 PM (8 years ago)
- Branches:
- ForceAnnealing_oldresults, IndependentFragmentGrids_IntegrationTest
- Children:
- 3a0371
- Parents:
- d21668
- git-author:
- Frederik Heber <frederik.heber@…> (05/09/17 11:07:11)
- git-committer:
- Frederik Heber <frederik.heber@…> (07/05/17 19:40:05)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/SelectionAction/Molecules/NotMoleculeByOrderAction.cpp
rd21668 r9a3882 54 54 55 55 ActionState::ptr SelectionNotMoleculeByOrderAction::performCall() { 56 const molecule *mol = const_cast<const World &>(World::getInstance()). 57 getMolecule(MoleculeByOrder(params.molindex.get())); 56 size_t no_unselected = 0; 57 const std::vector<int> &indices = params.molindices.get(); 58 std::vector<const molecule *> mols; 59 for( std::vector<int>::const_iterator iter = indices.begin(); 60 iter != indices.end(); ++iter) { 61 const molecule *mol = const_cast<const World &>(World::getInstance()). 62 getMolecule(MoleculeByOrder(*iter)); 58 63 59 if (mol != NULL) { 60 if (World::getInstance().isSelected(mol)) { 61 LOG(1, "Unselecting molecule " << mol->name); 62 World::getInstance().unselectMolecule(mol); 63 LOG(0, World::getInstance().countSelectedMolecules() << " molecules remain selected."); 64 return ActionState::ptr(new SelectionNotMoleculeByOrderState(mol, params)); 64 if (mol != NULL) { 65 if (World::getInstance().isSelected(mol)) { 66 //LOG(1, "Unselecting molecule " << mol->name); 67 World::getInstance().unselectMolecule(mol); 68 mols.push_back(mol); 69 ++no_unselected; 70 } 65 71 } else { 66 return Action::success; 72 STATUS("Cannot find molecule by given index "+toString(*iter)+"."); 73 return Action::failure; 67 74 } 75 } 76 77 LOG(0, no_unselected << " molecules additionally unselected."); 78 if (no_unselected != 0) { 79 return ActionState::ptr(new SelectionNotMoleculeByOrderState(mols, params)); 68 80 } else { 69 STATUS("Cannot find molecule by given index "+toString(params.molindex.get())+"."); 70 return Action::failure; 81 return Action::success; 71 82 } 72 83 } … … 75 86 SelectionNotMoleculeByOrderState *state = assert_cast<SelectionNotMoleculeByOrderState*>(_state.get()); 76 87 77 World::getInstance().selectMolecule(state->mol); 88 World &world = World::getInstance(); 89 for (std::vector<const molecule *>::const_iterator iter = state->mols.begin(); 90 iter != state->mols.end(); ++iter) 91 world.selectMolecule(*iter); 92 78 93 return ActionState::ptr(_state); 79 94 } … … 82 97 SelectionNotMoleculeByOrderState *state = assert_cast<SelectionNotMoleculeByOrderState*>(_state.get()); 83 98 84 World::getInstance().unselectMolecule(state->mol); 99 World &world = World::getInstance(); 100 for (std::vector<const molecule *>::const_iterator iter = state->mols.begin(); 101 iter != state->mols.end(); ++iter) 102 world.unselectMolecule(*iter); 103 85 104 return ActionState::ptr(_state); 86 105 }
Note:
See TracChangeset
for help on using the changeset viewer.