CScope.h
Go to the documentation of this file.
1 //==============================================================================
2 /*
3  Software License Agreement (BSD License)
4  Copyright (c) 2003-2016, CHAI3D.
5  (www.chai3d.org)
6 
7  All rights reserved.
8 
9  Redistribution and use in source and binary forms, with or without
10  modification, are permitted provided that the following conditions
11  are met:
12 
13  * Redistributions of source code must retain the above copyright
14  notice, this list of conditions and the following disclaimer.
15 
16  * Redistributions in binary form must reproduce the above
17  copyright notice, this list of conditions and the following
18  disclaimer in the documentation and/or other materials provided
19  with the distribution.
20 
21  * Neither the name of CHAI3D nor the names of its contributors may
22  be used to endorse or promote products derived from this software
23  without specific prior written permission.
24 
25  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  POSSIBILITY OF SUCH DAMAGE.
37 
38  \author <http://www.chai3d.org>
39  \author Francois Conti
40  \version 3.2.0 $Rev: 2167 $
41 */
42 //==============================================================================
43 
44 //------------------------------------------------------------------------------
45 #ifndef CScopeH
46 #define CScopeH
47 //------------------------------------------------------------------------------
48 #include "widgets/CPanel.h"
49 //------------------------------------------------------------------------------
50 
51 //------------------------------------------------------------------------------
52 namespace chai3d {
53 //------------------------------------------------------------------------------
54 
55 //------------------------------------------------------------------------------
56 const int C_SCOPE_MAX_SAMPLES = 3000;
57 //------------------------------------------------------------------------------
58 
59 //==============================================================================
66 //==============================================================================
67 
68 //==============================================================================
79 //==============================================================================
80 class cScope : public cPanel
81 {
82  //--------------------------------------------------------------------------
83  // CONSTRUCTOR & DESTRUCTOR:
84  //--------------------------------------------------------------------------
85 
86 public:
87 
89  cScope();
90 
92  virtual ~cScope() {};
93 
94 
95  //--------------------------------------------------------------------------
96  // PUBLIC METHODS:
97  //--------------------------------------------------------------------------
98 
99 public:
100 
102  virtual cScope* copy(const bool a_duplicateMaterialData = false,
103  const bool a_duplicateTextureData = false,
104  const bool a_duplicateMeshData = false,
105  const bool a_buildCollisionDetector = false);
106 
108  virtual void setSize(const double& a_width, const double& a_height);
109 
111  inline void setLineWidth(const double a_lineWidth) { m_lineWidth = fabs(a_lineWidth); }
112 
114  inline double getLineWidth() const { return (m_lineWidth); }
115 
117  void setSignalValues(const double a_signalValue0 = 0,
118  const double a_signalValue1 = 0,
119  const double a_signalValue2 = 0,
120  const double a_signalValue3 = 0);
121 
123  void setSignalEnabled(const bool a_signalEnabled0 = true,
124  const bool a_signalEnabled1 = true,
125  const bool a_signalEnabled2 = true,
126  const bool a_signalEnabled3 = true);
127 
129  void clearSignals();
130 
132  virtual void setRange(const double a_minValue,
133  const double a_maxValue);
134 
136  inline double getRangeMin() const { return (m_minValue); }
137 
139  inline double getRangeMax() const { return (m_maxValue); }
140 
141 
142  //--------------------------------------------------------------------------
143  // PUBLIC MEMBERS:
144  //--------------------------------------------------------------------------
145 
146 public:
147 
150 
153 
156 
159 
160 
161  //--------------------------------------------------------------------------
162  // PROTECTED MEMBERS:
163  //--------------------------------------------------------------------------
164 
165 protected:
166 
168  double m_minValue;
169 
171  double m_maxValue;
172 
175 
178 
180  unsigned int m_index0;
181 
183  unsigned int m_index1;
184 
186  double m_lineWidth;
187 
189  double m_scopeWidth;
190 
193 
196 
197 
198  //--------------------------------------------------------------------------
199  // PROTECTED METHODS:
200  //--------------------------------------------------------------------------
201 
202 protected:
203 
205  virtual void render(cRenderOptions& a_options);
206 
208  void copyScopeProperties(cScope* a_obj,
209  const bool a_duplicateMaterialData,
210  const bool a_duplicateTextureData,
211  const bool a_duplicateMeshData,
212  const bool a_buildCollisionDetector);
213 };
214 
215 //------------------------------------------------------------------------------
216 } // namespace chai3d
217 //------------------------------------------------------------------------------
218 
219 //------------------------------------------------------------------------------
220 #endif
221 //------------------------------------------------------------------------------
This class implements a 3D vector.
Definition: CVector3d.h:88
virtual void setRange(const double a_minValue, const double a_maxValue)
This method sets the range of input values which can be displayed on the scope.
Definition: CScope.cpp:213
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition: CRenderOptions.h:82
unsigned int m_index1
Index of last sample.
Definition: CScope.h:183
Implements a panel widget.
This class implements a 2D panel widget.
Definition: CPanel.h:80
virtual void setSize(const double &a_width, const double &a_height)
This method sets the size of this scope.
Definition: CScope.cpp:236
virtual void render(cRenderOptions &a_options)
This method renders the object graphically using OpenGL.
Definition: CScope.cpp:271
void setSignalEnabled(const bool a_signalEnabled0=true, const bool a_signalEnabled1=true, const bool a_signalEnabled2=true, const bool a_signalEnabled3=true)
This method enables or disables selected signals.
Definition: CScope.cpp:181
void setSignalValues(const double a_signalValue0=0, const double a_signalValue1=0, const double a_signalValue2=0, const double a_signalValue3=0)
This method sets values for signals 0, 1, 2, and 3.
Definition: CScope.cpp:105
void setLineWidth(const double a_lineWidth)
This method sets the line width of the signal.
Definition: CScope.h:111
double m_minValue
Range - minimum value.
Definition: CScope.h:168
unsigned int m_index0
Index of first sample.
Definition: CScope.h:180
const int C_SCOPE_MAX_SAMPLES
Definition: CScope.h:56
double getRangeMin() const
This method returns the minimum value from the range.
Definition: CScope.h:136
double m_scopeWidth
Internal width of scope data display.
Definition: CScope.h:189
double m_maxValue
Range - maximum value.
Definition: CScope.h:171
bool m_signalEnabled[4]
Status about all signals.
Definition: CScope.h:177
cColorf m_colorSignal2
Color settings for signal 2.
Definition: CScope.h:155
void clearSignals()
This method clears all signals.
Definition: CScope.cpp:198
void copyScopeProperties(cScope *a_obj, const bool a_duplicateMaterialData, const bool a_duplicateTextureData, const bool a_duplicateMeshData, const bool a_buildCollisionDetector)
This method copies all properties of this object to another.
Definition: CScope.cpp:388
int m_signals[4][C_SCOPE_MAX_SAMPLES]
Data values for all signals.
Definition: CScope.h:174
cColorf m_colorSignal1
Color settings for signal 1.
Definition: CScope.h:152
double getRangeMax() const
This method returns the maximum value from the range.
Definition: CScope.h:139
This class defines a color using a GLfloat representation for each component.
Definition: CColor.h:138
cVector3d m_scopePosition
Position of scope in reference to Panel.
Definition: CScope.h:195
cColorf m_colorSignal0
Color settings for signal 0.
Definition: CScope.h:149
Definition: CAudioBuffer.cpp:56
virtual ~cScope()
Destructor of cScope.
Definition: CScope.h:92
double getLineWidth() const
This method returns the line width of the signal.
Definition: CScope.h:114
double m_lineWidth
Width used to render lines.
Definition: CScope.h:186
This class implements a 2D scope to display signals.
Definition: CScope.h:80
double m_scopeHeight
Internal height of scope data display.
Definition: CScope.h:192
virtual cScope * copy(const bool a_duplicateMaterialData=false, const bool a_duplicateTextureData=false, const bool a_duplicateMeshData=false, const bool a_buildCollisionDetector=false)
This method creates a copy of itself.
Definition: CScope.cpp:357
cColorf m_colorSignal3
Color settings for signal 3.
Definition: CScope.h:158
cScope()
Constructor of cScope.
Definition: CScope.cpp:59