00001 #ifndef COIN_SOGETBOUNDINGBOXACTION_H
00002 #define COIN_SOGETBOUNDINGBOXACTION_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <Inventor/actions/SoAction.h>
00028 #include <Inventor/actions/SoSubAction.h>
00029 #include <Inventor/SbViewportRegion.h>
00030 #include <Inventor/SbBox3f.h>
00031 #include <Inventor/SbXfBox3f.h>
00032
00033
00034 class COIN_DLL_API SoGetBoundingBoxAction : public SoAction {
00035 typedef SoAction inherited;
00036
00037 SO_ACTION_HEADER(SoGetBoundingBoxAction);
00038
00039 public:
00040 SoGetBoundingBoxAction(const SbViewportRegion & vp);
00041 virtual ~SoGetBoundingBoxAction();
00042
00043 static void initClass(void);
00044
00045 enum ResetType { TRANSFORM = 0x1, BBOX = 0x2, ALL = TRANSFORM | BBOX };
00046
00047 void setViewportRegion(const SbViewportRegion & newregion);
00048 const SbViewportRegion & getViewportRegion(void) const;
00049
00050 SbBox3f getBoundingBox(void) const;
00051 SbXfBox3f & getXfBoundingBox(void);
00052
00053 const SbVec3f & getCenter(void) const;
00054
00055 void setInCameraSpace(const SbBool flag);
00056 SbBool isInCameraSpace(void) const;
00057
00058 void setResetPath(const SoPath * path, const SbBool resetbefore = TRUE,
00059 const ResetType what = ALL);
00060 const SoPath * getResetPath(void) const;
00061 SbBool isResetPath(void) const;
00062 SbBool isResetBefore(void) const;
00063 SoGetBoundingBoxAction::ResetType getWhatReset(void) const;
00064
00065
00066 void checkResetBefore(void);
00067 void checkResetAfter(void);
00068
00069 void extendBy(const SbBox3f & box);
00070 void extendBy(const SbXfBox3f & box);
00071
00072 void setCenter(const SbVec3f & center, const SbBool transformcenter);
00073 SbBool isCenterSet(void) const;
00074 void resetCenter(void);
00075
00076 protected:
00077 virtual void beginTraversal(SoNode * node);
00078
00079 private:
00080 enum { CENTER_SET = 0x1, CAMERA_SPACE = 0x2, RESET_BEFORE= 0x4 };
00081
00082 SbXfBox3f bbox;
00083 SbVec3f center;
00084 SbViewportRegion vpregion;
00085 ResetType resettype;
00086 const SoPath * resetpath;
00087 unsigned int flags;
00088 };
00089
00090 #endif // !COIN_SOGETBOUNDINGBOXACTION_H