- 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/MoleculeByOrderAction.cpp
rd21668 r9a3882 54 54 55 55 ActionState::ptr SelectionMoleculeByOrderAction::performCall() { 56 const molecule *mol = const_cast<const World &>(World::getInstance()). 57 getMolecule(MoleculeByOrder(params.molindex.get())); 56 size_t no_selected = 0; 57 const std::vector<int> &indices = params.molindices.get(); 58 std::vector<const molecule *> mols; 59 const World &const_world = World::getConstInstance(); 60 World &world = World::getInstance(); 61 for( std::vector<int>::const_iterator iter = indices.begin(); 62 iter != indices.end(); ++iter) { 63 const molecule *mol = const_world.getMolecule(MoleculeByOrder(*iter)); 58 64 59 if (mol != NULL) { 60 if (!World::getInstance().isSelected(mol)) { 61 LOG(1, "Selecting molecule " << mol->name); 62 World::getInstance().selectMolecule(mol); 63 LOG(0, World::getInstance().countSelectedMolecules() << " molecules selected."); 64 return ActionState::ptr(new SelectionMoleculeByOrderState(mol, params)); 65 if (mol != NULL) { 66 if (!const_world.isSelected(mol)) { 67 //LOG(1, "Selecting molecule " << mol->name); 68 world.selectMolecule(mol); 69 mols.push_back(mol); 70 ++no_selected; 71 } 65 72 } else { 66 return Action::success; 73 STATUS("Cannot find molecule by given index "+toString(*iter)+"."); 74 return Action::failure; 67 75 } 76 } 77 78 LOG(0, no_selected << " molecules additionally selected."); 79 if (no_selected != 0) { 80 return ActionState::ptr(new SelectionMoleculeByOrderState(mols, params)); 68 81 } else { 69 STATUS("Cannot find molecule by given index "+toString(params.molindex.get())+"."); 70 return Action::failure; 82 return Action::success; 71 83 } 72 84 } … … 75 87 SelectionMoleculeByOrderState *state = assert_cast<SelectionMoleculeByOrderState*>(_state.get()); 76 88 77 World::getInstance().unselectMolecule(state->mol); 89 World &world = World::getInstance(); 90 for (std::vector<const molecule *>::const_iterator iter = state->mols.begin(); 91 iter != state->mols.end(); ++iter) 92 world.unselectMolecule(*iter); 93 78 94 return ActionState::ptr(_state); 79 95 } … … 82 98 SelectionMoleculeByOrderState *state = assert_cast<SelectionMoleculeByOrderState*>(_state.get()); 83 99 84 World::getInstance().selectMolecule(state->mol); 100 World &world = World::getInstance(); 101 for (std::vector<const molecule *>::const_iterator iter = state->mols.begin(); 102 iter != state->mols.end(); ++iter) 103 world.selectMolecule(*iter); 85 104 return ActionState::ptr(_state); 86 105 }
Note:
See TracChangeset
for help on using the changeset viewer.