9 #include <RobotAPI/interface/aron/Aron.h>
11 #include "../../ColorPalettes.h"
38 size_t idx = (size_t)col;
39 xyzw_components.at(idx)->setText(
str.c_str());
40 highlightUnparsableEntries();
50 QTreeWidgetItem* currentItem) :
53 auto outerLayout =
new QHBoxLayout();
54 auto labelCol1 =
new QVBoxLayout();
55 auto labelCol2 =
new QVBoxLayout();
56 auto xzEdit =
new QVBoxLayout();
57 auto ywEdit =
new QVBoxLayout();
59 outerLayout->addLayout(labelCol1);
60 outerLayout->addLayout(xzEdit);
61 outerLayout->addLayout(labelCol2);
62 outerLayout->addLayout(ywEdit);
64 xyzw_components.reserve(4);
65 for (
size_t i = 0; i < 4; ++i)
67 xyzw_components.push_back(
new QLineEdit());
71 labelCol1->addWidget(
new QLabel(
"x"));
72 xzEdit->addWidget(xyzw_components.at(0));
74 labelCol2->addWidget(
new QLabel(
"z"));
75 ywEdit->addWidget(xyzw_components.at(2));
77 labelCol1->addWidget(
new QLabel(
"y"));
78 xzEdit->addWidget(xyzw_components.at(1));
80 labelCol2->addWidget(
new QLabel(
"w"));
81 ywEdit->addWidget(xyzw_components.at(3));
83 for (
const auto& el : xyzw_components)
86 connect(el, SIGNAL(editingFinished()),
this, SLOT(quaternionElementChanged())));
89 setLayout(outerLayout);
90 highlightUnparsableEntries();
94 QuaternionWidget::highlightUnparsableEntries()
97 for (
size_t i = 0; i < 4; ++i)
100 switch (element_type)
102 case armarx::aron::type::quaternion::FLOAT32:
108 case armarx::aron::type::quaternion::FLOAT64:
127 std::vector<unsigned char>
130 std::vector<unsigned char> res;
132 if (element_type == aron::type::quaternion::FLOAT32)
135 for (
size_t i = 0; i < 4; ++i)
138 NDArrayHelper::toByteVector<float>(xyzw_components.at(i)->text().toStdString());
140 res.insert(res.end(), bytevec.begin(), bytevec.end());
146 for (
size_t i = 0; i < 4; ++i)
148 auto bytevec = NDArrayHelper::toByteVector<double>(
149 xyzw_components.at(i)->text().toStdString());
151 res.insert(res.end(), bytevec.begin(), bytevec.end());
154 return (
success) ? res : std::vector<unsigned char>();
158 QuaternionWidget::quaternionElementChanged()
161 highlightUnparsableEntries();