SceneSelectionManager.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#include <vector>
27
28#include "Scene.h"
29#include "SceneGroup.h"
30#include "SceneObject.h"
31#include <Inventor/SoPath.h>
32#include <Inventor/SoPickedPoint.h>
33
34namespace scene3D
35{
37 {
38
39 friend class Scene;
40
41 public:
42 /**
43 * Constructor
44 * Creates an Instance of the Class.
45 *
46 * @param scene Existing Scene
47 */
49
50 /**
51 * Returns all selected SceneObjects.
52 *
53 * @return vector<scene3D::SceneObjectPtr > Vector of all selected SceneObjects
54 */
55 std::vector<scene3D::SceneObjectPtr> getAllSelected();
56
57 /**
58 * Determines whether a SceneObject is selected.
59 *
60 * @param object SceneObject to check
61 * @return bool SceneObject is selected?
62 */
64
65 /**
66 * Adds a SceneObject to the Selection.
67 *
68 * @param object SceneObject to be added
69 */
71
72 /**
73 * Removes a SceneObject from the Selection.
74 *
75 * @param object SceneObject to be removed
76 */
78
79 /**
80 * Adds a SceneGroup to the Selection.
81 *
82 * @param group SceneGroup to be added
83 */
85
86 /**
87 * Removes a SceneGroup from the Selection.
88 *
89 * @param group SceneGroup to be removed
90 */
92
93 /**
94 * Deselects all SceneObjects.
95 *
96 */
97 void deselectAll();
98
99 /**
100 * Executes all commands when an Item is selected and the Callback is voked.
101 *
102 * @param userData UserData
103 * @param selectionPath Path of selected Object
104 */
105 static void selectionCallback(void* userData, SoPath* selectionPath);
106 /**
107 * Executes all commands when an Item is deselected and the Callback is voked.
108 *
109 * @param userData UserData
110 * @param selectionPath Path of deselected Object
111 */
112 static void deselectionCallback(void* userData, SoPath* selectionPath);
113 /**
114 * Adjusts a path so that it always show to a valid Object.
115 *
116 * @param userData UserData
117 * @param pick The Point picked in the Scene
118 * @return SoPath New adjusted Path
119 */
120 static SoPath* pickFilterCB(void* userData, const SoPickedPoint* pick);
121
122 void setCreateOperations(bool enable);
123 bool getCreateOperations();
124
125 private:
126 SceneWeakPtr scene;
127 static bool createOperations;
128 std::vector<scene3D::SceneObjectPtr> historySelected;
129
130 void storeHistory();
131
132 void restoreHistory();
133
134 scene3D::SceneObjectPtr getLastSelected();
135 };
136} // namespace scene3D
void deselectAll()
Deselects all SceneObjects.
static void deselectionCallback(void *userData, SoPath *selectionPath)
Executes all commands when an Item is deselected and the Callback is voked.
static SoPath * pickFilterCB(void *userData, const SoPickedPoint *pick)
Adjusts a path so that it always show to a valid Object.
void addToSelection(scene3D::SceneObjectPtr object)
Adds a SceneObject to the Selection.
SceneSelectionManager(ScenePtr scene)
Constructor Creates an Instance of the Class.
bool isSelected(scene3D::SceneObjectPtr object)
Determines whether a SceneObject is selected.
static void selectionCallback(void *userData, SoPath *selectionPath)
Executes all commands when an Item is selected and the Callback is voked.
std::vector< scene3D::SceneObjectPtr > getAllSelected()
Returns all selected SceneObjects.
void removeFromSelection(scene3D::SceneObjectPtr object)
Removes a SceneObject from the Selection.
std::weak_ptr< Scene > SceneWeakPtr
std::shared_ptr< Scene > ScenePtr
boost::intrusive_ptr< SceneObject > SceneObjectPtr
std::shared_ptr< SceneGroup > SceneGroupPtr