- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.cpp
r90bc51 r2204b0 34 34 class MoleculeRotateAroundSelfByAngleState : public ActionState { 35 35 public: 36 MoleculeRotateAroundSelfByAngleState(molecule * const _mol, const Vector &_Axis, constdouble _alpha) :36 MoleculeRotateAroundSelfByAngleState(molecule * const _mol, const double _alpha) : 37 37 mol(_mol), 38 Axis(_Axis),39 38 alpha(_alpha) 40 39 {} 41 40 molecule* const mol; 42 Vector Axis;43 41 double alpha; 44 42 }; … … 53 51 {} 54 52 55 void MoleculeRotateAroundSelfByAngle( const Vector &Axis, constdouble angle) {53 void MoleculeRotateAroundSelfByAngle(double angle) { 56 54 ValueStorage::getInstance().setCurrentValue(MoleculeRotateAroundSelfByAngleAction::NAME, angle); 57 ValueStorage::getInstance().setCurrentValue("position", Axis);58 55 ActionRegistry::getInstance().getActionByName(MoleculeRotateAroundSelfByAngleAction::NAME)->call(Action::NonInteractive); 59 56 }; … … 63 60 64 61 dialog->queryDouble(NAME, MapOfActions::getInstance().getDescription(NAME)); 65 dialog->queryVector("position", false, MapOfActions::getInstance().getDescription(NAME));66 62 67 63 return dialog; … … 71 67 molecule *mol = NULL; 72 68 double alpha = 0.; 73 Vector Axis;74 69 75 // obtain angle a nd axis around which rotate70 // obtain angle around which rotate 76 71 ValueStorage::getInstance().queryCurrentValue(NAME, alpha); 77 ValueStorage::getInstance().queryCurrentValue("position", Axis);78 72 79 73 // 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)) 86 75 return Action::failure; 87 76 88 // convert from degrees to radian89 alpha *= M_PI/180.;77 DoLog(0) && (Log() << Verbose(0) << "Rotate around self by " << alpha << "." << endl); 78 mol = World::getInstance().beginMoleculeSelection()->second; 90 79 91 80 // Creation Line that is the rotation axis 92 81 Vector *CenterOfGravity = mol->DetermineCenterOfGravity(); 93 Line RotationAxis(*CenterOfGravity, Axis);82 Line RotationAxis(*CenterOfGravity, (World::getInstance().beginAtomSelection()->second)->x); 94 83 delete(CenterOfGravity); 95 DoLog(0) && (Log() << Verbose(0) << "Rotate around self by " << alpha << " along " << RotationAxis << "." << endl);96 84 97 85 for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) { … … 100 88 DoLog(0) && (Log() << Verbose(0) << "done." << endl); 101 89 102 return Action::state_ptr(new MoleculeRotateAroundSelfByAngleState(mol, Axis,alpha));90 return Action::state_ptr(new MoleculeRotateAroundSelfByAngleState(mol, alpha)); 103 91 } 104 92 … … 107 95 108 96 Vector *CenterOfGravity = state->mol->DetermineCenterOfGravity(); 109 Line RotationAxis(*CenterOfGravity, state->Axis);97 Line RotationAxis(*CenterOfGravity, (World::getInstance().beginAtomSelection()->second)->x); 110 98 delete(CenterOfGravity); 111 99 … … 121 109 122 110 Vector *CenterOfGravity = state->mol->DetermineCenterOfGravity(); 123 Line RotationAxis(*CenterOfGravity, state->Axis);111 Line RotationAxis(*CenterOfGravity, (World::getInstance().beginAtomSelection()->second)->x); 124 112 delete(CenterOfGravity); 125 113
Note:
See TracChangeset
for help on using the changeset viewer.