GuiIface.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17#ifndef _GAZEBO_GUIIFACE_HH_
18#define _GAZEBO_GUIIFACE_HH_
19
20#include <string>
21#include <boost/property_tree/ptree.hpp>
22#include <boost/filesystem.hpp>
24#include "gazebo/util/system.hh"
25
26extern GZ_GUI_VISIBLE boost::property_tree::ptree g_propTree;
27namespace gazebo
28{
29 namespace gui
30 {
31 class MainWindow;
32
35 GZ_GUI_VISIBLE
36 bool load();
37
38 GZ_GUI_VISIBLE
39 void init();
40
41 GZ_GUI_VISIBLE
42 bool run(int _argc, char **_argv);
43 GZ_GUI_VISIBLE
44 void stop();
45
46 GZ_GUI_VISIBLE
47 void set_world(const std::string& _name);
48 GZ_GUI_VISIBLE
49 std::string get_world();
50
51 GZ_GUI_VISIBLE
53 GZ_GUI_VISIBLE
55 GZ_GUI_VISIBLE
57
59 GZ_GUI_VISIBLE
61
62 GZ_GUI_VISIBLE
63 unsigned int get_entity_id(const std::string &_name);
64 GZ_GUI_VISIBLE
65 bool has_entity_name(const std::string &_name);
66
69 GZ_GUI_VISIBLE
71
82 GZ_GUI_VISIBLE
83 bool loadINI(boost::filesystem::path _file = "");
84
89 template<typename T>
90 T getINIProperty(const std::string &_key, const T &_default)
91 {
92 try
93 {
94 return g_propTree.get<T>(_key);
95 }
96 catch(...)
97 {
98 }
99
100 return _default;
101 }
102
108 template<typename T>
109 bool setINIProperty(const std::string &_key, const T &_value)
110 {
111 g_propTree.put(_key, _value);
112 return true;
113 }
114
118 GZ_GUI_VISIBLE
119 bool saveINI(const boost::filesystem::path &_file);
120 }
121}
122#endif
boost::property_tree::ptree g_propTree
gui
Definition KeyEventHandler.hh:29
Definition MainWindow.hh:44
std::string get_world()
void clear_active_camera()
bool load()
Load the graphical interface.
bool register_metatypes()
Register the Qt metatypes.
bool has_entity_name(const std::string &_name)
void set_active_camera(rendering::UserCameraPtr _cam)
T getINIProperty(const std::string &_key, const T &_default)
Get a property from the GUI INI file.
Definition GuiIface.hh:90
bool loadINI(boost::filesystem::path _file="")
Locate and load the INI configuration file.
unsigned int get_entity_id(const std::string &_name)
MainWindow * get_main_window()
Return a pointer to the main graphical window.
bool run(int _argc, char **_argv)
bool setINIProperty(const std::string &_key, const T &_value)
Set a value in the INI property tree.
Definition GuiIface.hh:109
rendering::UserCameraPtr get_active_camera()
void set_world(const std::string &_name)
bool saveINI(const boost::filesystem::path &_file)
Save the configuration parameters to file.
boost::shared_ptr< UserCamera > UserCameraPtr
Definition RenderTypes.hh:94
Forward declarations for the common classes.
Definition Animation.hh:27