Box.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <mc_rtc/gui/Visual.h>
4 #include <mc_rtc/visual_utils.h>
5 
6 namespace mc_rtc::gui
7 {
8 
19 template<typename GetPos, typename GetSize = const Eigen::Vector3d &, typename GetColor = const mc_rtc::gui::Color &>
20 auto Box(const std::string & name, GetSize size_fn, GetPos get_pos_fn, GetColor color_fn = mc_rtc::gui::Color::Red)
21 {
22  auto box =
24  auto get_visual_fn = [=]() mutable -> const rbd::parsers::Visual &
25  {
26  if constexpr(std::is_invocable_v<GetSize>) { mc_rtc::getVisualBox(box).size = size_fn(); }
27  if constexpr(std::is_invocable_v<GetColor>) { mc_rtc::details::setVisualColor(box, color_fn()); }
28  return box;
29  };
30  return Visual(name, get_visual_fn, get_pos_fn);
31 }
32 
33 } // namespace mc_rtc::gui
Visual.h
mc_rtc::gui::Color::Red
static const Color Red
Definition: types.h:102
mc_rtc::gui::details::GetValueOrCallbackValue
auto GetValueOrCallbackValue(const T &value_or_cb)
Definition: traits.h:231
visual_utils.h
mc_rtc::gui::Box
auto Box(const std::string &name, GetSize size_fn, GetPos get_pos_fn, GetColor color_fn=mc_rtc::gui::Color::Red)
Definition: Box.h:20
mc_rtc::details::setVisualColor
void setVisualColor(rbd::parsers::Visual &visual, const mc_rtc::gui::Color &color)
Definition: visual_utils.h:20
mc_rtc::gui::Visual
auto Visual(const std::string &name, GetVisual get_visual_fn, GetPos get_pos_fn)
Definition: Visual.h:64
mc_rtc::getVisualBox
constexpr auto getVisualBox
Definition: visual_utils.h:103
mc_rtc::makeVisualBox
rbd::parsers::Visual makeVisualBox(const Eigen::Vector3d &dim, const mc_rtc::gui::Color &color)
Definition: visual_utils.h:95
mc_rtc::gui
Definition: Observer.h:15