VisualizationLine.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "ElementVisualizer.h"
4 
5 #include <RobotAPI/interface/ArViz/Elements.h>
6 
7 #include <Inventor/nodes/SoLineSet.h>
8 #include <Inventor/nodes/SoDrawStyle.h>
9 #include <Inventor/nodes/SoCoordinate3.h>
10 
11 namespace armarx::viz::coin
12 {
14  {
15  using ElementType = data::ElementLine;
16 
18  {
19  lineStyle = new SoDrawStyle;
20  coordinate3 = new SoCoordinate3;
21  SoLineSet* lineSet = new SoLineSet;
22  lineSet->numVertices.setValue(2);
23  lineSet->startIndex.setValue(0);
24 
25  node->addChild(lineStyle);
26  node->addChild(coordinate3);
27  node->addChild(lineSet);
28  }
29 
30  bool 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 }
ElementVisualizer.h
armarx::viz::coin::TypedElementVisualization
Definition: ElementVisualizer.h:53
armarx::viz::coin::VisualizationLine::ElementType
data::ElementLine ElementType
Definition: VisualizationLine.h:15
armarx::viz::coin::VisualizationLine::coordinate3
SoCoordinate3 * coordinate3
Definition: VisualizationLine.h:43
armarx::viz::coin::VisualizationLine::update
bool update(ElementType const &element)
Definition: VisualizationLine.h:30
armarx::viz::coin::TypedElementVisualization< SoSeparator >::node
NodeType * node
Definition: ElementVisualizer.h:68
armarx::viz::coin::VisualizationLine::lineStyle
SoDrawStyle * lineStyle
Definition: VisualizationLine.h:42
armarx::viz::coin::VisualizationLine::VisualizationLine
VisualizationLine()
Definition: VisualizationLine.h:17
armarx::viz::coin::VisualizationLine
Definition: VisualizationLine.h:13
armarx::viz::coin
Definition: ElementVisualizer.cpp:11