Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoProjection.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 : G.TALLEC (May 2007)
22**=======================================================================*/
23
24
25#ifndef _SO_PROJECTION_
26#define _SO_PROJECTION_
27
35
36#include <Inventor/STL/vector>
43
44#if defined(_WIN32)
45#pragma warning( push )
46#pragma warning( disable: 4251 )
47#endif
48
49class SoFieldSensor;
51
142class SoProjection : public SoNode
143{
144
146
147public:
148
153
158
163
169
174
179
184
192 void addProjection( SbString &projectionName, SbProjection *projection , int id);
193
199 void setProjection( SbProjection *projection );
200
205
210 { return m_projection; }
211
219 SoNode *node,
220 int32_t numCoords,
221 const SbVec3f *coords);
222
223 private:
224 virtual void doAction ( SoAction *action );
225 virtual void GLRender ( SoGLRenderAction *action ){ return doAction( action );}
226 virtual void callback ( SoCallbackAction *action ){ return doAction( action );}
227 virtual void getBoundingBox ( SoGetBoundingBoxAction *action ){ return doAction( action );}
228 virtual void getMatrix ( SoGetMatrixAction *action ){ return doAction( action );}
229 virtual void handleEvent ( SoHandleEventAction *action ){ return doAction( action );}
230 virtual void pick ( SoPickAction *action ){ return doAction( action );}
231 virtual void rayPick ( SoRayPickAction *action ){ return doAction( action );}
232
233 private:
234
235 static void initClass();
236 static void exitClass();
237
238 static SbBool getLocalPoint( SoState* state, SbVec3f &point);
239
243 static void checkProjection( SoState* state, SbVec3f &point, SbBool inverse= FALSE);
244
249 bool checkProjection( SoNode *node, SoAction *action, SoMFVec3f &coords );
250
254 void resetProjection( SoAction *action, SoMFVec3f &coords);
255
259 void setParametersIn( SoMFString &parameters);
260
264 static void parametersChangedCB( void *data, SoSensor* );
265
266 static void typeIdChangedCB( void *data, SoSensor* );
267
268private:
269
270 // Destructor
271 virtual ~SoProjection();
272
273 // ids
274 std::vector< int > m_projIds;
275
276 // names
277 std::vector< SbString > m_projNames;
278
279 // associated projections
280 std::vector< SbProjection *> m_projections;
281
282 // current projection
283 SbProjection* m_projection;
284
285 // created spherical projection
286 SbSphericalProjection* m_sphericalProjection;
287
288 // coords used for temporary check
289 SbVec3f* m_storedCoords;
290
291 SbBool m_enableDeleteValues;
292
293 // Field sensors
294 SoFieldSensor* m_parameterSensor;
295
296 SoFieldSensor* m_floatParameterSensor;
297
298 //Called if projection type id has changed
299 SoFieldSensor* m_projTypeIdSensor;
300};
301
302#if defined(_WIN32)
303#pragma warning( pop )
304#endif
305
306#endif /* _SO_PROJECTION_ */
307
#define FALSE
Possible value of SbBool.
Definition SbBase.h:75
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
Base class for coordinate projection classes.
Spherical coordinate projection.
Class for smart character strings.
Definition SbString.h:202
3D vector class.
Definition SbVec.h:932
Abstract base class for all actions.
Definition SoAction.h:132
Performs a generic traversal of a scene graph or path.
Sensor class that can be attached to Open Inventor fields.
Renders a scene graph using Open Inventor's Render Engine.
Computes bounding box of a scene.
Computes transformation matrix for a subgraph.
Allows nodes in a graph to receive input events.
Multiple-value field containing any number of floating point values.
Definition SoMFFloat.h:90
Multiple-value field containing any number of strings.
Definition SoMFString.h:116
Multiple-value field containing any number of three-dimensional vectors.
Definition SoMFVec3f.h:181
Abstract base class for all database nodes.
Definition SoNode.h:145
Abstract base class for picking objects in a scene.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Coordinate proje...
SoSFInt32 projTypeId
Current projection id.
SoSFMatrix matrix
Matrix that can be applied before projecting a point.
static SbVec3f * checkProjection(SoState *state, SoNode *node, int32_t numCoords, const SbVec3f *coords)
Apply projection to given coordinates.
SoSFBool isOn
If set to FALSE, projection is inactive.
void setProjection(SbProjection *projection)
Set the current projection.
SoMFString parametersIn
String parameters stored for projections.
SbProjection * getProjection() const
Return current projection.
SoMFString parameters
String parameters stored for projections.
SoProjection()
Constructor.
void getCurrentProjectionInfos(SbString &name, int &id)
Return current projection name and id.
SoMFFloat floatParameters
Float parameters stored for projections.
void addProjection(SbString &projectionName, SbProjection *projection, int id)
Add a projection with the given name and id to the list.
Intersects objects with a ray cast into scene.
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing a int32_t integer.
Definition SoSFInt32.h:80
Field containing a 4x4 matrix.
Definition SoSFMatrix.h:86
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:97
Traversal state.
Definition SoState.h:74
int SbBool
Boolean type.
Definition SbBase.h:87