25 #include <SimoxUtility/math/convert/quat_to_rpy.h>
26 #include <SimoxUtility/math/convert/rpy_to_quat.h>
38 #define INPUT_GUARD(i) \
40 ARMARX_CHECK_NOT_NULL(i); \
52 if (dict->getPath().hasElement())
55 group_hierarchy_.emplace_back(std::make_shared<RemoteGui::detail::GroupBoxBuilder>(
60 group_hierarchy_.push_back(builder_);
68 auto builder = *group_hierarchy_.back();
69 group_hierarchy_.pop_back();
70 if (!group_hierarchy_.empty())
72 group_hierarchy_.back()->addChild(builder);
90 group_hierarchy_.back()->addChild(group);
107 group_hierarchy_.back()->addChild(group);
124 group_hierarchy_.back()->addChild(group);
138 group_hierarchy_.back()->addChild(group);
152 group_hierarchy_.back()->addChild(group);
156 builder_(
std::make_unique<RemoteGui::
detail::GroupBoxBuilder>(name))
172 if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) !=
173 implementedListDescriptors.end())
178 for (
const auto& el :
data->getElements())
186 .toolTip(
"Remove List Element"),
189 group_hierarchy_.back()->addChild(
191 .label(o->getPath().getLastElement())
196 .toolTip(
"Add new list entry.")));
201 group_hierarchy_.emplace_back(std::make_shared<RemoteGui::detail::GroupBoxBuilder>(
213 if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) !=
214 implementedListDescriptors.end())
219 auto builder = *group_hierarchy_.back();
220 group_hierarchy_.pop_back();
221 if (not group_hierarchy_.empty())
223 group_hierarchy_.back()->addChild(builder);
239 .options(type->getAcceptedValueNames())
240 .
value(type->getValueName(
data->getValue()))
242 group_hierarchy_.back()->addChild(group);
247 const std::shared_ptr<type::Variant>& t)
251 const auto& cols = type->getCols();
252 const auto& rows = type->getRows();
258 if (cols == 4 and rows == 4)
264 else if ((cols == 3 and rows == 1) or (rows == 3 and cols == 1))
270 group_hierarchy_.back()->addChild(group);
275 const std::shared_ptr<type::Variant>& t)
280 const auto& quat = simox::math::quat_to_rpy(
293 group_hierarchy_.back()->addChild(group);
298 const std::shared_ptr<type::Variant>& t)
304 if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) ==
305 implementedListDescriptors.end())
309 for (
const auto& el :
data->getElements())
320 .
toolTip(
"Remove List Element"),
323 group_hierarchy_.back()->addChild(
325 .label(o->getPath().getLastElement())
330 .toolTip(
"Add new dict entry.")));
335 const std::shared_ptr<type::Variant>&)
351 auto gui_value = proxy_->getValue<
int>(name);
352 if (
value->getValue() != gui_value.get())
354 if (proxy_->hasValueChanged(name))
356 value->setValue(gui_value.get());
361 proxy_->setValue(
value->getValue(), name);
372 auto gui_value = proxy_->getValue<
float>(name);
373 if (
value->getValue() != gui_value.get())
375 if (proxy_->hasValueChanged(name))
377 value->setValue(gui_value.get());
382 proxy_->setValue(
value->getValue(), name);
394 auto gui_value = proxy_->getValue<
float>(name);
395 if (
value->getValue() != gui_value.get())
397 if (proxy_->hasValueChanged(name))
399 value->setValue(gui_value.get());
404 proxy_->setValue(
static_cast<float>(
value->getValue()), name);
415 auto gui_value = proxy_->getValue<
bool>(name);
416 if (
value->getValue() != gui_value.get())
418 if (proxy_->hasValueChanged(name))
420 value->setValue(gui_value.get());
425 proxy_->setValue(
value->getValue(), name);
436 auto gui_value = proxy_->getValue<std::string>(name);
437 if (
value->getValue() != gui_value.get())
439 if (proxy_->hasValueChanged(name))
441 value->setValue(gui_value.get());
446 proxy_->setValue(
value->getValue(), name);
496 if (
data->getValue() != type->getValue(
str))
498 if (proxy_->hasValueChanged(name))
500 data->getValue() = type->getValue(
str);
505 proxy_->setValue(type->getValueName(
data->getValue()), name);
517 if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) !=
518 implementedListDescriptors.end())
522 const auto& elements =
data->getElements();
525 if (proxy_->getButtonClicked(
pathToName(el) +
"_button"))
527 data->removeElement(idx);
528 tab_rebuild_required_ =
true;
530 auto gui_value = proxy_->getValue<std::string>(
pathToName(el)).get();
533 if (proxy_->getButtonClicked(
pathToName(o) +
"_add"))
536 "", o->getPath().withIndex(
data->childrenSize())));
537 tab_rebuild_required_ =
true;
554 if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) !=
555 implementedListDescriptors.end())
568 return tab_rebuild_required_;
573 const std::shared_ptr<type::Variant>& t)
579 const auto& cols = type->getCols();
580 const auto& rows = type->getRows();
582 if (cols == 4 && rows == 4)
587 if (config_value != gui_value.get())
589 if (proxy_->hasValueChanged(name))
593 value->setData(gui_value.get().size() *
sizeof(
float), variant->getData());
597 proxy_->setValue(config_value, name);
601 else if ((cols == 3 and rows == 1) or (cols == 1 and rows == 3))
603 auto gui_value = proxy_->getValue<Eigen::Vector3f>(name);
606 if (config_value != gui_value.get())
608 if (proxy_->hasValueChanged(name))
612 value->setData(gui_value.get().size() *
sizeof(
float), variant->getData());
616 proxy_->setValue(config_value, name);
624 const std::shared_ptr<type::Variant>& t)
630 auto gui_value = proxy_->getValue<Eigen::Vector3f>(name);
631 const auto& quat = simox::math::quat_to_rpy(
633 if (quat != gui_value.get())
635 if (proxy_->hasValueChanged(name))
638 simox::math::rpy_to_quat(gui_value.get()));
639 value->setData(4 *
sizeof(
float), variant->getData());
643 proxy_->setValue(quat, name);
650 const std::shared_ptr<type::Variant>& t)
655 if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) ==
656 implementedListDescriptors.end())
660 const auto& elements =
data->getElements();
661 std::map<std::string, std::string> changed_labels;
662 for (
const auto& [idx, el] : elements)
665 if (proxy_->getButtonClicked(name +
"_button"))
667 data->removeElement(idx);
668 tab_rebuild_required_ =
true;
670 auto gui_value = proxy_->getValue<std::string>(name).get();
671 auto gui_key = proxy_->getValue<std::string>(name +
"_lbl").get();
673 if (gui_value != config_value)
675 if (proxy_->hasValueChanged(name))
681 proxy_->setValue(config_value, name);
686 if (proxy_->hasValueChanged(name +
"_lbl"))
688 changed_labels.emplace(idx, gui_key);
692 proxy_->setValue(idx, name +
"_lbl");
697 for (
const auto& [old_label, new_label] : changed_labels)
699 auto element =
data->getElement(old_label);
700 data->removeElement(old_label);
702 data->addElement(new_label,
703 variantHelper->from_string(
704 variantHelper->to_string(element),
705 o->getPath().withDetachedLastElement().withElement(new_label)));
706 tab_rebuild_required_ =
true;
709 if (proxy_->getButtonClicked(
pathToName(o) +
"_add"))
711 data->addElement(
"defaultKey",
713 "", o->getPath().withElement(
"defaultKey")));
714 tab_rebuild_required_ =
true;
720 const std::shared_ptr<type::Variant>&)