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