TreeTypedDataVisitor.cpp
Go to the documentation of this file.
1 #include "TreeTypedDataVisitor.h"
2 
3 #include <iomanip> // std::setprecision
4 
5 #include <SimoxUtility/algorithm/string.h>
6 
8 
12 
14 {
15 
16  /*void TreeTypedDataVisitor::streamValueText(const aron::data::Long& data, const aron::type::DateTime& type, std::stringstream& ss) const
17  {
18  (void) type;
19  armem::Time time { armem::Duration::MicroSeconds(data.getValue()) };
20  armem::toDateTimeMilliSeconds(time);
21  ss << armem::toDateTimeMilliSeconds(time);
22  }*/
23 
24  void
26  const aron::type::Matrix& type,
27  std::stringstream& ss) const
28  {
29  auto shape = data.getShape();
30 
31  // TODO: Remove hardcoded stuff
32  if (shape.size() == 3)
33  {
34  if (shape[0] == 3 && shape[1] == 1 && shape[2] == 4)
35  {
36  streamPositionText(data, type, ss);
37  return;
38  }
39 
40  if (shape[0] == 4 && shape[1] == 4 && shape[2] == 4)
41  {
42  streamPoseText(data, type, ss);
43  return;
44  }
45 
46  if (shape[0] == 4 && shape[1] == 1 && shape[2] == 4)
47  {
48  streamOrientationText(data, type, ss);
49  return;
50  }
51  }
53  }
54 
55  void
57  const aron::type::Matrix& type,
58  std::stringstream& ss) const
59  {
60  (void)type;
61  const Eigen::Matrix4f pose =
63  ss << std::setprecision(2) << std::fixed;
64  ss << pose.format(
65  Eigen::IOFormat(Eigen::StreamPrecision, 0, coeffSep, "\n", "", "", "", ""));
66  }
67 
68  void
70  const aron::type::Matrix& type,
71  std::stringstream& ss) const
72  {
73  (void)type;
74  const Eigen::Vector3f pos =
76  ss << std::setprecision(2) << std::fixed;
77  ss << pos.format(Eigen::IOFormat(Eigen::StreamPrecision, 0, "", coeffSep, "", "", "", ""));
78  }
79 
80  void
82  const aron::type::Matrix& type,
83  std::stringstream& ss) const
84  {
85  (void)type;
86  const Eigen::Quaternionf quat =
88  ss << std::setprecision(2) << std::fixed;
89  ss << quat.w() << coeffSep << "|" << coeffSep << quat.x() << coeffSep << quat.y()
90  << coeffSep << quat.z();
91  }
92 
93 } // namespace armarx::armem::gui::instance
armarx::armem::gui::instance::TreeTypedDataVisitor::streamOrientationText
void streamOrientationText(const aron::data::NDArray &data, const aron::type::Matrix &type, std::stringstream &ss) const
Definition: TreeTypedDataVisitor.cpp:81
armarx::aron::data::converter::AronEigenConverter::ConvertToMatrix4f
static Eigen::Matrix4f ConvertToMatrix4f(const data::NDArrayPtr &)
Definition: EigenConverter.cpp:57
armarx::aron::data::NDArray
Definition: NDArray.h:48
armarx::armem::gui::instance::TreeDataVisitorBase::streamValueText
void streamValueText(Navigator &n, std::stringstream &ss) const
Definition: TreeDataVisitorBase.h:61
armarx::armem::gui::instance::TreeTypedDataVisitor::streamPoseText
void streamPoseText(const aron::data::NDArray &data, const aron::type::Matrix &type, std::stringstream &ss) const
Definition: TreeTypedDataVisitor.cpp:56
core.h
armarx::armem::gui::instance
Definition: AronDataView.cpp:2
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
armarx::armem::gui::instance::TreeTypedDataVisitor::streamPositionText
void streamPositionText(const aron::data::NDArray &data, const aron::type::Matrix &type, std::stringstream &ss) const
Definition: TreeTypedDataVisitor.cpp:69
EigenConverter.h
armarx::aron::data::converter::AronEigenConverter::ConvertToQuaternionf
static Eigen::Quaternion< float > ConvertToQuaternionf(const data::NDArrayPtr &)
Definition: EigenConverter.cpp:33
ExpressionException.h
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
Exception.h
armarx::Quaternion< float, 0 >
TreeTypedDataVisitor.h
armarx::armem::gui::instance::TreeTypedDataVisitor::streamValueText
void streamValueText(const DataNavigatorT &data, const TypeNavigatorT &type, std::stringstream &ss) const
Definition: TreeTypedDataVisitor.h:244
armarx::armem::gui::instance::TreeTypedDataVisitor::coeffSep
std::string coeffSep
Definition: TreeTypedDataVisitor.h:260
armarx::aron::type::Matrix
The Matrix class.
Definition: Matrix.h:39
armarx::aron::data::converter::AronEigenConverter::ConvertToVector3f
static Eigen::Vector3f ConvertToVector3f(const data::NDArrayPtr &)
Definition: EigenConverter.cpp:45