RotateTranslateOperation.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package MemoryX::gui-plugins::SceneEditor
19  * @date 2015
20  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21  * GNU General Public License
22  */
23 
24 #pragma once
25 
26 // std
27 #include <exception>
28 #include <string>
29 
30 // scene3D
31 #include <Inventor/SbVec3f.h>
32 #include <Inventor/SbRotation.h>
33 
34 // local
35 #include "../scene3D/Scene.h"
36 #include "Operation.h"
37 #include "../memoryxcontroller/MemoryXController.h"
38 
39 namespace controller
40 {
41  /**
42  * A operation to rotate and translate a object.
43  *
44  * @see controller::Operation
45  */
47  {
48  public:
49  /**
50  * Creates a new operation, which rotates and translates a object.
51  *
52  * @param memoryXController The MemoryXController to rotate and translate the object on.
53  * @param scene The scene to rotate and translate the object on.
54  * @param objectId The object to rotate and translate.
55  * @param oldRotation The old rotation of the object.
56  * @param newRotation The new rotation of the object.
57  * @param oldPosition The old position of the object.
58  * @param newPosition The new position of the object.
59  *
60  * @see controller::Operation::Operation
61  */
62  RotateTranslateOperation(const std::shared_ptr<memoryxcontroller::MemoryXController>& memoryXController, const std::shared_ptr<scene3D::Scene>& scene, const std::string& objectId, const SbRotation& oldRotation, const SbRotation& newRotation, const SbVec3f& oldPosition, const SbVec3f& newPosition);
63 
64  /**
65  * Returns a new operation, which reverts the rotation and translatioon of the object.
66  *
67  * @return The operation, which reverts the rotation and translatioon of the object.
68  *
69  * @see controller::Operation::createInverseOperation
70  */
71  const OperationPtr createInverseOperation() const override;
72 
73  /**
74  * Returns true, if the SceneObject is mutable.
75  *
76  * @return true, if the SceneObject is mutable; false otherwise.
77  */
78  bool isExecuteable() override;
79 
80  protected:
81  /**
82  * Rotates and translates the object in the WorkingMemory.
83  *
84  * @see controller::Operation::executeOnWorkingMemory
85  */
86  void executeOnWorkingMemory() override;
87 
88  /**
89  * Rotates and translates the object in the Scene.
90  *
91  * @see controller::Operation::executeOnScene
92  */
93  void executeOnScene() override;
94 
95  private:
96  SbRotation oldRotation;
97  SbRotation newRotation;
98  SbVec3f oldPosition;
99  SbVec3f newPosition;
100 
101  };
102 }
103 
controller::RotateTranslateOperation::isExecuteable
bool isExecuteable() override
Returns true, if the SceneObject is mutable.
Definition: RotateTranslateOperation.cpp:77
Operation.h
controller::RotateTranslateOperation::createInverseOperation
const OperationPtr createInverseOperation() const override
Returns a new operation, which reverts the rotation and translatioon of the object.
Definition: RotateTranslateOperation.cpp:44
controller::RotateTranslateOperation::RotateTranslateOperation
RotateTranslateOperation(const std::shared_ptr< memoryxcontroller::MemoryXController > &memoryXController, const std::shared_ptr< scene3D::Scene > &scene, const std::string &objectId, const SbRotation &oldRotation, const SbRotation &newRotation, const SbVec3f &oldPosition, const SbVec3f &newPosition)
Creates a new operation, which rotates and translates a object.
Definition: RotateTranslateOperation.cpp:35
controller
Definition: AddOperation.h:39
controller::RotateTranslateOperation::executeOnScene
void executeOnScene() override
Rotates and translates the object in the Scene.
Definition: RotateTranslateOperation.cpp:55
controller::OperationPtr
std::shared_ptr< Operation > OperationPtr
Definition: ClassDefinitions.h:54
controller::RotateTranslateOperation::executeOnWorkingMemory
void executeOnWorkingMemory() override
Rotates and translates the object in the WorkingMemory.
Definition: RotateTranslateOperation.cpp:50
controller::RotateTranslateOperation
A operation to rotate and translate a object.
Definition: RotateTranslateOperation.h:46
controller::Operation
An abstract class, which offers methods to run operations on the WorkingMemory and the Scene.
Definition: Operation.h:44