- Timestamp:
- May 9, 2017, 12:18:01 PM (8 years ago)
- Branches:
- ForceAnnealing_goodresults, ForceAnnealing_tocheck
- Children:
- 54293d
- Parents:
- e59735
- git-author:
- Frederik Heber <frederik.heber@…> (05/09/17 11:07:11)
- git-committer:
- Frederik Heber <frederik.heber@…> (05/09/17 12:18:01)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/SelectionAction/Molecules/MoleculeByOrderAction.cpp
re59735 rd2a077a 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 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, "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));64 if (mol != NULL) { 65 if (!World::getInstance().isSelected(mol)) { 66 //LOG(1, "Selecting molecule " << mol->name); 67 World::getInstance().selectMolecule(mol); 68 mols.push_back(mol); 69 } 65 70 } else { 66 return Action::success; 71 STATUS("Cannot find molecule by given index "+toString(*iter)+"."); 72 return Action::failure; 67 73 } 74 } 75 76 LOG(0, no_selected << " molecules additionally selected."); 77 if (no_selected != 0) { 78 return ActionState::ptr(new SelectionMoleculeByOrderState(mols, params)); 68 79 } else { 69 STATUS("Cannot find molecule by given index "+toString(params.molindex.get())+"."); 70 return Action::failure; 80 return Action::success; 71 81 } 72 82 } … … 75 85 SelectionMoleculeByOrderState *state = assert_cast<SelectionMoleculeByOrderState*>(_state.get()); 76 86 77 World::getInstance().unselectMolecule(state->mol); 87 for (std::vector<const molecule *>::const_iterator iter = state->mols.begin(); 88 iter != state->mols.end(); ++iter) 89 World::getInstance().unselectMolecule(*iter); 78 90 return ActionState::ptr(_state); 79 91 } … … 82 94 SelectionMoleculeByOrderState *state = assert_cast<SelectionMoleculeByOrderState*>(_state.get()); 83 95 84 World::getInstance().selectMolecule(state->mol); 96 for (std::vector<const molecule *>::const_iterator iter = state->mols.begin(); 97 iter != state->mols.end(); ++iter) 98 World::getInstance().selectMolecule(*iter); 85 99 return ActionState::ptr(_state); 86 100 }
Note:
See TracChangeset
for help on using the changeset viewer.
