From 74eb77b5943fc396169b7c9de554ba76fd7d0446 Mon Sep 17 00:00:00 2001
From: Adrian Knobloch <adrian.knobloch@student.kit.edu>
Date: Fri, 24 Mar 2017 16:58:14 +0100
Subject: [PATCH] Add possibility to draw the debug layer line set using heat
 map colors

---
 .../components/DebugDrawer/DebugDrawerComponent.cpp | 13 +++++++++++--
 .../visualization/DebugDrawerInterface.ice          |  2 ++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp
index 9dabab63d..ebf8cfff1 100644
--- a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp
+++ b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp
@@ -25,6 +25,7 @@
 
 #include "DebugDrawerComponent.h"
 
+#include <RobotAPI/libraries/core/math/ColorUtils.h>
 
 #include <VirtualRobot/VirtualRobot.h>
 #include <VirtualRobot/Visualization/CoinVisualization/CoinVisualizationFactory.h>
@@ -621,8 +622,16 @@ namespace armarx
             coordinateValues[2 * i].setValue(d.lineSet.points[2 * i].x, d.lineSet.points[2 * i].y, d.lineSet.points[2 * i].z);
             coordinateValues[2 * i + 1].setValue(d.lineSet.points[2 * i + 1].x, d.lineSet.points[2 * i + 1].y, d.lineSet.points[2 * i + 1].z);
 
-            VirtualRobot::VisualizationFactory::Color c = visualizationColorMap.getColor(d.lineSet.intensities[i]);
-            colorValues[i].setValue(c.r, c.g, c.b);
+            if (d.lineSet.useHeatMap)
+            {
+                auto c = colorutils::HeatMapRGBAColor(d.lineSet.intensities[i]);
+                colorValues[i].setValue(c.r, c.g, c.b);
+            }
+            else
+            {
+                VirtualRobot::VisualizationFactory::Color c = visualizationColorMap.getColor(d.lineSet.intensities[i]);
+                colorValues[i].setValue(c.r, c.g, c.b);
+            }
         }
 
         coordinateNode->point.setValuesPointer(d.lineSet.points.size(), coordinateValues);
diff --git a/source/RobotAPI/interface/visualization/DebugDrawerInterface.ice b/source/RobotAPI/interface/visualization/DebugDrawerInterface.ice
index 1e629a61b..0a25c6ee6 100644
--- a/source/RobotAPI/interface/visualization/DebugDrawerInterface.ice
+++ b/source/RobotAPI/interface/visualization/DebugDrawerInterface.ice
@@ -189,6 +189,8 @@ module armarx
 
         DebugDrawerLineSetPointList points;
         DebugDrawerLineSetIntensityList intensities;
+
+        bool useHeatMap = false;
     };
 
     sequence< Vector3Base > PolygonPointList;
-- 
GitLab