From 88141b963c52ad9c5de6349504d93069239ef77c Mon Sep 17 00:00:00 2001
From: Fabian Reister <fabian.reister@kit.edu>
Date: Mon, 7 Jun 2021 08:12:23 +0200
Subject: [PATCH] arviz client: line element (coin classes already existed)

---
 .../RobotAPI/components/ArViz/CMakeLists.txt  |  3 ++
 .../components/ArViz/Client/elements/Line.cpp | 20 ++++++++++
 .../components/ArViz/Client/elements/Line.h   | 38 +++++++++++++++++++
 3 files changed, 61 insertions(+)
 create mode 100644 source/RobotAPI/components/ArViz/Client/elements/Line.cpp
 create mode 100644 source/RobotAPI/components/ArViz/Client/elements/Line.h

diff --git a/source/RobotAPI/components/ArViz/CMakeLists.txt b/source/RobotAPI/components/ArViz/CMakeLists.txt
index 62686bc88..9a5a3adcb 100644
--- a/source/RobotAPI/components/ArViz/CMakeLists.txt
+++ b/source/RobotAPI/components/ArViz/CMakeLists.txt
@@ -15,7 +15,9 @@ set(SOURCES
     Client/elements/Mesh.cpp
     Client/elements/Robot.cpp
     Client/elements/RobotHand.cpp
+    Client/elements/Line.cpp
     Client/elements/Path.cpp
+
     Client/drawer/ArVizDrawerBase.cpp
     Client/ScopedClient.cpp
 
@@ -80,6 +82,7 @@ set(HEADERS
     Client/elements/PointCloud.h
     Client/elements/Robot.h
     Client/elements/RobotHand.h
+    Client/elements/Line.h
     Client/elements/Path.h
 
     Client/drawer/ArVizDrawerBase.h
diff --git a/source/RobotAPI/components/ArViz/Client/elements/Line.cpp b/source/RobotAPI/components/ArViz/Client/elements/Line.cpp
new file mode 100644
index 000000000..985162f17
--- /dev/null
+++ b/source/RobotAPI/components/ArViz/Client/elements/Line.cpp
@@ -0,0 +1,20 @@
+#include "Line.h"
+
+#include "ArmarXCore/interface/core/BasicVectorTypesHelpers.h"
+
+namespace armarx::viz
+{
+    Line& Line::lineWidth(float w)
+    {
+        data_->lineWidth = w;
+
+        return *this;
+    }
+    Line& Line::fromTo(Eigen::Vector3f from, Eigen::Vector3f to)
+    {
+        data_->from = ToBasicVectorType(from);
+        data_->to   = ToBasicVectorType(to);
+
+        return *this;
+    }
+} // namespace armarx::viz
\ No newline at end of file
diff --git a/source/RobotAPI/components/ArViz/Client/elements/Line.h b/source/RobotAPI/components/ArViz/Client/elements/Line.h
new file mode 100644
index 000000000..6f6d9427e
--- /dev/null
+++ b/source/RobotAPI/components/ArViz/Client/elements/Line.h
@@ -0,0 +1,38 @@
+/*
+ * This file is part of ArmarX.
+ *
+ * ArmarX is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ArmarX is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @author     Fabian Reister ( fabian dot reister at kit dot edu )
+ * @date       2021
+ * @copyright  http://www.gnu.org/licenses/gpl-2.0.txt
+ *             GNU General Public License
+ */
+
+#pragma once
+
+#include "RobotAPI/components/ArViz/Client/elements/ElementOps.h"
+#include <RobotAPI/interface/ArViz/Elements.h>
+
+namespace armarx::viz
+{
+    class Line : public ElementOps<Line, data::ElementLine>
+    {
+    public:
+        using ElementOps::ElementOps;
+
+        Line& lineWidth(float w);
+
+        Line& fromTo(Eigen::Vector3f from, Eigen::Vector3f to);
+    };
+} // namespace armarx::viz
-- 
GitLab