OpenDAFF C++ API  v1.7
Directional Audio File Format
DAFFVizBalloonPlot.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_DIRECTIVITY
13 #define IW_DAFF_DIRECTIVITY
14 
15 #include <daffviz/DAFFVizSGNode.h>
16 
17 #include <vtkSmartPointer.h>
18 
19 // Forward declarations
20 class vtkActor;
21 class vtkPolyData;
22 class vtkPolyDataMapper;
23 class vtkWarpScalar;
24 class vtkDoubleArray;
25 class vtkVectorText;
26 
27 class DAFFContent;
28 
29 namespace DAFFViz
30 {
31 
33 
38  {
39  public:
40  enum
41  {
42  SCALING_LINEAR=0,
43  SCALING_DECIBEL
44  };
45 
46  enum
47  {
48  MODE_SURFACE=0,
50  MODE_POINT
51  };
52 
53  BalloonPlot( SGNode* pParentNode, const DAFFContent* pContent );
54  BalloonPlot( const DAFFContent* pContent );
55  virtual ~BalloonPlot();
56 
57  // --= Object related methods =--
58 
60  int GetSelectedFrequency() const;
61 
63  void SetSelectedFrequency( int iFreqIndex );
64 
66  int GetScaling() const;
67 
69  void SetScaling( int iScaling );
70 
72  double GetRangeMin() const;
73 
75  double GetRangeMax() const;
76 
78  void SetRange( double dMin, double dMax );
79 
81  void SetUseCustomRange(bool bChecked);
82 
84  void SetScalarVisibility( bool bVisible );
85 
87  int GetScalarVisibility();
88 
90  void SetDisplayMode( int iMode );
91 
93  void SetChannel( int iChannel );
94 
96  int GetChannel();
97 
99  // \note default: enabled
100  void EnableWarp();
101  void DisableWarp();
102 
104  void SetNormalize(bool bChecked);
105 
107  void SetNormalizeFrequenciesIndividually(bool bChecked);
108 
110  void SetUsePhaseAsColor( bool bUse );
111 
113  void SetProbeAngles( double dAlpha, double dBeta );
114 
116  void SetProbeVisible( bool bVisible );
117 
119  void UpdateProbe();
120  private:
121 
122  const DAFFContent* m_pContent;
123  vtkSmartPointer< vtkWarpScalar > m_pWarp;
124  vtkSmartPointer< vtkPolyDataMapper > m_pMapper;
125  vtkSmartPointer< vtkActor > m_pPlotActor;
126  vtkSmartPointer< vtkPolyData > m_pPlotPolydata;
127  vtkSmartPointer< vtkDoubleArray > m_pNormals;
128  int m_iFrequency;
129  int m_iNumFrequencies;
130  int m_iScaling;
131  float m_dMin, m_dMax, m_dProbeAlpha, m_dProbeBeta; // linear factors!
132  int m_iChannel;
133  bool m_bWarp, m_bUsePhaseAsColor;
134  bool m_bNormalize, m_bNormalizeFreqsIndiv, m_bUseCustomRange;
135  vtkSmartPointer< vtkActor > m_pProbe;
136  vtkSmartPointer< vtkVectorText > m_pProbeLabel;
137  vtkSmartPointer< vtkActor > m_pLabel;
138 
139  // The initializer generates dynamic objects like source, mapper, actor ...
140  void init();
141 
142  // Update scalars (e.g. when selected frequency changed)
143  void SetScalars();
144 
145  // Convert orientation (phi, theta) into cartesian coordiates (x,y,z)
146  void sph2cart( double phi, double theta, double& x, double& y, double& z );
147 
148  // Convert a linear value into decibel
149  float FactorToDecibel( float x ) const;
150 
151  // Convert decibel to linear value
152  float DecibelToFactor( float x ) const;
153 
154  float getMagnitudeMaximum() const;
155  };
156 
157 } // End of namespace "DAFFViz"
158 
159 #endif // IW_DAFF_DIRECTIVITY
#define DAFF_API
Definition: DAFFDefs.h:29
Simple directivity object node.
Common content interface.
Definition: DAFFContent.h:40
Base class for scene graph nodes.
Definition: DAFFVizSGNode.h:67
OpenDAFF is a project from the Institute of Technical Acoustics, RWTH Aachen University, Germany.