00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _SO_PROJECTION_
00026 #define _SO_PROJECTION_
00027
00028 #include <Inventor/fields/SoSFBool.h>
00029 #include <Inventor/fields/SoMFFloat.h>
00030 #include <Inventor/fields/SoMFVec3f.h>
00031 #include <Inventor/fields/SoMFString.h>
00032 #include <Inventor/fields/SoSFFloat.h>
00033 #include <Inventor/fields/SoSFEnum.h>
00034 #include <Inventor/fields/SoSFMatrix.h>
00035
00036 #include <Inventor/STL/vector>
00037 #include <Inventor/projection/SbProjection.h>
00038 #include <Inventor/actions/SoCallbackAction.h>
00039 #include <Inventor/actions/SoGLRenderAction.h>
00040 #include <Inventor/actions/SoGetBoundingBoxAction.h>
00041 #include <Inventor/actions/SoGetMatrixAction.h>
00042 #include <Inventor/actions/SoHandleEventAction.h>
00043
00044 #if defined(_WIN32)
00045 #pragma warning( push )
00046 #pragma warning( disable: 4251 )
00047 #endif
00048
00049 class SoFieldSensor;
00050 class SbSphericalProjection;
00051
00142 class SoProjection : public SoNode
00143 {
00144
00145 SO_NODE_HEADER( SoProjection );
00146
00147 public:
00148
00152 SoProjection();
00153
00157 SoSFBool isOn;
00158
00162 SoSFMatrix matrix;
00163
00168 SoSFInt32 projTypeId;
00169
00173 SoMFFloat floatParameters;
00174
00178 SoMFString parameters;
00179
00183 SoMFString parametersIn;
00184
00192 void addProjection( SbString &projectionName, SbProjection *projection , int id);
00193
00199 void setProjection( SbProjection *projection );
00200
00204 void getCurrentProjectionInfos(SbString &name, int &id);
00205
00209 inline SbProjection* getProjection() const
00210 { return m_projection; }
00211
00218 static SbVec3f * checkProjection( SoState *state,
00219 SoNode *node,
00220 int32_t numCoords,
00221 const SbVec3f *coords);
00222
00223 private:
00224 virtual void doAction ( SoAction *action );
00225 virtual void GLRender ( SoGLRenderAction *action ){ return doAction( action );}
00226 virtual void callback ( SoCallbackAction *action ){ return doAction( action );}
00227 virtual void getBoundingBox ( SoGetBoundingBoxAction *action ){ return doAction( action );}
00228 virtual void getMatrix ( SoGetMatrixAction *action ){ return doAction( action );}
00229 virtual void handleEvent ( SoHandleEventAction *action ){ return doAction( action );}
00230 virtual void pick ( SoPickAction *action ){ return doAction( action );}
00231 virtual void rayPick ( SoRayPickAction *action ){ return doAction( action );}
00232
00233 private:
00234
00235 static void initClass();
00236 static void exitClass();
00237
00238 static SbBool getLocalPoint( SoState* state, SbVec3f &point);
00239
00243 static void checkProjection( SoState* state, SbVec3f &point, SbBool inverse= FALSE);
00244
00249 bool checkProjection( SoNode *node, SoAction *action, SoMFVec3f &coords );
00250
00254 void resetProjection( SoAction *action, SoMFVec3f &coords);
00255
00259 void setParametersIn( SoMFString ¶meters);
00260
00264 static void parametersChangedCB( void *data, SoSensor* );
00265
00266 static void typeIdChangedCB( void *data, SoSensor* );
00267
00268 private:
00269
00270
00271 virtual ~SoProjection();
00272
00273
00274 std::vector< int > m_projIds;
00275
00276
00277 std::vector< SbString > m_projNames;
00278
00279
00280 std::vector< SbProjection *> m_projections;
00281
00282
00283 SbProjection* m_projection;
00284
00285
00286 SbSphericalProjection* m_sphericalProjection;
00287
00288
00289 SbVec3f* m_storedCoords;
00290
00291 SbBool m_enableDeleteValues;
00292
00293
00294 SoFieldSensor* m_parameterSensor;
00295
00296 SoFieldSensor* m_floatParameterSensor;
00297
00298
00299 SoFieldSensor* m_projTypeIdSensor;
00300 };
00301
00302 #if defined(_WIN32)
00303 #pragma warning( pop )
00304 #endif
00305
00306 #endif
00307
00308