Skip to content

Commit abbdd5b

Browse files
committed
[mc_rbdyn/gui] Use a single overload for all functions
1 parent c13b726 commit abbdd5b

File tree

5 files changed

+7
-57
lines changed

5 files changed

+7
-57
lines changed

include/mc_rbdyn/gui/RobotConvex.h

+3-18
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
#pragma once
66

77
#include <mc_rbdyn/Robot.h>
8+
89
#include <mc_rtc/gui/StateBuilder.h>
9-
#include "mc_rtc/gui/types.h"
10+
#include <mc_rtc/gui/types.h>
1011

1112
namespace mc_rbdyn::gui
1213
{
@@ -22,22 +23,6 @@ static const mc_rtc::gui::PolyhedronConfig defaultConvexConfig = []()
2223
return cfg;
2324
}();
2425

25-
/**
26-
* Helper function to create a GUI element from a convex object inside a robot
27-
*
28-
* \see void addConvexToGUI(mc_rtc::gui::StateBuilder &,
29-
const mc_rtc::gui::PolyhedronConfig &,
30-
const std::vector<std::string> &,
31-
const mc_rbdyn::Robot &,
32-
const std::string &,
33-
const std::optional<std::string> & publishName);
34-
*/
35-
MC_RBDYN_DLLAPI void addConvexToGUI(mc_rtc::gui::StateBuilder & gui,
36-
const std::vector<std::string> & category,
37-
const mc_rbdyn::Robot & robot,
38-
const std::string & name,
39-
const std::optional<std::string> & publishName = std::nullopt);
40-
4126
/** Helper function to create a GUI element from a convex object inside a robot
4227
*
4328
* \param gui State builder where the object is added (typically controller.gui()
@@ -55,9 +40,9 @@ MC_RBDYN_DLLAPI void addConvexToGUI(mc_rtc::gui::StateBuilder & gui,
5540
*/
5641
MC_RBDYN_DLLAPI void addConvexToGUI(mc_rtc::gui::StateBuilder & gui,
5742
const std::vector<std::string> & category,
58-
const mc_rtc::gui::PolyhedronConfig & cfg,
5943
const mc_rbdyn::Robot & robot,
6044
const std::string & name,
45+
const mc_rtc::gui::PolyhedronConfig & cfg = defaultConvexConfig,
6146
const std::optional<std::string> & publishName = std::nullopt);
6247

6348
} // namespace mc_rbdyn::gui

include/mc_rbdyn/gui/RobotSurface.h

+1-16
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,11 @@ static const mc_rtc::gui::LineConfig defaultSurfaceConfig = []() {
3434
*
3535
* \returns The names of the elements added by the function
3636
*/
37-
MC_RBDYN_DLLAPI std::vector<std::string> addSurfaceToGUI(mc_rtc::gui::StateBuilder & gui,
38-
const std::vector<std::string> & category,
39-
const mc_rtc::gui::LineConfig & cfg,
40-
const mc_rbdyn::Robot & robot,
41-
const std::string & name,
42-
const std::optional<std::string> & publishName = std::nullopt);
43-
44-
/** Helper function to create a GUI element from a surface object inside a robot
45-
*
46-
* \see std::vector<std::string> addSurfaceToGUI(mc_rtc::gui::StateBuilder &,
47-
const std::vector<std::string> &,
48-
const mc_rtc::gui::LineConfig &,
49-
const mc_rbdyn::Robot &,
50-
const std::string &,
51-
const std::optional<std::string> & publishName);
52-
*/
5337
MC_RBDYN_DLLAPI std::vector<std::string> addSurfaceToGUI(mc_rtc::gui::StateBuilder & gui,
5438
const std::vector<std::string> & category,
5539
const mc_rbdyn::Robot & robot,
5640
const std::string & name,
41+
const mc_rtc::gui::LineConfig & cfg = defaultSurfaceConfig,
5742
const std::optional<std::string> & publishName = std::nullopt);
5843

5944
} // namespace mc_rbdyn::gui

src/mc_rbdyn/gui/RobotConvex.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <mc_rtc/gui/Polyhedron.h>
66
#include <mc_rtc/gui/Sphere.h>
77

8-
#include "mc_rtc/gui/types.h"
98
#include <sch/S_Object/S_Box.h>
109
#include <sch/S_Object/S_Cylinder.h>
1110
#include <sch/S_Object/S_Sphere.h>
@@ -18,16 +17,7 @@ void addConvexToGUI(mc_rtc::gui::StateBuilder & gui,
1817
const std::vector<std::string> & category,
1918
const mc_rbdyn::Robot & robot,
2019
const std::string & name,
21-
const std::optional<std::string> & publishName)
22-
{
23-
addConvexToGUI(gui, category, defaultConvexConfig, robot, name, publishName);
24-
}
25-
26-
void addConvexToGUI(mc_rtc::gui::StateBuilder & gui,
27-
const std::vector<std::string> & category,
2820
const mc_rtc::gui::PolyhedronConfig & cfg,
29-
const mc_rbdyn::Robot & robot,
30-
const std::string & name,
3121
const std::optional<std::string> & publishName)
3222
{
3323
const auto & convex = robot.convex(name);

src/mc_rbdyn/gui/RobotSurface.cpp

+1-9
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,12 @@
66

77
namespace mc_rbdyn::gui
88
{
9-
std::vector<std::string> addSurfaceToGUI(mc_rtc::gui::StateBuilder & gui,
10-
const std::vector<std::string> & category,
11-
const mc_rbdyn::Robot & robot,
12-
const std::string & name,
13-
const std::optional<std::string> & publishName)
14-
{
15-
return addSurfaceToGUI(gui, category, defaultSurfaceConfig, robot, name, publishName);
16-
}
179

1810
std::vector<std::string> addSurfaceToGUI(mc_rtc::gui::StateBuilder & gui,
1911
const std::vector<std::string> & category,
20-
const mc_rtc::gui::LineConfig & cfg,
2112
const mc_rbdyn::Robot & robot,
2213
const std::string & name,
14+
const mc_rtc::gui::LineConfig & cfg,
2315
const std::optional<std::string> & publishName)
2416
{
2517
std::vector<std::string> out;

utils/RobotVisualizer.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
#include <mc_rtc/io_utils.h>
88

9-
#include "mc_rtc/gui/Form.h"
10-
#include "mc_rtc/gui/types.h"
119
#include <thread>
1210

1311
#ifdef MC_RTC_HAS_ROS
@@ -240,7 +238,7 @@ void RobotVisualizer::addSurface(const std::string & name)
240238
if(selected_surfaces[name]) { return; }
241239
selected_surfaces[name] = true;
242240
surfaces_elements[name] =
243-
mc_rbdyn::gui::addSurfaceToGUI(builder, {"Robot", "Surface objects"}, surfaceConfig, robots->robot(), name);
241+
mc_rbdyn::gui::addSurfaceToGUI(builder, {"Robot", "Surface objects"}, robots->robot(), name, surfaceConfig);
244242
}
245243

246244
void RobotVisualizer::removeSurface(const std::string & name)
@@ -254,7 +252,7 @@ void RobotVisualizer::addConvex(const std::string & name)
254252
{
255253
if(selected_convexes[name]) { return; }
256254
selected_convexes[name] = true;
257-
mc_rbdyn::gui::addConvexToGUI(builder, {"Robot", "Collision objects"}, convexConfig, robots->robot(), name);
255+
mc_rbdyn::gui::addConvexToGUI(builder, {"Robot", "Collision objects"}, robots->robot(), name, convexConfig);
258256
}
259257

260258
void RobotVisualizer::removeConvex(const std::string & name)

0 commit comments

Comments
 (0)