Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
PoLinearAxis.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_LINEAR_AXIS_
25#define _PO_LINEAR_AXIS_
26
27
30
31
33#include <MeshViz/graph/PiNumericFormat.h>
35
127
129
130 /* Define fields for new parts */
131 SO_KIT_CATALOG_ENTRY_HEADER(multFactorSep) ;
132 SO_KIT_CATALOG_ENTRY_HEADER(multFactorApp) ;
133 SO_KIT_CATALOG_ENTRY_HEADER(multFactor) ;
134
135
136 public:
137
151
170
171
172
173 /* Fields */
174
180
185
186 /* Ten power attributes */
187
192
200
201 /* Methods */
202
207 { init(SbVec3f(0.,0.,0.), 1., XY, 0.0,0.0, 0.) ; }
208
212 PoLinearAxis(const SbVec3f &_start, float _end, PoCartesianAxis::Type _type, float _step = 0.0)
213 { init(_start, _end, _type, 0.0,0.0, _step) ; }
214
219 PoLinearAxis(const SbVec3f &_start, float _end, PoCartesianAxis::Type _type,
220 float _gradStart, float _gradEnd, float _step = 0.0)
221 { init(_start, _end, _type, _gradStart, _gradEnd,_step) ; }
222
226 virtual void rebuild() ;
227
236
242
247 float getStep() const ;
248
254 void getMultFactor(MultFactorPosition &position, float &distAxis) const ;
255
256 /*----------------------------------------------------------------------------*/
257 private:
258
259 static void initClass() ;
260 static void exitClass() ;
261
262 // Compute step for linear graduations.
263 // If requestStep <= 0., a step is automatically compute thanks
264 // to deltaValue
265 static void getLinGradStep(float deltaValue, float &requestStep) ;
266
267 // Determine the firstGrad and the number of graduations for a linear axis
268 // from graduation fit, the origin and and the extremity of the axis, and
269 // the step between graduations requested.
270 static void getLinGradFirstGrad(GradFit fit, float firstVal,
271 float lastVal, float step, float &firstGrad,
272 size_t &numGrad) ;
273
274 // This method combines the two previous methods
275 static void getLinGrads(GradFit fit, float firstVal, float lastVal,
276 float &requestStep, float &firstGrad, size_t &numGrad) ;
277
278 struct MultFactor {
279 MultFactorPosition position ;
280 float distAxis ;
281 } ;
282
283 private:
284
285 // Linear axis attr
286 struct LinAxisAttr {
287 MultFactor multFactor ;
288 PiNumericFormat numericFormat ;
289
290 float step ;
291 // value of the first graduation (used to build its text)
292 float firstVal ;
293
294 // coord of the first and last graduations
295 // theses coord is either X, Y or Z depending on the axis orientation
296 double firstAxisCoord;
297 double lastAxisCoord;
298 } ;
299
300 // Methods
301 // Destructor
302 virtual ~PoLinearAxis() ;
303 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
304 virtual void setDefaultOnNonWritingFields() ;
305
306 // Manage the connection with PbBase objects
307 virtual void basicObjectChange(PbBase *basicObj) ;
308
309 // Save all axis attributes which can be modified by MeshViz.
310 virtual void saveAxisAttr() ;
311
312 // overloaded methods
313 virtual void addElementsAllCaches() ;
314 virtual void preRebuild() ;
315
316 private:
317 // Init method
318 void init(const SbVec3f &start, float end, Type typeAxis, float _gradStart, float _gradEnd, float s = 0.0) ;
319
320 // Returns the coord of a grad according to its value.
321 // The value of a graduation is the value used to build the text of the graduation.
322 //
323 // The coord equals its value if the iv fields gradStart and gradEnd are equals.
324 // Otherwise a mapping is done between intervals [gradStart,gradEnd] and
325 // this.start,this.end]
326 double getGradCoord(double gradValue) const;
327
328 // Returns the value of a grad according to its coordinate.
329 // Reverse method of getGradCoord
330 double getGradValue(double coord) const;
331
332 // Numeric Display format
333 PbNumericDisplayFormat *m_numericDisplayFormat, m_defaultNumericDisplayFormat ;
334
335 // Computed linear axis attributes
336 LinAxisAttr linAxisAttr ;
337
338 // Sensors
339 FieldSensorList fieldSensorList ;
340
341 // List of fields defined in this class
342 SoFieldList fieldList ;
343
344} ;
345
346/*----------------------------------------------------------------------------*/
347
348#endif /* _PO_LINEAR_AXIS_ */
349
350
#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 all b...
Definition PbBase.h:49
<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 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 linear ...
void setFormat(PbNumericDisplayFormat *format)
Sets a reference to a PbNumericDisplayFormat object for the numerical display format for the graduati...
SoSFFloat multFactorDistAxis
Distance from the multiplicative factor to the axis.
SoSFEnum gradFit
This flag indicates if the first graduation is rounded or not.
PoLinearAxis(const SbVec3f &_start, float _end, PoCartesianAxis::Type _type, float _gradStart, float _gradEnd, float _step=0.0)
Constructor.
@ MULT_FACTOR_GRAD
The multiplicative factor is at the graduations of the axis.
@ MULT_FACTOR_EXTR
The multiplicative factor is at the start and at the end of the axis.
@ MULT_FACTOR_START
The multiplicative factor is at the start of the axis.
@ MULT_FACTOR_END
The multiplicative factor is at the end of the axis.
PoLinearAxis()
Default constructor.
const PbNumericDisplayFormat * getFormat() const
Gets a reference to the PbNumericDisplayFormat object for the numerical display format for the gradua...
SoSFFloat step
Defines the step for the axis.
float getStep() const
Returns the current step attribute (the step computed can be different from the associated field).
GradFit
First graduation rounded or not.
@ GRAD_UNFIT
The first graduation is not rounded.
@ GRAD_FIT
The first graduation is rounded.
PoLinearAxis(const SbVec3f &_start, float _end, PoCartesianAxis::Type _type, float _step=0.0)
Constructor.
virtual void rebuild()
Forces node-kit rebuilding.
SoSFEnum multFactorPosition
Position of the multiplicative factor.
void getMultFactor(MultFactorPosition &position, float &distAxis) const
Returns the current multiplicative factor attributes (those computed can be different from the associ...
3D vector class.
Definition SbVec.h:932
Maintains a list of pointers to fields.
Definition SoFieldList.h:72
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a floating-point value.
Definition SoSFFloat.h:78
int SbBool
Boolean type.
Definition SbBase.h:87