OpenDAFF C++ API  v1.7
Directional Audio File Format
DAFFVizCarpetPlot.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_CARPETPLOT
13 #define IW_DAFF_CARPETPLOT
14 
15 #include <daffviz/DAFFVizSGNode.h>
16 #include <vtkSmartPointer.h>
17 
18 // Forward declarations
19 class vtkActor;
20 class vtkPolyData;
21 class vtkPolyDataMapper;
22 class vtkWarpScalar;
23 class vtkVectorText;
24 
25 class DAFFContentIR;
26 
27 namespace DAFFViz
28 {
30 
35  {
36  public:
37  enum
38  {
39  SCALING_LINEAR=0,
40  SCALING_DECIBEL
41  };
42 
43  enum
44  {
45  BETA_FIXED=0,
46  ALPHA_FIXED
47  };
48 
49  enum
50  {
51  MODE_SURFACE=0,
53  MODE_POINT
54  };
55 
56  CarpetPlot( SGNode* pParent, const DAFFContentIR* pContentIR );
57  CarpetPlot( const DAFFContentIR* pContentIR );
58  virtual ~CarpetPlot();
59 
60  // --= Object related methods =--
61 
63  float GetSelectedAngle() const;
64 
66  void SetSelectedAngle(float fAngle);
67 
69  int GetScaling() const;
70 
72  void SetScaling(int iScaling);
73 
75  void SetFixedAngle(int iFixedAngle);
76 
78  int getFixedAngle();
79 
81  void SetScalarVisibility(bool bVisible);
82 
84  int getScalarVisibility();
85 
87  void SetDisplayMode(int iMode);
88 
90  double GetRangeMin() const;
91 
93  double GetRangeMax() const;
94 
96  void SetRange(double dMin, double dMax);
97 
99  void SetChannel(int iChannel);
100 
102  int GetChannel();
103 
105  // \note default: enabled
106  void EnableWarp();
107  void DisableWarp();
108 
109  void SetWarpingEnabled( bool bEnabled );
110 
111  void GtWarpingEnabled( bool ) const;
112 
114  void SetProbeAngles(double dAlpha, double dBeta);
115 
117  void SetProbeVisible(bool bVisible);
118 
120  void UpdateProbe();
121 
122  private:
123 
124  const DAFFContentIR* m_pContentIR;
125  vtkSmartPointer< vtkWarpScalar > m_pWarp;
126  vtkSmartPointer< vtkPolyDataMapper > m_pCarpetMapper;
127  vtkSmartPointer< vtkActor > m_pCarpetActor;
128  vtkSmartPointer< vtkPolyData > m_pCarpetPolyData;
129  float m_fAngle;
130  int m_iScaling;
131  int m_iFixedAngle;
132  float m_dMin, m_dMax; // linear factors!
133  int m_iChannel;
134  bool m_bWarp;
135  vtkSmartPointer< vtkActor > m_pProbe;
136  vtkSmartPointer< vtkVectorText > m_pProbeLabel;
137  vtkSmartPointer< vtkActor > m_pLabel;
138  float m_dProbeX, m_dProbeY;
139 
141  void Init();
142 
143  // The initializer generates dynamic objects like source, mapper, actor ...
144  void InitCarpetMesh();
145 
146  // Update scalars (e.g. when selected angle changed)
147  void SetScalars();
148 
149  // Convert a linear value into decibel
150  double factor2decibel(double x) const;
151 
152  // Convert decibel to linear value
153  double decibel2factor(double x) const;
154 
155  // moves the whole plot to fit to the coordinate axes
156  void updatePlotOffset();
157  };
158 
159 } // End of namespace "DAFFViz"
160 
161 #endif // IW_DAFF_CARPETPLOT
#define DAFF_API
Definition: DAFFDefs.h:29
Simple carpet plot object node.
Base class for scene graph nodes.
Definition: DAFFVizSGNode.h:67
Impulse response content interface.
Definition: DAFFContentIR.h:38
OpenDAFF is a project from the Institute of Technical Acoustics, RWTH Aachen University, Germany.