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
00143 class SoProjection : public SoNode
00144 {
00145
00146 SO_NODE_HEADER( SoProjection );
00147
00148 public:
00149
00153 SoProjection();
00154
00158 SoSFBool isOn;
00159
00163 SoSFMatrix matrix;
00164
00169 SoSFInt32 projTypeId;
00170
00174 SoMFFloat floatParameters;
00175
00179 SoMFString parameters;
00180
00184 SoMFString parametersIn;
00185
00193 void addProjection( SbString &projectionName, SbProjection *projection , int id);
00194
00200 void setProjection( SbProjection *projection );
00201
00205 void getCurrentProjectionInfos(SbString &name, int &id);
00206
00210 inline SbProjection* getProjection() const
00211 { return m_projection; }
00212
00219 static SbVec3f * checkProjection( SoState *state,
00220 SoNode *node,
00221 int32_t numCoords,
00222 const SbVec3f *coords);
00223
00224 private:
00225 virtual void doAction ( SoAction *action );
00226 virtual void GLRender ( SoGLRenderAction *action ){ return doAction( action );}
00227 virtual void callback ( SoCallbackAction *action ){ return doAction( action );}
00228 virtual void getBoundingBox ( SoGetBoundingBoxAction *action ){ return doAction( action );}
00229 virtual void getMatrix ( SoGetMatrixAction *action ){ return doAction( action );}
00230 virtual void handleEvent ( SoHandleEventAction *action ){ return doAction( action );}
00231 virtual void pick ( SoPickAction *action ){ return doAction( action );}
00232 virtual void rayPick ( SoRayPickAction *action ){ return doAction( action );}
00233
00234 private:
00235
00236 static void initClass();
00237 static void exitClass();
00238
00239 static SbBool getLocalPoint( SoState* state, SbVec3f &point);
00240
00244 static void checkProjection( SoState* state, SbVec3f &point, SbBool inverse= FALSE);
00245
00250 bool checkProjection( SoNode *node, SoAction *action, SoMFVec3f &coords );
00251
00255 void resetProjection( SoAction *action, SoMFVec3f &coords);
00256
00260 void setParametersIn( SoMFString ¶meters);
00261
00265 static void parametersChangedCB( void *data, SoSensor* );
00266
00267 static void typeIdChangedCB( void *data, SoSensor* );
00268
00269 private:
00270
00271
00272 virtual ~SoProjection();
00273
00274
00275 std::vector< int > m_projIds;
00276
00277
00278 std::vector< SbString > m_projNames;
00279
00280
00281 std::vector< SbProjection *> m_projections;
00282
00283
00284 SbProjection* m_projection;
00285
00286
00287 SbSphericalProjection* m_sphericalProjection;
00288
00289
00290 SbVec3f* m_storedCoords;
00291
00292 SbBool m_enableDeleteValues;
00293
00294
00295 SoFieldSensor* m_parameterSensor;
00296
00297 SoFieldSensor* m_floatParameterSensor;
00298
00299
00300 SoFieldSensor* m_projTypeIdSensor;
00301 };
00302
00303 #if defined(_WIN32)
00304 #pragma warning( pop )
00305 #endif
00306
00307 #endif
00308
00309