| 1 | /*
|
|---|
| 2 | * PrincipalAxisSystemAction.cpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: May 12, 2010
|
|---|
| 5 | * Author: heber
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include "Helpers/MemDebug.hpp"
|
|---|
| 9 |
|
|---|
| 10 | #include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp"
|
|---|
| 11 | #include "Actions/ActionRegistry.hpp"
|
|---|
| 12 | #include "molecule.hpp"
|
|---|
| 13 | #include "Helpers/Log.hpp"
|
|---|
| 14 | #include "Helpers/Verbose.hpp"
|
|---|
| 15 |
|
|---|
| 16 | #include <iostream>
|
|---|
| 17 | #include <string>
|
|---|
| 18 |
|
|---|
| 19 | using namespace std;
|
|---|
| 20 |
|
|---|
| 21 | #include "UIElements/UIFactory.hpp"
|
|---|
| 22 | #include "UIElements/Dialog.hpp"
|
|---|
| 23 | #include "Actions/ValueStorage.hpp"
|
|---|
| 24 |
|
|---|
| 25 | const char AnalysisPrincipalAxisSystemAction::NAME[] = "principal-axis-system";
|
|---|
| 26 |
|
|---|
| 27 | AnalysisPrincipalAxisSystemAction::AnalysisPrincipalAxisSystemAction() :
|
|---|
| 28 | Action(NAME)
|
|---|
| 29 | {}
|
|---|
| 30 |
|
|---|
| 31 | AnalysisPrincipalAxisSystemAction::~AnalysisPrincipalAxisSystemAction()
|
|---|
| 32 | {}
|
|---|
| 33 |
|
|---|
| 34 | void AnalysisPrincipalAxisSystem() {
|
|---|
| 35 | ActionRegistry::getInstance().getActionByName(AnalysisPrincipalAxisSystemAction::NAME)->call(Action::NonInteractive);
|
|---|
| 36 | };
|
|---|
| 37 |
|
|---|
| 38 | Dialog* AnalysisPrincipalAxisSystemAction::fillDialog(Dialog *dialog) {
|
|---|
| 39 | ASSERT(dialog,"No Dialog given when filling action dialog");
|
|---|
| 40 |
|
|---|
| 41 | dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
|
|---|
| 42 |
|
|---|
| 43 | return dialog;
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | Action::state_ptr AnalysisPrincipalAxisSystemAction::performCall() {
|
|---|
| 47 | molecule *mol = NULL;
|
|---|
| 48 |
|
|---|
| 49 | ValueStorage::getInstance().queryCurrentValue(NAME, mol);
|
|---|
| 50 | DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl);
|
|---|
| 51 | for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
|
|---|
| 52 | molecule *mol = iter->second;
|
|---|
| 53 | mol->PrincipalAxisSystem(false);
|
|---|
| 54 | }
|
|---|
| 55 | return Action::success;
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | Action::state_ptr AnalysisPrincipalAxisSystemAction::performUndo(Action::state_ptr _state) {
|
|---|
| 59 | return Action::success;
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | Action::state_ptr AnalysisPrincipalAxisSystemAction::performRedo(Action::state_ptr _state){
|
|---|
| 63 | return Action::success;
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | bool AnalysisPrincipalAxisSystemAction::canUndo() {
|
|---|
| 67 | return true;
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | bool AnalysisPrincipalAxisSystemAction::shouldUndo() {
|
|---|
| 71 | return true;
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | const string AnalysisPrincipalAxisSystemAction::getName() {
|
|---|
| 75 | return NAME;
|
|---|
| 76 | }
|
|---|