Vector3fWidgets.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Basic.h"
4 
6 {
7  template <typename Derived>
8  struct Vector3fMinMaxMixin : MinMaxMixin<Derived, Eigen::Vector3f>
9  {
11 
12  Derived& steps(const Eigen::Vector3i steps)
13  {
14  Derived& this_ = *static_cast<Derived*>(this);
15  this_.widget().steps = toIceI(steps);
16  return this_;
17  }
18 
19  using Base::min;
20  using Base::max;
21 
22  Derived& min(float v)
23  {
24  return Base::min({v, v, v});
25  }
26  Derived& min(std::array<float, 1> v)
27  {
28  return min(v.at(0));
29  }
30 
31  Derived& max(float v)
32  {
33  return Base::max({v, v, v});
34  }
35  Derived& max(std::array<float, 1> v)
36  {
37  return max(v.at(0));
38  }
39 
40  Derived& steps(int v)
41  {
42  return steps(v, v, v);
43  }
44  Derived& steps(std::array<int, 1> v)
45  {
46  return steps(v.at(0));
47  }
48 
49  Derived& min(float x, float y, float z)
50  {
51  return Base::min(Eigen::Vector3f{x, y, z});
52  }
53  Derived& min(std::array<float, 3> v)
54  {
55  return min(v.at(0), v.at(1), v.at(2));
56  }
57 
58  Derived& max(float x, float y, float z)
59  {
60  return Base::max(Eigen::Vector3f{x, y, z});
61  }
62  Derived& max(std::array<float, 3> v)
63  {
64  return max(v.at(0), v.at(1), v.at(2));
65  }
66 
67  Derived& steps(int x, int y, int z)
68  {
69  return steps(Eigen::Vector3i{x, y, z});
70  }
71  Derived& steps(std::array<int, 3> v)
72  {
73  return steps(v.at(0), v.at(1), v.at(2));
74  }
75  };
76 
78  : public ValueMixin<Vector3fSpinBoxes, Eigen::Vector3f, Vector3fSpinBoxesBuilder>
79  , public Vector3fMinMaxMixin<Vector3fSpinBoxesBuilder>
80  , public ToolTipMixin<Vector3fSpinBoxesBuilder>
81  {
82  Vector3fSpinBoxesBuilder(std::string const& name, float limpos = 1000) : ValueMixin(name)
83  {
84  widget().steps = toIceI(Eigen::Vector3i::Ones() * static_cast<int>(2 * limpos + 1));
85  widget().decimals = toIceI(Eigen::Vector3i::Ones());
86  widget().min = toIceF(Eigen::Vector3f::Ones() * -limpos);
87  widget().max = toIceF(Eigen::Vector3f::Ones() * +limpos);
88  widget().defaultValue = makeValue(Eigen::Vector3f{Eigen::Vector3f::Zero()});
89  }
90 
91  Vector3fSpinBoxesBuilder& decimals(const Eigen::Vector3i decimals)
92  {
93  widget().decimals = toIceI(decimals);
94  return *this;
95  }
96  Vector3fSpinBoxesBuilder& decimals(int x, int y, int z)
97  {
98  return decimals(Eigen::Vector3i(x, y, z));
99  }
101  {
102  return decimals(Eigen::Vector3i(d, d, d));
103  }
104  Vector3fSpinBoxesBuilder& decimals(std::array<int, 1> d)
105  {
106  return decimals(d.at(0));
107  }
108  };
109 }
110 
111 namespace armarx::RemoteGui
112 {
113  inline detail::Vector3fSpinBoxesBuilder makeVector3fSpinBoxes(std::string const& name, float limpos = 1000)
114  {
115  return {name, limpos};
116  }
117 }
118 
armarx::RemoteGui::detail::Vector3fMinMaxMixin::steps
Derived & steps(std::array< int, 3 > v)
Definition: Vector3fWidgets.h:71
armarx::RemoteGui::detail::Vector3fMinMaxMixin::max
Derived & max(float x, float y, float z)
Definition: Vector3fWidgets.h:58
armarx::RemoteGui::detail::MinMaxMixin< Derived, Eigen::Vector3f >
Definition: Basic.h:153
armarx::RemoteGui::toIceF
Vector3f toIceF(Eigen::Vector3f v)
Definition: Storage.cpp:73
armarx::RemoteGui::makeVector3fSpinBoxes
detail::Vector3fSpinBoxesBuilder makeVector3fSpinBoxes(std::string const &name, float limpos=1000)
Definition: Vector3fWidgets.h:113
Basic.h
armarx::RemoteGui::detail::Vector3fMinMaxMixin::min
Derived & min(float x, float y, float z)
Definition: Vector3fWidgets.h:49
armarx::RemoteGui
Definition: LightweightRemoteGuiComponentPlugin.h:30
armarx::RemoteGui::detail
Definition: Basic.h:10
armarx::RemoteGui::detail::MinMaxMixin
Definition: Basic.h:86
armarx::RemoteGui::detail::Vector3fSpinBoxesBuilder
Definition: Vector3fWidgets.h:77
armarx::RemoteGui::detail::Vector3fSpinBoxesBuilder::decimals
Vector3fSpinBoxesBuilder & decimals(const Eigen::Vector3i decimals)
Definition: Vector3fWidgets.h:91
armarx::RemoteGui::detail::Vector3fMinMaxMixin::min
Derived & min(float v)
Definition: Vector3fWidgets.h:22
armarx::RemoteGui::detail::WidgetMixin::widget
WidgetT & widget()
Definition: Basic.h:50
armarx::RemoteGui::detail::Vector3fSpinBoxesBuilder::decimals
Vector3fSpinBoxesBuilder & decimals(std::array< int, 1 > d)
Definition: Vector3fWidgets.h:104
armarx::RemoteGui::toIceI
Vector3i toIceI(Eigen::Vector3i v)
Definition: Storage.cpp:82
armarx::RemoteGui::detail::Vector3fMinMaxMixin::max
Derived & max(std::array< float, 3 > v)
Definition: Vector3fWidgets.h:62
armarx::RemoteGui::detail::Vector3fSpinBoxesBuilder::Vector3fSpinBoxesBuilder
Vector3fSpinBoxesBuilder(std::string const &name, float limpos=1000)
Definition: Vector3fWidgets.h:82
armarx::RemoteGui::detail::Vector3fSpinBoxesBuilder::decimals
Vector3fSpinBoxesBuilder & decimals(int x, int y, int z)
Definition: Vector3fWidgets.h:96
armarx::RemoteGui::detail::Vector3fMinMaxMixin::min
Derived & min(std::array< float, 1 > v)
Definition: Vector3fWidgets.h:26
armarx::RemoteGui::detail::ToolTipMixin
Definition: Basic.h:200
armarx::RemoteGui::makeValue
ValueVariant makeValue(bool value)
Definition: Storage.cpp:133
armarx::RemoteGui::detail::Vector3fMinMaxMixin::steps
Derived & steps(const Eigen::Vector3i steps)
Definition: Vector3fWidgets.h:12
armarx::RemoteGui::detail::Vector3fMinMaxMixin::steps
Derived & steps(int v)
Definition: Vector3fWidgets.h:40
armarx::ctrlutil::v
double v(double t, double v0, double a0, double j)
Definition: CtrlUtil.h:39
armarx::RemoteGui::detail::Vector3fSpinBoxesBuilder::decimals
Vector3fSpinBoxesBuilder & decimals(int d)
Definition: Vector3fWidgets.h:100
armarx::RemoteGui::detail::MinMaxMixin< Derived, Eigen::Vector3f >::max
Derived & max(Type max)
Definition: Basic.h:168
armarx::RemoteGui::detail::Vector3fMinMaxMixin::steps
Derived & steps(std::array< int, 1 > v)
Definition: Vector3fWidgets.h:44
armarx::RemoteGui::detail::Vector3fMinMaxMixin
Definition: Vector3fWidgets.h:8
armarx::RemoteGui::detail::Vector3fMinMaxMixin::max
Derived & max(float v)
Definition: Vector3fWidgets.h:31
armarx::RemoteGui::detail::Vector3fMinMaxMixin::min
Derived & min(std::array< float, 3 > v)
Definition: Vector3fWidgets.h:53
armarx::RemoteGui::detail::Vector3fMinMaxMixin::steps
Derived & steps(int x, int y, int z)
Definition: Vector3fWidgets.h:67
armarx::RemoteGui::detail::ValueMixin
Definition: Basic.h:68
armarx::RemoteGui::detail::MinMaxMixin< Derived, Eigen::Vector3f >::min
Derived & min(Type min)
Definition: Basic.h:157
armarx::RemoteGui::detail::Vector3fMinMaxMixin::max
Derived & max(std::array< float, 1 > v)
Definition: Vector3fWidgets.h:35