Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
PoValueLegend.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-2022 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24#ifndef _PO_VALUE_LEGEND_
25#define _PO_VALUE_LEGEND_
26
27#include <MeshViz/graph/PoLegend.h>
28
29#include <MeshViz/graph/PbNumericDisplayFormat.h>
30#include <MeshViz/graph/PbDataMapping.h>
31
32#include <Inventor/fields/SoSFUShort.h>
33#include <Inventor/fields/SoSFString.h>
34
35class PbIsovaluesList ;
36
80class PoValueLegend : public PoLegend {
81
82 SO_KIT_HEADER(PoValueLegend) ;
83
84 /* Define fields for new parts */
85 SO_KIT_CATALOG_ENTRY_HEADER(multFactorSep) ;
86 SO_KIT_CATALOG_ENTRY_HEADER(multFactorApp) ;
87 SO_KIT_CATALOG_ENTRY_HEADER(multFactor) ;
88
89
90 public:
91
92 /* Fields */
93
101
109
114
119
124
125
126
127 /* Methods */
128
136 void setIsovaluesList(PbIsovaluesList *isovaluesList) ;
137
142
149 void setDataMapping(PbDataMapping *dataMapping) ;
150
155
164
170
171 /*----------------------------------------------------------------------------*/
172 private:
173 static void initClass() ;
174 static void exitClass() ;
175
176 private:
177 // Box representation definition
178 // This structure is the representation of one box
179 struct BoxRepresentation {
180 int numColors ; // = 0 no color, = -1 inherited color
181 SbColor colorList[2] ;
182 float value ;
183 float value2 ; // Use for interval legend
184 float transparency ;
185 float transparency2 ; // Use for interval legend
186 SbBool isTransparency ;
187 SbString string ;
188
189 float *percentPerColor ; // Not used for the moment
190 SbBool isColorShaded ; // Not used for the moment
191 } ;
192
193 enum LegendType {
194 DATA_MAPPING_LEGEND,
195 ISOVALUE_LEGEND,
196 NO_LEGEND
197 } ;
198
199 enum LegendOrientation {
200 HORIZONTAL_LEGEND,
201 VERTICAL_LEGEND
202 } ;
203
204 enum MultFactorPosition {
205 MULT_FACTOR_POS_UP_MIDDLE,
206 MULT_FACTOR_POS_RIGHT_MIDDLE,
207 MULT_FACTOR_POS_DOWN_MIDDLE
208 } ;
209
210 // Constructor
211 PoValueLegend() ;
212
213 // Methods
214 virtual void setDefaultOnNonWritingFields() ;
215 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
216
217 // Destructor
218 virtual ~PoValueLegend() ;
219
220 // Manage the connection with PbBase objects
221 virtual void basicObjectChange(PbBase *basicObj) ;
222
223 // Compute boxes representation
224 void computeBoxColors(int index, SbBool isIntervalLegend) ;
225
226 // Compute undef box representation
227 // lowerUndefIndex = -1 no lower undef representation
228 // upperUndefIndex = -1 no upper undef representation
229 void computeUndefBoxRepresentation(int lowerUndefIndex, int upperUndefIndex) ;
230
231 // Compute list of values
232 void computeValuesList() ;
233
234 // Create box representation list
235 void newBoxRepresentationList(int num) ;
236
237 // Delete box representation list
238 void deleteBoxRepresentationList() ;
239
240 // Overloaded methods
241 virtual void addElementsAllCaches() ;
242 virtual void preRebuild() ;
243
244 // List of boxes representation
245 BoxRepresentation *m_boxRepresentationList ;
246 int m_numBoxRepresentation ;
247
248 // List of values to display (this list is computed thanks to
249 // data mapping and isovalues list).
250 float *m_valuesList ;
251 int m_numberValues ;
252 SbBool m_isLowerUndef, m_isUpperUndef ;
253 LegendType m_legendType ;
254
255 // DataMapping Type
256 PbDataMapping::ClassType m_dataMappingType ;
257 float m_transparencyDeletedParts ;
258
259 // Orientation of the legend (HORIZONTAL or VERTICAL)
260 LegendOrientation m_legendOrientation ;
261
262 // Multiplicative factor in the legend
263 SbBool m_isMultFactor ;
264 SbString m_multFactorExpString ; // Exponent of the mult factor
265 float m_multFactorWidth ;
266
267 private:
268 // Default numeric format
269 PbNumericDisplayFormat m_defaultNumericFormat ;
270
271 // Numeric diplay format
272 PbNumericDisplayFormat *m_numericDisplayFormat ;
273
274 // Data mapping
275 PbDataMapping *m_dataMap ;
276
277 // Isovalue list
278 PbIsovaluesList *m_isovalList ;
279
280 // Sensors
281 FieldSensorList m_fieldSensorList ;
282
283 // List of fields defined in this class
284 SoFieldList m_fieldList ;
285} ;
286
287/*----------------------------------------------------------------------------*/
288
289#endif /* _PO_VALUE_LEGEND_ */
290
291
292
293
<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 ...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Class to define a list o...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Class to define a numeri...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract class for legen...
Definition PoLegend.h:55
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract class for value...
const PbIsovaluesList * getIsovaluesList() const
Gets a reference to a PbIsovaluesList object.
void setIsovaluesList(PbIsovaluesList *isovaluesList)
Sets a reference to a PbIsovaluesList object.
const PbDataMapping * getDataMapping() const
Gets a reference to a PbDataMapping object to the association color-values.
SoSFString upperUndefString
String indicating the upper undefined level.
const PbNumericDisplayFormat * getFormat() const
Gets a reference to a PbNumericDisplayFormat object for the numerical display format of the legend va...
void setDataMapping(PbDataMapping *dataMapping)
Sets a reference to a PbDataMapping object to the association color-values.
SoSFString lowerUndefString
String indicating the lower undefined level.
SoSFUShort periodValue
Period to display the values in the legend.
SoSFUShort lastValue
Number of the last value to display.
SoSFUShort firstValue
Number of the first value to display.
void setFormat(PbNumericDisplayFormat *format)
Sets a reference to a PbNumericDisplayFormat object for the numerical display format of the legend va...
Color vector class.
Definition SbColor.h:82
Class for smart character strings.
Definition SbString.h:202
Maintains a list of pointers to fields.
Definition SoFieldList.h:72
Field containing a string.
Definition SoSFString.h:117
Field containing an unsigned short integer.
Definition SoSFUShort.h:79
int SbBool
Boolean type.
Definition SbBase.h:87