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/SbRotation.h>
32 #include <Inventor/SbVec3f.h>
33 
34 // local
35 #include "../memoryxcontroller/MemoryXController.h"
36 #include "../scene3D/Scene.h"
37 #include "Operation.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  */
63  const std::shared_ptr<memoryxcontroller::MemoryXController>& memoryXController,
64  const std::shared_ptr<scene3D::Scene>& scene,
65  const std::string& objectId,
66  const SbRotation& oldRotation,
67  const SbRotation& newRotation,
68  const SbVec3f& oldPosition,
69  const SbVec3f& newPosition);
70 
71  /**
72  * Returns a new operation, which reverts the rotation and translatioon of the object.
73  *
74  * @return The operation, which reverts the rotation and translatioon of the object.
75  *
76  * @see controller::Operation::createInverseOperation
77  */
78  const OperationPtr createInverseOperation() const override;
79 
80  /**
81  * Returns true, if the SceneObject is mutable.
82  *
83  * @return true, if the SceneObject is mutable; false otherwise.
84  */
85  bool isExecuteable() override;
86 
87  protected:
88  /**
89  * Rotates and translates the object in the WorkingMemory.
90  *
91  * @see controller::Operation::executeOnWorkingMemory
92  */
93  void executeOnWorkingMemory() override;
94 
95  /**
96  * Rotates and translates the object in the Scene.
97  *
98  * @see controller::Operation::executeOnScene
99  */
100  void executeOnScene() override;
101 
102  private:
103  SbRotation oldRotation;
104  SbRotation newRotation;
105  SbVec3f oldPosition;
106  SbVec3f newPosition;
107  };
108 } // namespace controller
controller::RotateTranslateOperation::isExecuteable
bool isExecuteable() override
Returns true, if the SceneObject is mutable.
Definition: RotateTranslateOperation.cpp:96
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:52
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:73
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:66
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