Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/GraphAction/SubgraphDissectionAction.cpp

    r3213f2 rf47e00b  
    4242#include "Actions/GraphAction/UpdateMoleculesAction.hpp"
    4343#include "Actions/GraphAction/SubgraphDissectionAction.hpp"
    44 #include "Actions/SelectionAction/Atoms/PushAtomsAction.hpp"
    45 #include "Actions/SelectionAction/Atoms/PopAtomsAction.hpp"
    46 #include "Actions/SelectionAction/Atoms/AllAtomsAction.hpp"
    4744#include "Actions/ActionQueue.hpp"
    4845#include "Actions/ActionRegistry.hpp"
     
    6360void GraphSubgraphDissectionAction::prepare(ActionRegistry &AR)
    6461{
    65   actions.addAction(AR.getActionByName(std::string("push-atom-selection")));
    6662  actions.addAction(AR.getActionByName(std::string("select-all-atoms")));
    6763  actions.addAction(AR.getActionByName(std::string("destroy-adjacency")));
    6864  actions.addAction(AR.getActionByName(std::string("create-adjacency")));
    6965  actions.addAction(AR.getActionByName(std::string("update-molecules")));
    70   actions.addAction(AR.getActionByName(std::string("pop-atom-selection")));
    7166  isPrepared = true;
    7267}
     
    7974}
    8075
     76void reselectAtoms(const std::vector<atom *> &selected_atoms)
     77{
     78  World::getInstance().clearAtomSelection();
     79  for (std::vector<atom *>::const_iterator iter = selected_atoms.begin();
     80      iter != selected_atoms.end();
     81      ++iter)
     82    World::getInstance().selectAtom(*iter);
     83}
     84
    8185ActionState::ptr GraphSubgraphDissectionAction::performCall(){
     86  // we need to "emulate" that all atoms have been selected without destroying
     87  // current selection
     88  const std::vector<atom *> selected_atoms = World::getInstance().getSelectedAtoms();
    8289  ActionState::ptr state(MakroAction::performCall());
     90  reselectAtoms(selected_atoms);
    8391
    8492  return state;
     
    8694
    8795ActionState::ptr GraphSubgraphDissectionAction::performUndo(ActionState::ptr _state) {
     96  // we need to "emulate" that all atoms have been selected without destroying
     97  // current selection
     98  const std::vector<atom *> selected_atoms = World::getInstance().getSelectedAtoms();
    8899  ActionState::ptr state(MakroAction::performUndo(_state));
     100  reselectAtoms(selected_atoms);
    89101
    90102  return state;
     
    92104
    93105ActionState::ptr GraphSubgraphDissectionAction::performRedo(ActionState::ptr _state){
     106  // we need to "emulate" that all atoms have been selected without destroying
     107  // current selection
     108  const std::vector<atom *> selected_atoms = World::getInstance().getSelectedAtoms();
    94109  ActionState::ptr state(MakroAction::performRedo(_state));
     110  reselectAtoms(selected_atoms);
    95111
    96112  return state;
Note: See TracChangeset for help on using the changeset viewer.