Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
PoLogAxis.h
Go to the documentation of this file.
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 _PO_LOG_AXIS_
25#define _PO_LOG_AXIS_
26
27
32
33
35
111
113
114 /* Define fields for new parts */
115 SO_KIT_CATALOG_ENTRY_HEADER(multFactorSep) ;
116 SO_KIT_CATALOG_ENTRY_HEADER(multFactorApp) ;
117 SO_KIT_CATALOG_ENTRY_HEADER(multFactor) ;
118
119 SO_KIT_CATALOG_ENTRY_HEADER(decadeTextSep) ;
120 SO_KIT_CATALOG_ENTRY_HEADER(decadeTextApp) ;
121 SO_KIT_CATALOG_ENTRY_HEADER(decadeText) ;
122
123
124 public:
125
139
161
195
217
218
219
220 /* Fields */
221
229
235
241
247
253
260
265
273
289
294 { init(TRUE, SbVec3f(0.,0.,0.), 1, XY, DECADE_LIST_AUTO, NULL, 0, 0.0,0.0) ; }
295
300 PoLogAxis(const SbVec3f &_start, float _end, PoCartesianAxis::Type _type,
301 DecadeListDef _decadeListDef = DECADE_LIST_AUTO,
302 const unsigned short *_decadeList = NULL, short _numDecade = 0)
303 { init(FALSE, _start, _end, _type, _decadeListDef, _decadeList, _numDecade, 0.0,0.0) ; }
304
310 PoLogAxis(const SbVec3f &_start, float _end, PoCartesianAxis::Type _type,
311 float _gradStart, float _gradEnd,
312 DecadeListDef _decadeListDef = DECADE_LIST_AUTO,
313 const unsigned short *_decadeList = NULL, short _numDecade = 0)
314 { init(FALSE, _start, _end, _type, _decadeListDef, _decadeList, _numDecade, _gradStart, _gradEnd) ; }
315
316 /* Methods */
317
321 virtual void rebuild() ;
322
328 void getLogGrad(unsigned short &numDecade, unsigned short decadeList[8],
330 SbString &decadeFontName, float &decadeFontSize) const ;
331
337 void getMultFactor(MultFactorPosition &position, float &distAxis) const ;
338
339 /*----------------------------------------------------------------------------*/
340
341
342 private:
343 static void initClass() ;
344 static void exitClass() ;
345
346 struct MultFactor {
347 MultFactorPosition position ;
348 float distAxis ;
349 } ;
350
351 struct Decade {
352 DecadeRep rep ;
353 DecadeListDef listDef ;
354 int *values ;
355 size_t number ;
356 SbString fontName ;
357 float fontSize ;
358 } ;
359
360 private:
361 struct LogAxisAttr {
362 MultFactor multFactor ;
363 TenPowGradRep tenPowerRep ;
364 Decade decadeGrad ;
365
366 // coord of the first and last graduations
367 // theses coord is either X, Y or Z depending on the axis orientation
368 double firstAxisCoord;
369 double lastAxisCoord;
370 } ;
371 // Log axis attr
372
373 // Methods
374 // Destructor
375 virtual ~PoLogAxis() ;
376 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
377 virtual void setDefaultOnNonWritingFields() ;
378
379 // Save all axis attributes which can be modified by MeshViz.
380 virtual void saveAxisAttr() ;
381
382 private:
383
384
385 // Init method
386 void init(SbBool isDefault, const SbVec3f &start, float end, Type typeAxis,
387 DecadeListDef decadeListDef, const unsigned short *decadeList,
388 short numDecade,float _gradStart, float _gradEnd) ;
389
390 void getLogGrads(float firstVal, float lastVal, float &stepValue, float &firstMainValue, size_t &numMainGrad);
391
392 // Returns the coord of a grad according to its value.
393 // The value of a graduation is the value used to build the text of the graduation.
394 //
395 // The coord equals its value if the iv fields gradStart and gradEnd are equal.
396 // Otherwise a mapping is done between intervals [gradStart,gradEnd] and
397 // this.start,this.end]
398 double getGradCoord(double gradValue) const;
399
400 // Returns the value of a grad according to its coordinate.
401 // Reverse method of getGradCoord
402 double getGradValue(double coord) const;
403
404 // Build log graduations - The graduations (main grad and decades grad)
405 // are built under the nodes mainGroup and secondaryGroup.
406 void buildLogGrad(std::vector<float> &mainGradX, std::vector<SecondaryLogGrad> &subGraduations,
407 float stepValue, SoGroup *mainGroup, SoGroup *secondaryGroup) ;
408
409 // Compute log grad font size
410 void computeLogGradFontSize(size_t numMainGrad, float stepValue, const char **main_str,
411 const char **main_ten_pow_str, size_t numSecdGrad,
412 const char **secd_str, const char **secd_ten_pow_str,
413 float min_grad_dist, SbBool main_grad_pres_auto,
414 float &main_font_size, float &secd_font_size) ;
415
416 // Computed logarithmic axis attributes
417 LogAxisAttr logAxisAttr ;
418
419 // Sensors
420 FieldSensorList fieldSensorList ;
421
422 // List of fields defined in this class
423 SoFieldList fieldList ;
424
425} ;
426
427/*----------------------------------------------------------------------------*/
428
429#endif /* _PO_LOG_AXIS_ */
430
431
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
#define FALSE
Possible value of SbBool.
Definition SbBase.h:75
static void init()
#define SO_KIT_CATALOG_ENTRY_HEADER(partName)
Definition SoSubKit.h:107
#define SO_KIT_HEADER(className)
Definition SoSubKit.h:91
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract class for carte...
SoSFVec3f start
Defines the start of the axis.
Type
Type of axis orientation.
@ XY
X-Axis in the plane XY.
SoSFFloat end
Defines the end of the axis.
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Class to build a logarit...
Definition PoLogAxis.h:110
SoSFEnum multFactorPosition
Position of the multiplicative factor.
Definition PoLogAxis.h:264
SoSFEnum tenPowerRep
Defines the representation of power of ten graduations.
Definition PoLogAxis.h:240
PoLogAxis()
Constructor.
Definition PoLogAxis.h:293
SoSFEnum decadeListDef
Specifies if the list of decade graduations is given by the user or is automatically computed.
Definition PoLogAxis.h:234
MultFactorPosition
Type of position of the multiplicative factor.
Definition PoLogAxis.h:199
@ MULT_FACTOR_START
The multiplicative factor is at the start of the axis.
Definition PoLogAxis.h:203
@ MULT_FACTOR_EXTR
The multiplicative factor is at the start and at the end of the axis.
Definition PoLogAxis.h:211
@ MULT_FACTOR_GRAD
The multiplicative factor is at the graduations of the axis.
Definition PoLogAxis.h:215
@ MULT_FACTOR_END
The multiplicative factor is at the end of the axis.
Definition PoLogAxis.h:207
PoLogAxis(const SbVec3f &_start, float _end, PoCartesianAxis::Type _type, DecadeListDef _decadeListDef=DECADE_LIST_AUTO, const unsigned short *_decadeList=NULL, short _numDecade=0)
Constructor.
Definition PoLogAxis.h:300
SoSFFloat multFactorDistAxis
Distance from the multiplicative factor to the axis.
Definition PoLogAxis.h:272
DecadeRep
Type of presentation of the axis decades.
Definition PoLogAxis.h:165
@ DECADE_DECIMAL
Decade graduations are displayed in decimals.
Definition PoLogAxis.h:177
@ DECADE_NONE
No decade graduations are displayed.
Definition PoLogAxis.h:169
@ DECADE_DIGIT
Decade graduations are displayed using a digit from 2 to 9
Definition PoLogAxis.h:181
@ DECADE_AUTO
giving the multiple of the power of ten.
Definition PoLogAxis.h:189
@ DECADE_AS_TEN_POWER
Decade graduations are displayed as power of ten graduations.
Definition PoLogAxis.h:173
SoMFUShort decadeList
List of graduations between two power of ten graduations (decade graduations).
Definition PoLogAxis.h:228
SoSFString decadeFontName
Decade font name.
Definition PoLogAxis.h:252
SoSFUShort maxGradNum
Maximum number of logarithmic graduations displayed.
Definition PoLogAxis.h:288
TenPowGradRep
Type of presentation of the power of ten.
Definition PoLogAxis.h:143
@ TEN_POWER_POW10
The graduations are specified in powers of ten.
Definition PoLogAxis.h:147
@ TEN_POWER_AUTO
The graduations are specified in powers of ten or in decimals,.
Definition PoLogAxis.h:155
@ TEN_POWER_DECIMAL
The graduations are specified in decimals.
Definition PoLogAxis.h:151
void getMultFactor(MultFactorPosition &position, float &distAxis) const
Returns the current multiplicative factor attributes (those computed can be different from the associ...
DecadeListDef
Decade list computed automatically or given by the user.
Definition PoLogAxis.h:129
@ DECADE_LIST_NON_AUTO
The list of decade graduations is given by the user.
Definition PoLogAxis.h:137
@ DECADE_LIST_AUTO
The list of decade graduations is automatically computed.
Definition PoLogAxis.h:133
SoSFFloat decadeFontSize
Decade graduations font size.
Definition PoLogAxis.h:259
SoSFEnum decadeRep
Defines the representation of the decade graduations between two power of ten graduations.
Definition PoLogAxis.h:246
void getLogGrad(unsigned short &numDecade, unsigned short decadeList[8], TenPowGradRep &tenPowerRep, DecadeRep &decadeRep, SbString &decadeFontName, float &decadeFontSize) const
Returns the current logarithmic graduations attributes (those computed can be different from the asso...
PoLogAxis(const SbVec3f &_start, float _end, PoCartesianAxis::Type _type, float _gradStart, float _gradEnd, DecadeListDef _decadeListDef=DECADE_LIST_AUTO, const unsigned short *_decadeList=NULL, short _numDecade=0)
Constructor.
Definition PoLogAxis.h:310
virtual void rebuild()
Forces node-kit rebuilding.
Class for smart character strings.
Definition SbString.h:202
3D vector class.
Definition SbVec.h:932
Maintains a list of pointers to fields.
Definition SoFieldList.h:72
Base class for all group nodes.
Definition SoGroup.h:122
Multiple-value field containing any number of unsigned short integers.
Definition SoMFUShort.h:89
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a floating-point value.
Definition SoSFFloat.h:78
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