RemoveOperation.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
36#include "../scene3D/Scene.h"
37#include "AddOperation.h"
38#include "Operation.h"
39
40namespace controller
41{
42 /**
43 * A Operation to remove a object in the scene and the WorkingMemory.
44 *
45 * @see controller::Operation
46 */
48 {
49 friend class AddOperation;
50
51 public:
52 /**
53 * Creates a new operation, which removes a object.
54 *
55 * @param memoryXController The MemoryXController to remove the object at.
56 * @param scene The scene to remove the object at.
57 * @param objectId The ID of the object to remove.
58 *
59 * @see controller::Operation::Operation
60 */
62 const std::shared_ptr<memoryxcontroller::MemoryXController>& memoryXController,
63 const std::shared_ptr<scene3D::Scene>& scene,
64 const std::string& objectId);
65
66 /**
67 * Returns a new operation which adds the object again.
68 *
69 * @return The operation, which adds the object again.
70 *
71 * @see controller::Operation::createInverseOperation
72 */
73 const OperationPtr createInverseOperation() const override;
74
75 /**
76 * Returns true, if the SceneObject is mutable.
77 *
78 * @return true, if the SceneObject is mutable; false otherwise.
79 */
80 bool isExecuteable() override;
81
82 protected:
83 /**
84 * Removes the object from the WorkingMemory.
85 *
86 * @see controller::Operation::executeOnWorkingMemory
87 */
88 void executeOnWorkingMemory() override;
89
90 /**
91 * Removes the object from the local Scene.
92 *
93 * @see controller::Operation::executeOnScene
94 */
95 void executeOnScene() override;
96
97 private:
99 const std::shared_ptr<memoryxcontroller::MemoryXController>& memoryXController,
100 const std::shared_ptr<scene3D::Scene>& scene,
101 const std::string& objectName,
102 const std::string& objectCollection,
103 const SbVec3f& objectPosition,
104 const SbRotation& objectRotation,
105 const std::string& objectId);
106
107 std::string objectName;
108 std::string objectCollection;
109 SbVec3f objectPosition;
110 SbRotation objectRotation;
111 };
112} // namespace controller
Operation(const std::shared_ptr< memoryxcontroller::MemoryXController > &memoryXController, const std::shared_ptr< scene3D::Scene > &scene, const std::string &objectId)
A constructor.
Definition Operation.cpp:26
bool isExecuteable() override
Returns true, if the SceneObject is mutable.
const OperationPtr createInverseOperation() const override
Returns a new operation which adds the object again.
void executeOnScene() override
Removes the object from the local Scene.
void executeOnWorkingMemory() override
Removes the object from the WorkingMemory.
RemoveOperation(const std::shared_ptr< memoryxcontroller::MemoryXController > &memoryXController, const std::shared_ptr< scene3D::Scene > &scene, const std::string &objectId)
Creates a new operation, which removes a object.
std::shared_ptr< Operation > OperationPtr