From b7407d85dedb57acc7653a7bc6f9eb072c5e807c Mon Sep 17 00:00:00 2001 From: Fabian Reister <fabian.reister@kit.edu> Date: Fri, 11 Jun 2021 07:23:34 +0200 Subject: [PATCH] Arviz Path element: simplified implementation; removed lineColor --- .../components/ArViz/Client/elements/Path.cpp | 30 +++++++++---------- .../components/ArViz/Client/elements/Path.h | 12 +------- source/RobotAPI/interface/ArViz/Elements.ice | 1 - 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/source/RobotAPI/components/ArViz/Client/elements/Path.cpp b/source/RobotAPI/components/ArViz/Client/elements/Path.cpp index 0a88d0893..cf5e9899e 100644 --- a/source/RobotAPI/components/ArViz/Client/elements/Path.cpp +++ b/source/RobotAPI/components/ArViz/Client/elements/Path.cpp @@ -1,27 +1,21 @@ #include "Path.h" +#include <iterator> + +#include <ArmarXCore/interface/core/BasicVectorTypes.h> +#include <ArmarXCore/interface/core/BasicVectorTypesHelpers.h> + namespace armarx::viz { Path& Path::clear() { data_->points.clear(); - return *this; - } - - Path& Path::lineColor(Color color) - { - data_->lineColor = color; return *this; } - Path& Path::lineColorGlasbeyLUT(std::size_t id, int alpha) - { - return lineColor(Color::fromRGBA(simox::color::GlasbeyLUT::at(id, alpha))); - } - - Path& Path::lineWidth(float w) + Path& Path::width(float w) { data_->lineWidth = w; @@ -33,17 +27,21 @@ namespace armarx::viz auto& points = data_->points; points.clear(); points.reserve(ps.size()); - for (auto& p : ps) + + std::transform(ps.begin(), + ps.end(), + std::back_inserter(points), + [](const auto & e) { - points.push_back(armarx::Vector3f{p.x(), p.y(), p.z()}); - } + return ToBasicVectorType(e); + }); return *this; } Path& Path::addPoint(Eigen::Vector3f p) { - data_->points.push_back(armarx::Vector3f{p.x(), p.y(), p.z()}); + data_->points.emplace_back(ToBasicVectorType(p)); return *this; } diff --git a/source/RobotAPI/components/ArViz/Client/elements/Path.h b/source/RobotAPI/components/ArViz/Client/elements/Path.h index 50eec6abe..7cfbecbd9 100644 --- a/source/RobotAPI/components/ArViz/Client/elements/Path.h +++ b/source/RobotAPI/components/ArViz/Client/elements/Path.h @@ -35,17 +35,7 @@ namespace armarx::viz Path& clear(); - Path& lineColor(Color color); - - template<class...Ts> - Path& lineColor(Ts&& ...ts) - { - return lineColor({std::forward<Ts>(ts)...}); - } - - Path& lineColorGlasbeyLUT(std::size_t id, int alpha = 255); - - Path& lineWidth(float w); + Path& width(float w); Path& points(std::vector<Eigen::Vector3f> const& ps); diff --git a/source/RobotAPI/interface/ArViz/Elements.ice b/source/RobotAPI/interface/ArViz/Elements.ice index 1c00dd4e6..bebbb3f41 100644 --- a/source/RobotAPI/interface/ArViz/Elements.ice +++ b/source/RobotAPI/interface/ArViz/Elements.ice @@ -104,7 +104,6 @@ module data { Vector3fSeq points; - Color lineColor; float lineWidth = 10.0f; }; -- GitLab