Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
PoAutoCubeAxis.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-2021 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24#ifndef _PO_AUTO_CUBE_AXIS_
25#define _PO_AUTO_CUBE_AXIS_
26
27#include <Inventor/fields/SoSFEnum.h>
28#include <Inventor/fields/SoSFString.h>
29#include <Inventor/fields/SoSFVec3f.h>
30#include <Inventor/fields/SoSFBool.h>
31#include <Inventor/fields/SoSFMatrix.h>
32
33#include <MeshViz/graph/PoBaseAxis.h>
34#include <MeshViz/graph/PbMiscTextAttr.h>
35
36struct Pedge ;
37class PoCartesianAxis ;
38
107 SO_KIT_HEADER(PoAutoCubeAxis) ;
108
109 /* Define fields for new parts */
110 // Faces of the background
111 SO_KIT_CATALOG_ENTRY_HEADER(backgroundFaceSep) ;
112 SO_KIT_CATALOG_ENTRY_HEADER(backgroundFaceApp) ;
113 SO_KIT_CATALOG_ENTRY_HEADER(backgroundFace) ;
114
115 // Grid lines of main graduations
116 SO_KIT_CATALOG_ENTRY_HEADER(mainGradGridSep) ;
117 SO_KIT_CATALOG_ENTRY_HEADER(mainGradGridApp) ;
118 SO_KIT_CATALOG_ENTRY_HEADER(mainGradGrid) ;
119
120 // Grid lines of sub graduations
121 SO_KIT_CATALOG_ENTRY_HEADER(subGradGridSep) ;
122 SO_KIT_CATALOG_ENTRY_HEADER(subGradGridApp) ;
123 SO_KIT_CATALOG_ENTRY_HEADER(subGradGrid) ;
124
125 //--------------- X axes --------------------
126 // X axis with vertices 0-3
127 SO_KIT_CATALOG_ENTRY_HEADER(xAxisSwitch03) ;
128 SO_KIT_CATALOG_ENTRY_HEADER(xAxis03) ;
129
130 // X axis with vertices 1-2
131 SO_KIT_CATALOG_ENTRY_HEADER(xAxisSwitch12) ;
132 SO_KIT_CATALOG_ENTRY_HEADER(xAxis12) ;
133
134 // X axis with vertices 6-5
135 SO_KIT_CATALOG_ENTRY_HEADER(xAxisSwitch65) ;
136 SO_KIT_CATALOG_ENTRY_HEADER(xAxis65) ;
137
138 // X axis with vertices 7-4
139 SO_KIT_CATALOG_ENTRY_HEADER(xAxisSwitch74) ;
140 SO_KIT_CATALOG_ENTRY_HEADER(xAxis74) ;
141
142 //--------------- Y axes --------------------
143 // Y axis with vertices 0-1
144 SO_KIT_CATALOG_ENTRY_HEADER(yAxisSwitch01) ;
145 SO_KIT_CATALOG_ENTRY_HEADER(yAxis01) ;
146
147 // Y axis with vertices 7-6
148 SO_KIT_CATALOG_ENTRY_HEADER(yAxisSwitch76) ;
149 SO_KIT_CATALOG_ENTRY_HEADER(yAxis76) ;
150
151 // Y axis with vertices 4-5
152 SO_KIT_CATALOG_ENTRY_HEADER(yAxisSwitch45) ;
153 SO_KIT_CATALOG_ENTRY_HEADER(yAxis45) ;
154
155 // Y axis with vertices 3-2
156 SO_KIT_CATALOG_ENTRY_HEADER(yAxisSwitch32) ;
157 SO_KIT_CATALOG_ENTRY_HEADER(yAxis32) ;
158
159 //--------------- Z axes --------------------
160 // Z axis with vertices 0-7
161 SO_KIT_CATALOG_ENTRY_HEADER(zAxisSwitch07) ;
162 SO_KIT_CATALOG_ENTRY_HEADER(zAxis07) ;
163
164 // Z axis with vertices 3-4
165 SO_KIT_CATALOG_ENTRY_HEADER(zAxisSwitch34) ;
166 SO_KIT_CATALOG_ENTRY_HEADER(zAxis34) ;
167
168 // Z axis with vertices 2-5
169 SO_KIT_CATALOG_ENTRY_HEADER(zAxisSwitch25) ;
170 SO_KIT_CATALOG_ENTRY_HEADER(zAxis25) ;
171
172 // Z axis with vertices 1-6
173 SO_KIT_CATALOG_ENTRY_HEADER(zAxisSwitch16) ;
174 SO_KIT_CATALOG_ENTRY_HEADER(zAxis16) ;
175
176
177 public:
178
196
197 /* Fields */
198
203
208
218
228
233
238
243
244
245
253
261
269
274
283
291
300
309
310
311
312 /* Methods */
313
318
322 PoAutoCubeAxis(const SbVec3f &_start, const SbVec3f &_end, AxisType xAxisType,
323 AxisType yAxisType, AxisType zAxisType, const char *xTtle = NULL,
324 const char *yTtle = NULL, const char *zTtle = NULL) ;
325
329 virtual void GLRender( SoGLRenderAction *action );
330 virtual void rebuild() ;
331
332
333 private:
334 static void initClass() ;
335 static void exitClass() ;
336
337 private:
338 virtual ~PoAutoCubeAxis() ;
339 // Destructor
340
341 // Methods
342 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
343 virtual void setDefaultOnNonWritingFields() ;
344
345 private:
346 // Init method
347 void init(SbBool isDefault, const SbVec3f &_start, const SbVec3f &_end,
348 AxisType xAxisType, AxisType yAxisType, AxisType zAxisType,
349 const char *xTtle, const char *yTtle, const char *zTtle) ;
350
351 // Compute the 8 vertices of the parallelepiped from the points start and end
352 void computeParalVertices() ;
353
354 // Compute the 6 normal of each face of the parallelepiped
355 void computeParalFaceNormals() ;
356
357 // Sets all attributes for the axis to build from to the edge it comes from
358 // and the coordinates of this edge (m_paralVertices)
359 void buildAxis(const Pedge *edge, PoCartesianAxis *axis) ;
360
361 // Draw all backgroud faces
362 void drawBackgroundFaces() ;
363
364 // Handle grads drawing
365 void handleGradsDrawing(const int *indexVisibleEdges, int nbVisibleEdges, PoCartesianAxis *axis[12]) ;
366
367 // Eliminate intersecting graduations
368 void eliminateIntersectingGrads(const int *indexVisibleEdges, const int nbVisibleEdges,
369 PoCartesianAxis *axis[12]) ;
370
371 // Draw grid lines for main and sub graduations
372 void drawGridLines(PoCartesianAxis *axis[12]) ;
373
374 // Reset all parts
375 void resetAllParts() ;
376
377 // Rebuild auto cube axis without taking into account
378 // matrix transform
379 void rebuildWithoutMatrix() ;
380
381 // This method catch all actions on this nodekit
382 // and if the nodekit is not update or modelling, viewing,
383 // or projection matrix have changed then it rebuild the nodekit.
384 static void catchActionCB(void *data, SoAction *action) ;
385
386 // The 8 vertices of the parallelepiped
387 SbVec3d m_paralVertices[8] ;
388
389 // Indicate if the auto cube axis box must be rebuild
390 // in function of matrix (modelling, viewing, projection) or
391 // not (use for all action which not store modelling, viewing or
392 // projection matrix.
393 SbBool m_rebuildWithoutMatrix ;
394
395 // Indicate if it the first instance of this class
396 static SbBool m_firstInstance ;
397
398 SoSFEnum xAxisType, yAxisType, zAxisType ;
399
400 // Sensors
401 FieldSensorList m_fieldSensorList ;
402
403 // List of fields defined in this class
404 SoFieldList m_fieldList ;
405} ;
406
407/*----------------------------------------------------------------------------*/
408
409#endif /* _PO_AUTO_CUBE_AXIS_ */
410
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Class to build a set of ...
SoSFMatrix modellingMatrix
This modelling matrix is used to determine the visibility of each face (and thus the axes to draw).
virtual void rebuild()
Forces the node kit to be rebuilt immediately.
SoSFVec3f gradStart
Defines the value of the graduation (tick label) corresponding to the starting point of this group of...
SoSFVec3f start
Start point of the parallelepiped's diagonal.
SoSFBool isGridLinesZVisible
Sets the visibility of the grid lines of the Z axes displayed on the visible faces.
SoSFVec3f gradEnd
Defines the value of the graduation (tick label) corresponding to the end point of this group of axes...
SoSFString zTitle
Title of the Z axes.
SoSFVec3f end
End point of the parallelepiped's diagonal.
SoSFBool isBackgroundFacesVisible
Sets the visibility of visible faces.
SoSFString xTitle
Title of the X axes.
virtual void GLRender(SoGLRenderAction *action)
Forces node-kit rebuilding.
SoSFMatrix viewingMatrix
This viewing matrix is used to determine the visibility of each face (and thus the axes to draw).
SoSFBool isGridLinesYVisible
Sets the visibility of the grid lines of the Y axes displayed on the visible faces.
PoAutoCubeAxis(const SbVec3f &_start, const SbVec3f &_end, AxisType xAxisType, AxisType yAxisType, AxisType zAxisType, const char *xTtle=NULL, const char *yTtle=NULL, const char *zTtle=NULL)
Constructor.
SoSFBool isGridLinesXVisible
Sets the visibility of the grid lines of the X axes displayed on the visible faces.
PoAutoCubeAxis()
Default constructor.
SoSFString yTitle
Title of the Y axes.
AxisType
Type of axes on the parallelepiped edges.
@ LOGARITHMIC
Logarithmic axis.
@ LINEAR
Linear axis.
@ GENERALIZED
Generalized axes.
SoSFBool isIntersectingGradsVisible
Given A1 and A2 2 consecutive axes with the first (the last) graduation of A1 intersects the first or...
SoSFMatrix projectionMatrix
This modelling matrix is used to determine the visibility of each face (and thus the axes to draw).
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Base class for all axis ...
Definition PoBaseAxis.h:37
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract class for carte...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D vector class ...
Definition SbVec.h:1214
3D vector class.
Definition SbVec.h:932
Abstract base class for all actions.
Definition SoAction.h:132
Maintains a list of pointers to fields.
Definition SoFieldList.h:72
Renders a scene graph using Open Inventor's Render Engine.
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a 4x4 matrix.
Definition SoSFMatrix.h:86
Field containing a string.
Definition SoSFString.h:117
Field containing a three-dimensional vector.
Definition SoSFVec3f.h:80
int SbBool
Boolean type.
Definition SbBase.h:87