MeVisLab Toolbox Reference
mlPCLClusterStatisticsClusterSubGraph.h
Go to the documentation of this file.
1 // Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2 // **InsertLicense** code author="Wolf Spindler"
3 //----------------------------------------------------------------------------------
6 
13 
14 //----------------------------------------------------------------------------------
15 #pragma once
16 
18 
20 #include <Inventor/nodes/SoBaseColor.h>
21 #include <Inventor/nodes/SoDrawStyle.h>
22 #include <Inventor/nodes/SoLineSet.h>
23 #include <Inventor/nodes/SoSeparator.h>
24 #include <Inventor/nodes/SoSphere.h>
25 #include <Inventor/nodes/SoSwitch.h>
26 #include <Inventor/nodes/SoTranslation.h>
27 #include <Inventor/nodes/SoVertexProperty.h>
30 
31 ML_START_NAMESPACE
32 
33 //----------------------------------------------------------------------------------
35 //----------------------------------------------------------------------------------
37 public:
39  enum { NumOrientationLines = 3 };
40 
42  inline ClusterSubGraph()
43  {
44  clusterRoot = new SoSeparator();
45  clusterRoot->ref();
46 
47  SoSeparator *sep1 = new SoSeparator();
48  clusterRoot->addChild(sep1);
49 
50  soPlaneIntersectionSwitch = new SoSwitch();
51  sep1->addChild(soPlaneIntersectionSwitch);
52 
53  soPlaneIntersectionTranslation = new SoTranslation();
54  soPlaneIntersectionSwitch->addChild(soPlaneIntersectionTranslation);
55 
56  soPlaneIntersectionColorSwitch = new SoSwitch();
57  soPlaneIntersectionSwitch->addChild(soPlaneIntersectionColorSwitch);
58 
59  soPlaneIntersectionBaseColor = new SoBaseColor();
60  soPlaneIntersectionColorSwitch->addChild(soPlaneIntersectionBaseColor);
61 
62  soPlaneIntersectionSphere = new SoSphere();
63  soPlaneIntersectionSwitch->addChild(soPlaneIntersectionSphere);
64 
65 
66  // Centre of Gravity:
67  SoSeparator *sep2 = new SoSeparator();
68  clusterRoot->addChild(sep2);
69 
70  soCenterOfGravitySwitch = new SoSwitch();
71  sep2->addChild(soCenterOfGravitySwitch);
72 
73  soCenterOfGravityTranslation = new SoTranslation();
74  soCenterOfGravitySwitch->addChild(soCenterOfGravityTranslation);
75 
76  soCenterOfGravityColorSwitch = new SoSwitch();
77  soCenterOfGravitySwitch->addChild(soCenterOfGravityColorSwitch);
78 
79  soCenterOfGravityBaseColor = new SoBaseColor();
80  soCenterOfGravityColorSwitch->addChild(soCenterOfGravityBaseColor);
81 
82  soCenterOfGravitySphere = new SoSphere();
83  soCenterOfGravitySwitch->addChild(soCenterOfGravitySphere);
84 
85  // Orientation lines:
86  // Use CenterOfGravity colour also for line set.
87  clusterRoot->addChild(soCenterOfGravityColorSwitch);
88 
89  SoSeparator *sep3 = new SoSeparator();
90  clusterRoot->addChild(sep3);
91 
92  for (size_t c=0; c < NumOrientationLines; ++c){
93  soClusterOrientationLineSwitch[c] = new SoSwitch();
94  sep3->addChild(soClusterOrientationLineSwitch[c]);
95 
96  soVertexProperty[c] = new SoVertexProperty();
97  soClusterOrientationLineSwitch[c]->addChild(soVertexProperty[c]);
98 
99  soLineSet[c] = new SoLineSet();
100  soClusterOrientationLineSwitch[c]->addChild(soLineSet[c]);
101  }
102 
103  // Cluster to plane intersection line:
104  SoSeparator *sep4 = new SoSeparator();
105  clusterRoot->addChild(sep4);
106 
107  soDrawStyleClusterToPlane = new SoDrawStyle();
108  sep4->addChild(soDrawStyleClusterToPlane);
109  soDrawStyleClusterToPlane->linePattern.setValue(static_cast<MLuint16>(0x1111));
110 
111  soClusterToPlaneIntersectionLineSwitch = new SoSwitch();
112  sep4->addChild(soClusterToPlaneIntersectionLineSwitch);
113 
114  soVertexPropertyClusterToPlane = new SoVertexProperty();
115  soClusterToPlaneIntersectionLineSwitch->addChild(soVertexPropertyClusterToPlane);
116 
117  soLineSetClusterToPlane = new SoLineSet();
118  soClusterToPlaneIntersectionLineSwitch->addChild(soLineSetClusterToPlane);
119  }
120 
123  {
124  clusterRoot->unref();
125  }
126 
128  SoSeparator *clusterRoot;
129 
137 
145 
149 
151  SoSwitch *soClusterOrientationLineSwitch[NumOrientationLines];
152 
154  SoVertexProperty *soVertexProperty[NumOrientationLines];
155 
157  SoLineSet *soLineSet[NumOrientationLines];
159 
162  SoVertexProperty *soVertexPropertyClusterToPlane;
165 
166 };
167 
168 ML_END_NAMESPACE
Disables warnings from PCL headers which otherwise cannot be avoided.
Restores disabled warnings from PCL headers which otherwise cannot be avoided.
Internal helper class to manage OpenInventor visualization stuff for one cluster.
SoSwitch * soCenterOfGravitySwitch
Centre of Gravity.
SoSwitch * soClusterToPlaneIntersectionLineSwitch
Cluster to plane intersection line.
~ClusterSubGraph()
Destructor which removed entire node graph just by dereferencing the root.
SoSeparator * clusterRoot
Root to be appended to parent graph.
SoSwitch * soPlaneIntersectionSwitch
Plane intersections.
ClusterSubGraph()
Constructor which creates the whole subgraph with all orientation nodes.
Displays PCLClusterStatistics results in Open Inventor scene.
Helper class for the ML PCL Module PCLClusterStatistics which manages statistics for one cluster.
unsigned short MLuint16
Definition: mlTypeDefs.h:148