Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SbProjection.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#ifndef _SB_PROJECTION_
25#define _SB_PROJECTION_
26
27#include <Inventor/SbLinear.h>
28#include <Inventor/SbString.h>
29
30#include <Inventor/STL/vector>
31
32#if defined(_WIN32)
33#pragma warning( push )
34#pragma warning( disable: 4251 ) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
35#endif
36
37#define NUM_MAX_PARAMS 256
38#define MAX_PARAM_LENGTH 256
39
40class SoProjection;
41
97{
98
99public:
100
105
110
115
119 virtual ~SbProjection();
120
124 virtual void init(){}
125
129 virtual void exit(){}
130
134 virtual void inverse(SbVec3f &point);
135
146 virtual bool getProjectedBoundingBox(SbBox3f& bbox);
147
152 void project(SbVec3f &point);
153
158 void project( int numPoints, float *points);
159
165 void project(int32_t numCoords, const SbVec3f *coords, SbVec3f *projectedCoords);
166
171 {return m_projection;}
172
176 virtual void setParameter( int parameterId, const SbString &parameterString );
177
181 virtual void setParameter( int parameterId, const float &parameterFloat );
182
186 void setNumStringParameters( int numParameters );
187
191 void setNumFloatParameters( int numParameters );
192
197
202
207 SbBool getParameter( int pos, SbString& parameter ) const;
208
214 SbBool getParameter( int pos, float& parameter ) const;
215
220 virtual void apply(SbVec3f &point);
221
225 virtual void applyPreProjection( SbVec3f &point );
226
230 virtual void applyPostProjection( SbVec3f &point );
231
232private:
233
238 virtual void internalSetParameter( int parameterId, const SbString &parameterString, SbBool notifyNode = TRUE, SbBool callInit = TRUE);
239
244 virtual void internalSetParameter( int parameterId, const float &parameterString, SbBool notifyNode = TRUE, SbBool callInit = TRUE);
245
250 virtual void internalSetParameterIn( int parameterId, const SbString &parameterString, SbBool notifyNode = TRUE, SbBool callInit = TRUE);
251
252 //copy the parameters to the projection node.
253 void copyParams();
254
255private:
256
257 //initialisation of parameters.
258 void initParameters();
259
260 //synchronization with node.
261 void afterSettingParameters( SbBool notifyNode, SbBool callInit );
262
263 //string parameters list.
264 char *m_stringParameters[NUM_MAX_PARAMS];
265
266 //number of used string params.
267 int m_numStringParams;
268
269 //string parameters list.
270 char *m_stringParametersIn[NUM_MAX_PARAMS];
271
272 //number of used string params.
273 int m_numStringParamsIn;
274
275 //Float parameters.
276 std::vector< float > m_floatParameters;
277
278 //Apply matrix before projecting.
279 void applyMatrix(SbVec3f &point);
280
281 static const double deg2rad;
282 static const double rad2deg;
283
284private:
286 SoProjection *m_projection;
287};
288
289
290inline void SbProjection::apply(SbVec3f &)
291{}
292
294{}
295
296inline void SbProjection::applyPreProjection( SbVec3f &)
297{}
298
299inline void SbProjection::applyPostProjection( SbVec3f &)
300{}
301
303{ return false; }
304
305#if defined(_WIN32)
306#pragma warning( pop )
307#endif
308
309#endif /* _SB_PROJECTION_ */
310
311
#define SoEXTENDER_Documented
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
#define NUM_MAX_PARAMS
3D box class.
Definition SbBox.h:649
Base class for coordinate projection classes.
void project(int numPoints, float *points)
Apply the complete computation to a set of points.
void project(int32_t numCoords, const SbVec3f *coords, SbVec3f *projectedCoords)
Apply the complete computation to a set of coordinates.
SbProjection()
Constructor.
virtual void exit()
Exit method.
void project(SbVec3f &point)
Apply the complete computation (matrix, pre-projection, projection, post-projection) to one point.
virtual void inverse(SbVec3f &point)
Apply the inverse coordinate to one point.
void setNumFloatParameters(int numParameters)
Set number of float parameters to use.
virtual void setParameter(int parameterId, const SbString &parameterString)
Set string parameter.
virtual ~SbProjection()
Destructor.
void setNumStringParameters(int numParameters)
Set number of string parameters to use.
SbBool getParameter(int pos, float &parameter) const
Get float parameter at position pos.
virtual void setParameter(int parameterId, const float &parameterFloat)
Set float parameter.
SbProjection(SoProjection *node)
Constructor.
SbProjection(const SbProjection &proj)
Copy constructor.
int getNumFloatParameters() const
Get number of used float parameters.
virtual bool getProjectedBoundingBox(SbBox3f &bbox)
Return projected bounding box if available.
SoProjection * getProjectionNode() const
Return associated projection node.
SbBool getParameter(int pos, SbString &parameter) const
Get string parameter at position pos.
virtual void init()
Initialisation method.
int getNumStringParameters() const
Get number of used string parameters.
Class for smart character strings.
Definition SbString.h:202
3D vector class.
Definition SbVec.h:932
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Coordinate proje...
int SbBool
Boolean type.
Definition SbBase.h:87