src
rviz
tool_manager.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012, Willow Garage, Inc.
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
7
*
8
* * Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* * Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* * Neither the name of the Willow Garage, Inc. nor the names of its
14
* contributors may be used to endorse or promote products derived from
15
* this software without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
* POSSIBILITY OF SUCH DAMAGE.
28
*/
29
#ifndef TOOL_MANAGER_H
30
#define TOOL_MANAGER_H
31
32
#include <QList>
33
#include <QObject>
34
#include <QStringList>
35
36
#include "
rviz/pluginlib_factory.h
"
37
#include "
rviz/tool.h
"
38
#include "rviz/rviz_export.h"
39
40
class
QKeyEvent;
41
42
namespace
rviz
43
{
44
class
DisplayContext;
45
class
PropertyTreeModel;
46
class
RenderPanel;
47
48
class
RVIZ_EXPORT
ToolManager
:
public
QObject
49
{
50
Q_OBJECT
51
public
:
52
ToolManager
(
DisplayContext
* context);
53
~
ToolManager
()
override
;
54
57
void
initialize
();
58
59
void
load(
const
Config
&
config
);
60
void
save(
Config
config)
const
;
61
PropertyTreeModel
*
getPropertyModel
()
const
62
{
63
return
property_tree_model_;
64
}
65
67
Tool
* addTool(
const
QString& tool_class_lookup_name);
68
73
Tool
*
getCurrentTool
()
74
{
75
return
current_tool_;
76
}
77
83
Tool
* getTool(
int
index);
84
85
int
numTools
()
86
{
87
return
tools_.size();
88
}
89
void
removeTool(
int
index);
90
91
void
removeAll();
92
94
void
refreshTool(
Tool
* tool);
95
103
void
setCurrentTool(
Tool
* tool);
104
116
void
setDefaultTool(
Tool
* tool);
117
122
Tool
*
getDefaultTool
()
123
{
124
return
default_tool_;
125
}
126
127
QStringList getToolClasses();
128
129
void
handleChar(QKeyEvent* event,
RenderPanel
* panel);
130
131
PluginlibFactory<Tool>
*
getFactory
()
132
{
133
return
factory_;
134
}
135
136
Q_SIGNALS:
138
void
configChanged();
139
141
void
toolAdded(
Tool
*);
142
145
void
toolChanged(
Tool
*);
146
147
void
toolRemoved(
Tool
*);
148
150
void
toolRefreshed(
Tool
*);
151
152
private
Q_SLOTS:
155
void
updatePropertyVisibility(
Property
* property);
156
158
void
closeTool();
159
160
private
:
161
bool
toKey(QString
const
& str, uint& key_out);
162
PluginlibFactory<Tool>
*
factory_
;
163
PropertyTreeModel
*
property_tree_model_
;
164
QList<Tool*>
tools_
;
165
DisplayContext
*
context_
;
166
Tool
*
current_tool_
;
167
Tool
*
default_tool_
;
168
std::map<int, Tool*>
shortkey_to_tool_map_
;
169
};
170
171
}
// end namespace rviz
172
173
#endif // TOOL_MANAGER_H
rviz::ToolManager::factory_
PluginlibFactory< Tool > * factory_
Definition:
tool_manager.h:162
rviz::ToolManager::default_tool_
Tool * default_tool_
Definition:
tool_manager.h:167
pluginlib_factory.h
rviz::Tool
Definition:
tool.h:56
rviz::ToolManager::getPropertyModel
PropertyTreeModel * getPropertyModel() const
Definition:
tool_manager.h:61
initialize
ROSCONSOLE_DECL void initialize()
rviz::RenderPanel
Definition:
render_panel.h:74
rviz::Property
A single element of a property tree, with a name, value, description, and possibly children...
Definition:
property.h:100
config
config
rviz::ToolManager::getCurrentTool
Tool * getCurrentTool()
Return the tool currently in use.
Definition:
tool_manager.h:73
rviz
Definition:
add_display_dialog.cpp:54
rviz::ToolManager::numTools
int numTools()
Definition:
tool_manager.h:85
rviz::Config
Configuration data storage class.
Definition:
config.h:124
rviz::DisplayContext
Pure-virtual base class for objects which give Display subclasses context in which to work...
Definition:
display_context.h:81
rviz::ToolManager::shortkey_to_tool_map_
std::map< int, Tool * > shortkey_to_tool_map_
Definition:
tool_manager.h:168
rviz::ToolManager::tools_
QList< Tool * > tools_
Definition:
tool_manager.h:164
rviz::ToolManager::context_
DisplayContext * context_
Definition:
tool_manager.h:165
rviz::ToolManager::property_tree_model_
PropertyTreeModel * property_tree_model_
Definition:
tool_manager.h:163
rviz::PropertyTreeModel
Definition:
property_tree_model.h:38
rviz::ToolManager::current_tool_
Tool * current_tool_
Definition:
tool_manager.h:166
rviz::ToolManager::getFactory
PluginlibFactory< Tool > * getFactory()
Definition:
tool_manager.h:131
rviz::PluginlibFactory
Definition:
pluginlib_factory.h:51
rviz::ToolManager::getDefaultTool
Tool * getDefaultTool()
Get the default tool.
Definition:
tool_manager.h:122
rviz::ToolManager
Definition:
tool_manager.h:48
tool.h
rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Sat May 27 2023 02:06:25