Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
PbDataMapping.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24#ifndef _PB_DATA_MAPPING_
25#define _PB_DATA_MAPPING_
26
27#include <MeshViz/graph/PbBase.h>
28
29#include <Inventor/SbColor.h>
30
57class PbDataMapping : public PbBase {
58
59 public:
60
61 typedef float PbHLSColor[3] ;
62
63
64
69
74
78 PbDataMapping(const PbDataMapping &dataMapping) ;
79
83 PbDataMapping& operator=(const PbDataMapping &dataMapping) ;
84
90 const SbColor *getRGBColor(float value) const;
91
97 const float *getHLSColor(float value) const;
98
105 const SbColor *getRGBColor(float value, float &transparency) const;
106
113 const float *getHLSColor(float value, float &transparency) const;
114
115
116
120 void setMinThreshold(float threshold_min) ;
121
125 void setMinThreshold(float threshold_min, const SbColor &cmin, float transp_min=0.0) ;
126
131 void setMinThreshold(float threshold_min, PbHLSColor cmin, float transp_min=0.0) ;
132
136 void setMaxThreshold(float threshold_max) ;
137
141 void setMaxThreshold(float threshold_max, const SbColor &cmax, float transp_max=0.0) ;
142
147 void setMaxThreshold(float threshold_max, PbHLSColor cmax, float transp_max=0.0) ;
148
155 const SbColor* getMinRGBThreshold(float &threshold_min) const ;
156
162 const float* getMinHLSThreshold(float &threshold_min) const ;
163
169 const SbColor* getMinRGBThreshold(float &threshold_min, float &transp_min) const ;
170
176 const float* getMinHLSThreshold(float &threshold_min, float &transp_min) const ;
177
184 const SbColor* getMaxRGBThreshold(float &threshold_max) const ;
185
191 const float* getMaxHLSThreshold(float &threshold_max) const ;
192
198 const SbColor* getMaxRGBThreshold(float &threshold_max, float &transp_max) const ;
199
205 const float* getMaxHLSThreshold(float &threshold_max, float &transp_max) const ;
206
211
215 void thresholdsEnabled(SbBool &min, SbBool &max) const
216 { min = m_minEnabled ; max = m_maxEnabled ;}
217
223
228 { return m_transparencyEnabled ; }
229
235
241
242 /*---------------------------------------------------------------------------*/
243
244
245 private:
246 // Data mapping type
247 enum ClassType {
248 DATA_MAPPING,
249 LINEAR_DATA_MAPPING,
250 NON_LINEAR_DATA_MAPPING1,
251 NON_LINEAR_DATA_MAPPING2
252 } ;
253
254 virtual ClassType getClassType() const
255 { return DATA_MAPPING ; }
256
257 uint32_t getId() const { return m_uniqueId; }
258
259 private:
260 // Notify a change to all connected objects
261 void notifyChange();
262
263 // Compute a color interpolation
264 // Interpolation between (c1, v1) and (c2, v2) for a vi value
265 // vi is updated.
266 static void colorInterpolation(const SbColor &c1, float v1,
267 const SbColor &c2, float v2,
268 float vi, SbColor *ci) ;
269 static void colorInterpolation(const SbColor &c1, float t1, float v1,
270 const SbColor &c2, float t2, float v2,
271 float vi, SbColor *ci, float &ti) ;
272 static void transparencyInterpolation(float t1, float v1,
273 float t2, float v2,
274 float vi, float ti) ;
275
276 float m_transparencyValueDeletedParts;
277 SbColor *m_colorValue ;
278 virtual const SbColor* computeColor(float value) const=0;
279 virtual const SbColor* computeColor(float value, float &transparency) const=0;
280 SbBool m_transparencyEnabled;
281
282 // Unique id for this node.
283 uint32_t m_uniqueId;
284
285 private:
286 static uint32_t sm_nextUniqueId;
287
288 // Used by constructor per copy and affectation operator
289 void copy(const PbDataMapping &dataMapping, SbBool isConstructorPerCopy) ;
290
291 float m_thresholdMin, m_thresholdMax, m_transparencyMin, m_transparencyMax;
292 SbColor m_colorMin, m_colorMax ;
293 SbBool m_minEnabled, m_maxEnabled, m_isMinColor, m_isMaxColor;
294} ;
295
296/*----------------------------------------------------------------------------*/
297
298#endif /* _PB_DATA_MAPPING_ */
299
300
301
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract class for all b...
Definition PbBase.h:49
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract class for data ...
const SbColor * getMaxRGBThreshold(float &threshold_max) const
Gets the maximum threshold and its associated RGB color.
PbDataMapping()
Default constructor.
PbDataMapping(const PbDataMapping &dataMapping)
Copy constructor.
const float * getHLSColor(float value, float &transparency) const
Gets the HLS color and the transparency associated to a value.
const float * getMaxHLSThreshold(float &threshold_max, float &transp_max) const
Gets the maximum threshold, its associated HLS color and transparency.
const float * getMaxHLSThreshold(float &threshold_max) const
Gets the maximum threshold and its associated HLS color.
void setMaxThreshold(float threshold_max, const SbColor &cmax, float transp_max=0.0)
Sets a maximum threshold, associated to a RGB color and a transparency value.
const SbColor * getRGBColor(float value) const
Gets RGB color associated to a value.
SbBool isTransparencyEnabled() const
Returns TRUE if transparency is enabled, otherwise FALSE.
PbDataMapping & operator=(const PbDataMapping &dataMapping)
Assignment operator.
const float * getMinHLSThreshold(float &threshold_min) const
Gets the minimum threshold and its associated HLS color.
void setTransparencyValueDeletedParts(float value)
Sets a value that defines the following property : each primitive part of which transparency >= value...
void enableTransparency(SbBool flag)
Enable/Disable the taking into account of transparency.
float PbHLSColor[3]
~PbDataMapping()
Destructor.
float getTransparencyValueDeletedParts() const
Gets a value that defines the following property : each primitive part of which transparency >= value...
const SbColor * getMinRGBThreshold(float &threshold_min, float &transp_min) const
Gets the minimum threshold, its associated RGB color and transparency.
const SbColor * getMinRGBThreshold(float &threshold_min) const
Gets the minimum threshold and its associated RGB color.
void setMinThreshold(float threshold_min, PbHLSColor cmin, float transp_min=0.0)
Sets a minimum threshold, associated to a HLS color and a transparency value.
const SbColor * getMaxRGBThreshold(float &threshold_max, float &transp_max) const
Gets the maximum threshold, its associated RGB color and transparency.
void setMaxThreshold(float threshold_max, PbHLSColor cmax, float transp_max=0.0)
Sets a maximum threshold, associated to a HLS color and a transparency value.
const SbColor * getRGBColor(float value, float &transparency) const
Gets the RGB color and the transparency associated with a value.
const float * getHLSColor(float value) const
Gets HLS color associated with a value.
void thresholdsEnabled(SbBool &min, SbBool &max) const
Returns min=TRUE if the minimum threshold is enabled, otherwise FALSE.
void setMaxThreshold(float threshold_max)
Sets a maximum threshold.
void setMinThreshold(float threshold_min)
Sets a minimum threshold.
const float * getMinHLSThreshold(float &threshold_min, float &transp_min) const
Gets the minimum threshold, its associated HLS color and transparency.
void setMinThreshold(float threshold_min, const SbColor &cmin, float transp_min=0.0)
Sets a minimum threshold, associated to a RGB color and a transparency value.
void enableThresholds(SbBool min, SbBool max)
Enable/Disable the taking into account of threshold values.
Color vector class.
Definition SbColor.h:82
int SbBool
Boolean type.
Definition SbBase.h:87