VisualizationLine.h
Go to the documentation of this file.
1#pragma once
2
3#include <RobotAPI/interface/ArViz/Elements.h>
4
5#include "ElementVisualizer.h"
6#include <Inventor/nodes/SoCoordinate3.h>
7#include <Inventor/nodes/SoDrawStyle.h>
8#include <Inventor/nodes/SoLineSet.h>
9
10namespace armarx::viz::coin
11{
13 {
14 using ElementType = data::ElementLine;
15
17 {
18 lineStyle = new SoDrawStyle;
19 coordinate3 = new SoCoordinate3;
20 SoLineSet* lineSet = new SoLineSet;
21 lineSet->numVertices.setValue(2);
22 lineSet->startIndex.setValue(0);
23
24 node->addChild(lineStyle);
25 node->addChild(coordinate3);
26 node->addChild(lineSet);
27 }
28
29 bool
30 update(ElementType const& element)
31 {
32 lineStyle->lineWidth.setValue(element.lineWidth);
33
34 SbVec3f from(element.from.e0, element.from.e1, element.from.e2);
35 SbVec3f to(element.to.e0, element.to.e1, element.to.e2);
36 coordinate3->point.set1Value(0, from);
37 coordinate3->point.set1Value(1, to);
38
39 return true;
40 }
41
42 SoDrawStyle* lineStyle;
43 SoCoordinate3* coordinate3;
44 };
45} // namespace armarx::viz::coin
bool update(ElementType const &element)