[bcf653] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
| 4 | * Copyright (C) 2010 University of Bonn. All rights reserved.
|
---|
| 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[97ebf8] | 8 | /*
|
---|
| 9 | * BoundInBoxAction.cpp
|
---|
| 10 | *
|
---|
| 11 | * Created on: May 8, 2010
|
---|
| 12 | * Author: heber
|
---|
| 13 | */
|
---|
| 14 |
|
---|
[bf3817] | 15 | // include config.h
|
---|
| 16 | #ifdef HAVE_CONFIG_H
|
---|
| 17 | #include <config.h>
|
---|
| 18 | #endif
|
---|
| 19 |
|
---|
[112b09] | 20 | #include "Helpers/MemDebug.hpp"
|
---|
| 21 |
|
---|
[97ebf8] | 22 | #include "Actions/WorldAction/BoundInBoxAction.hpp"
|
---|
[0430e3] | 23 | #include "Actions/ActionRegistry.hpp"
|
---|
[952f38] | 24 | #include "Helpers/Log.hpp"
|
---|
[97ebf8] | 25 | #include "molecule.hpp"
|
---|
| 26 | #include "World.hpp"
|
---|
| 27 |
|
---|
| 28 | #include <iostream>
|
---|
| 29 | #include <string>
|
---|
| 30 | #include <vector>
|
---|
| 31 |
|
---|
| 32 | using namespace std;
|
---|
| 33 |
|
---|
| 34 | #include "UIElements/UIFactory.hpp"
|
---|
| 35 | #include "UIElements/Dialog.hpp"
|
---|
[861874] | 36 | #include "Actions/ValueStorage.hpp"
|
---|
[97ebf8] | 37 |
|
---|
| 38 | const char WorldBoundInBoxAction::NAME[] = "bound-in-box";
|
---|
| 39 |
|
---|
| 40 | WorldBoundInBoxAction::WorldBoundInBoxAction() :
|
---|
| 41 | Action(NAME)
|
---|
| 42 | {}
|
---|
| 43 |
|
---|
| 44 | WorldBoundInBoxAction::~WorldBoundInBoxAction()
|
---|
| 45 | {}
|
---|
| 46 |
|
---|
[a8f6ae] | 47 | void WorldBoundInBox() {
|
---|
| 48 | ActionRegistry::getInstance().getActionByName(WorldBoundInBoxAction::NAME)->call(Action::NonInteractive);
|
---|
| 49 | };
|
---|
| 50 |
|
---|
[0b2ce9] | 51 | void WorldBoundInBoxAction::getParametersfromValueStorage()
|
---|
| 52 | {};
|
---|
| 53 |
|
---|
[047878] | 54 | Dialog* WorldBoundInBoxAction::fillDialog(Dialog *dialog) {
|
---|
| 55 | ASSERT(dialog,"No Dialog given when filling action dialog");
|
---|
[97ebf8] | 56 |
|
---|
[805636] | 57 | dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
|
---|
| 58 |
|
---|
| 59 | return dialog;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | Action::state_ptr WorldBoundInBoxAction::performCall() {
|
---|
| 63 |
|
---|
| 64 | // center
|
---|
| 65 | vector<molecule*> AllMolecules = World::getInstance().getAllMolecules();
|
---|
| 66 | for (vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {
|
---|
| 67 | (*MolRunner)->BoundInBox();
|
---|
[97ebf8] | 68 | }
|
---|
[805636] | 69 | return Action::success;
|
---|
[97ebf8] | 70 | }
|
---|
| 71 |
|
---|
| 72 | Action::state_ptr WorldBoundInBoxAction::performUndo(Action::state_ptr _state) {
|
---|
| 73 | // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
|
---|
| 74 |
|
---|
| 75 | return Action::failure;
|
---|
| 76 | // string newName = state->mol->getName();
|
---|
| 77 | // state->mol->setName(state->lastName);
|
---|
| 78 | //
|
---|
| 79 | // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | Action::state_ptr WorldBoundInBoxAction::performRedo(Action::state_ptr _state){
|
---|
| 83 | return Action::failure;
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | bool WorldBoundInBoxAction::canUndo() {
|
---|
| 87 | return false;
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | bool WorldBoundInBoxAction::shouldUndo() {
|
---|
| 91 | return false;
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | const string WorldBoundInBoxAction::getName() {
|
---|
| 95 | return NAME;
|
---|
| 96 | }
|
---|