OpenDAFF C++ API  v1.7
Directional Audio File Format
DAFFVizSGNode.h
Go to the documentation of this file.
1 /*
2  * -------------------------------------------------------------------------------------
3  *
4  * OpenDAFF - A free, open source software package for directional audio data
5  * Copyright 2016 Institute of Technical Acoustics, RWTH Aachen University
6  * OpenDAFF is distributed under the Apache License Version 2.0
7  *
8  * ------------------------------------------------------------------------------------
9  *
10  */
11 
12 #ifndef IW_DAFF_NODE
13 #define IW_DAFF_NODE
14 
15 // Includes
16 #include <DAFFDefs.h>
17 #include <vector>
18 
19 // VTK includes
20 #include <vtkSmartPointer.h>
21 
22 // Forward declarations
23 class vtkActor;
24 class vtkAssembly;
25 class vtkCamera;
26 class QtDAFFVizTestWindow;
27 class QDAFFVTKWidget;
28 
29 namespace DAFFViz
30 {
31 
33 
68  {
69  public:
71 
76  SGNode( DAFFViz::SGNode* pParentNode = NULL );
77 
79 
82  virtual ~SGNode();
83 
84  // --= Node functionality =--
85 
87 
90  DAFFViz::SGNode* GetRootNode() const;
91 
93 
97  DAFFViz::SGNode* GetParentNode() const;
98 
100 
103  bool HasParentNode() const;
104 
106 
109  bool IsRoot() const;
110 
112 
115  bool HasChildNodes() const;
116 
118 
121  bool IsLeaf() const;
122 
124 
128  const DAFFViz::SGNode* GetChildNode(int iIndex) const;
129 
131 
135  DAFFViz::SGNode* GetChildNode(int iIndex);
136 
138 
141  void GetChildNodes(std::vector<const DAFFViz::SGNode*>& vpChildren) const;
142 
144 
147  void GetChildNodes( std::vector<DAFFViz::SGNode*>& vpChildren );
148 
150 
158  bool AddChildNode(DAFFViz::SGNode* pChild);
159 
161 
170  bool AddChildNodes(const std::vector<DAFFViz::SGNode*>& vpChildren);
171 
173 
179  bool RemoveChildNode(DAFFViz::SGNode* pChild);
180 
182 
189  bool RemoveChildNodes(const std::vector<DAFFViz::SGNode*>& vpChildren);
190 
191 
192  // --= Modificators =--
193 
195 
202  void GetPosition(double& x, double& y, double& z) const;
203 
205 
212  void SetPosition(double x, double y, double z);
213 
215 
224  void GetOrientation(double& dRotXDeg, double& dRotYDeg, double& dRotZDeg) const;
225 
227 
236  void SetOrientation(double dRotXDeg, double dRotYDeg, double dRotZDeg);
237 
239 
248  void SetOrientationYPR(double dYawDeg, double dPitchDeg, double dRollDeg);
249 
251 
261  void GetOrientationYPR( double& dYawDeg, double& dPitchDeg, double& dRollDeg );
262 
264 
274  void SetOrientationVU(double vx, double vy, double vz,
275  double ux, double uy, double uz);
276 
278 
288  void GetOrientationVU(double& vx, double& vy, double& vz,
289  double& ux, double& uy, double& uz);
290 
292 
299  void GetScale(double& sx, double& sy, double& sz) const;
300 
302 
309  void SetScale(double sx, double sy, double sz);
310 
312 
320  virtual void SetVisible( bool bVisible);
321 
323 
331  virtual bool IsVisible() const;
332 
333  protected:
334 
335  // --= Modificators for subclasses =--
336 
338 
343  void AddActor( vtkSmartPointer< vtkActor > pActor );
344 
346 
351  void RemoveActor( vtkSmartPointer< vtkActor > pActor );
352 
354 
359  void AddAssembly( vtkSmartPointer< vtkAssembly > pAssembly );
360 
362 
367  void RemoveAssembly( vtkSmartPointer< vtkAssembly > pAssembly );
368 
369  // --= Event handlers =--
370 
372 
376  virtual void OnSetFollowerCamera( vtkSmartPointer< vtkCamera > pCamera );
377 
378  private:
379  DAFFViz::SGNode* m_pParentNode;
380  std::vector< DAFFViz::SGNode* > m_vpChildNodes;
381  vtkSmartPointer< vtkAssembly > m_pNodeAssembly;
382 
383  bool _debug;
384 
385  // --= Uncopyable =--
386 
388  inline SGNode( const SGNode& ) {};
389 
391  inline SGNode& operator=( const SGNode& ) { return *this; };
392 
394 
397  vtkSmartPointer< vtkAssembly > GetNodeAssembly();
398 
399  // The display class needs access to the node assembly
400  friend class VTKDAFFVizWindow;
401  friend class QDAFFVTKWidget;
402  friend class QtDAFFVizTestWindow;
403  };
404 
405 } // End of namespace "DAFFViz"
406 
407 #endif // IW_DAFF_NODE
#define DAFF_API
Definition: DAFFDefs.h:29
#define NULL
Definition: DAFFDefs.h:59
Base class for scene graph nodes.
Definition: DAFFVizSGNode.h:67
OpenDAFF is a project from the Institute of Technical Acoustics, RWTH Aachen University, Germany.