From fad5ca45aa4cf2b2463e190891e054435eb4781a Mon Sep 17 00:00:00 2001 From: Rainer Kartmann <rainer.kartmann@kit.edu> Date: Mon, 21 Sep 2020 09:11:52 +0200 Subject: [PATCH] Move Robot to own file --- .../RobotAPI/components/ArViz/CMakeLists.txt | 2 + .../components/ArViz/Client/Elements.h | 60 +-------------- .../ArViz/Client/elements/Robot.cpp | 6 ++ .../components/ArViz/Client/elements/Robot.h | 75 +++++++++++++++++++ 4 files changed, 85 insertions(+), 58 deletions(-) create mode 100644 source/RobotAPI/components/ArViz/Client/elements/Robot.cpp create mode 100644 source/RobotAPI/components/ArViz/Client/elements/Robot.h diff --git a/source/RobotAPI/components/ArViz/CMakeLists.txt b/source/RobotAPI/components/ArViz/CMakeLists.txt index 083847501..696d953ae 100644 --- a/source/RobotAPI/components/ArViz/CMakeLists.txt +++ b/source/RobotAPI/components/ArViz/CMakeLists.txt @@ -12,6 +12,7 @@ set(SOURCES Client/Elements.cpp Client/elements/Mesh.cpp + Client/elements/Robot.cpp Coin/ElementVisualizer.cpp @@ -69,6 +70,7 @@ set(HEADERS Client/elements/Mesh.h Client/elements/MeshCGALExtensions.h Client/elements/PointCloud.h + Client/elements/Robot.h Client/elements/point_cloud_type_traits.hpp diff --git a/source/RobotAPI/components/ArViz/Client/Elements.h b/source/RobotAPI/components/ArViz/Client/Elements.h index 175bfbe3b..ef4c6f66a 100644 --- a/source/RobotAPI/components/ArViz/Client/Elements.h +++ b/source/RobotAPI/components/ArViz/Client/Elements.h @@ -17,8 +17,9 @@ #include "Color.h" #include "elements/ElementOps.h" -#include "elements/PointCloud.h" #include "elements/Mesh.h" +#include "elements/PointCloud.h" +#include "elements/Robot.h" // The has_member macro causes compile errors if *any* other header uses // the identifier has_member. Boost.Thread does, so this causes compile @@ -448,63 +449,6 @@ namespace armarx::viz }; - class Robot : public ElementOps<Robot, data::ElementRobot> - { - public: - using ElementOps::ElementOps; - - Robot& file(std::string const& project, std::string const& filename) - { - data_->project = project; - data_->filename = filename; - - return *this; - } - - Robot& useCollisionModel() - { - data_->drawStyle |= data::ModelDrawStyle::COLLISION; - - return *this; - } - - Robot& useFullModel() - { - data_->drawStyle &= ~data::ModelDrawStyle::COLLISION; - - return *this; - } - - Robot& overrideColor(Color c) - { - data_->drawStyle |= data::ModelDrawStyle::OVERRIDE_COLOR; - - return color(c); - } - - Robot& useOriginalColor() - { - data_->drawStyle &= ~data::ModelDrawStyle::OVERRIDE_COLOR; - - return *this; - } - - Robot& joint(std::string const& name, float value) - { - data_->jointValues[name] = value; - - return *this; - } - - Robot& joints(std::map<std::string, float> const& values) - { - data_->jointValues = values; - - return *this; - } - }; - - class Object : public ElementOps<Object, data::ElementObject> { private: diff --git a/source/RobotAPI/components/ArViz/Client/elements/Robot.cpp b/source/RobotAPI/components/ArViz/Client/elements/Robot.cpp new file mode 100644 index 000000000..f6f45c63b --- /dev/null +++ b/source/RobotAPI/components/ArViz/Client/elements/Robot.cpp @@ -0,0 +1,6 @@ +#include "Robot.h" + +Robot::Robot() +{ + +} diff --git a/source/RobotAPI/components/ArViz/Client/elements/Robot.h b/source/RobotAPI/components/ArViz/Client/elements/Robot.h new file mode 100644 index 000000000..b19d92de2 --- /dev/null +++ b/source/RobotAPI/components/ArViz/Client/elements/Robot.h @@ -0,0 +1,75 @@ +#pragma once + +#include "ElementOps.h" + + +namespace armarx +{ + ///#include <RobotAPI/libraries/RobotStatechartHelpers/RobotNameHelper.h> + class RobotNameHelper; + ///#include <RobotAPI/interface/core/RobotState.h> + class RobotInfoNode; + class RobotStateComponentInterfacePrx; +} + + +namespace armarx::viz +{ + + class Robot : public ElementOps<Robot, data::ElementRobot> + { + public: + using ElementOps::ElementOps; + + Robot& file(std::string const& project, std::string const& filename) + { + data_->project = project; + data_->filename = filename; + + return *this; + } + + Robot& useCollisionModel() + { + data_->drawStyle |= data::ModelDrawStyle::COLLISION; + + return *this; + } + + Robot& useFullModel() + { + data_->drawStyle &= ~data::ModelDrawStyle::COLLISION; + + return *this; + } + + Robot& overrideColor(Color c) + { + data_->drawStyle |= data::ModelDrawStyle::OVERRIDE_COLOR; + + return color(c); + } + + Robot& useOriginalColor() + { + data_->drawStyle &= ~data::ModelDrawStyle::OVERRIDE_COLOR; + + return *this; + } + + Robot& joint(std::string const& name, float value) + { + data_->jointValues[name] = value; + + return *this; + } + + Robot& joints(std::map<std::string, float> const& values) + { + data_->jointValues = values; + + return *this; + } + }; + +} -- GitLab