Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.cpp

    r90bc51 r2204b0  
    3434class MoleculeRotateAroundSelfByAngleState : public ActionState {
    3535public:
    36     MoleculeRotateAroundSelfByAngleState(molecule * const _mol, const Vector &_Axis, const double _alpha) :
     36    MoleculeRotateAroundSelfByAngleState(molecule * const _mol, const double _alpha) :
    3737      mol(_mol),
    38       Axis(_Axis),
    3938      alpha(_alpha)
    4039    {}
    4140    molecule* const mol;
    42     Vector Axis;
    4341    double alpha;
    4442};
     
    5351{}
    5452
    55 void MoleculeRotateAroundSelfByAngle(const Vector &Axis, const double angle) {
     53void MoleculeRotateAroundSelfByAngle(double angle) {
    5654  ValueStorage::getInstance().setCurrentValue(MoleculeRotateAroundSelfByAngleAction::NAME, angle);
    57   ValueStorage::getInstance().setCurrentValue("position", Axis);
    5855  ActionRegistry::getInstance().getActionByName(MoleculeRotateAroundSelfByAngleAction::NAME)->call(Action::NonInteractive);
    5956};
     
    6360
    6461  dialog->queryDouble(NAME, MapOfActions::getInstance().getDescription(NAME));
    65   dialog->queryVector("position", false, MapOfActions::getInstance().getDescription(NAME));
    6662
    6763  return dialog;
     
    7167  molecule *mol = NULL;
    7268  double alpha = 0.;
    73   Vector Axis;
    7469
    75   // obtain angle and axis around which rotate
     70  // obtain angle around which rotate
    7671  ValueStorage::getInstance().queryCurrentValue(NAME, alpha);
    77   ValueStorage::getInstance().queryCurrentValue("position", Axis);
    7872
    7973  // check whether a single atom and molecule is selected
    80   if (World::getInstance().getSelectedMolecules().size() != 1)
    81     return Action::failure;
    82   mol = World::getInstance().beginMoleculeSelection()->second;
    83 
    84   // check whether Axis is valid
    85   if (Axis.IsZero())
     74  if ((World::getInstance().getSelectedAtoms().size() != 1) || (World::getInstance().getSelectedMolecules().size() != 1))
    8675    return Action::failure;
    8776
    88   // convert from degrees to radian
    89   alpha *= M_PI/180.;
     77  DoLog(0) && (Log() << Verbose(0) << "Rotate around self by " << alpha << "." << endl);
     78  mol = World::getInstance().beginMoleculeSelection()->second;
    9079
    9180  // Creation Line that is the rotation axis
    9281  Vector *CenterOfGravity = mol->DetermineCenterOfGravity();
    93   Line RotationAxis(*CenterOfGravity, Axis);
     82  Line RotationAxis(*CenterOfGravity, (World::getInstance().beginAtomSelection()->second)->x);
    9483  delete(CenterOfGravity);
    95   DoLog(0) && (Log() << Verbose(0) << "Rotate around self by " << alpha << " along " << RotationAxis << "." << endl);
    9684
    9785  for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     
    10088  DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    10189
    102   return Action::state_ptr(new MoleculeRotateAroundSelfByAngleState(mol, Axis, alpha));
     90  return Action::state_ptr(new MoleculeRotateAroundSelfByAngleState(mol, alpha));
    10391}
    10492
     
    10795
    10896  Vector *CenterOfGravity = state->mol->DetermineCenterOfGravity();
    109   Line RotationAxis(*CenterOfGravity, state->Axis);
     97  Line RotationAxis(*CenterOfGravity, (World::getInstance().beginAtomSelection()->second)->x);
    11098  delete(CenterOfGravity);
    11199
     
    121109
    122110  Vector *CenterOfGravity = state->mol->DetermineCenterOfGravity();
    123   Line RotationAxis(*CenterOfGravity, state->Axis);
     111  Line RotationAxis(*CenterOfGravity, (World::getInstance().beginAtomSelection()->second)->x);
    124112  delete(CenterOfGravity);
    125113
Note: See TracChangeset for help on using the changeset viewer.