Main Page Modules Class Hierarchy Alphabetical List Compound List File List Compound Members

# SoGetBoundingBoxAction.h

    00001 #ifndef COIN_SOGETBOUNDINGBOXACTION_H
    00002 #define COIN_SOGETBOUNDINGBOXACTION_H
    00003
    00004 /**************************************************************************\
    00005  *
    00006  *  This file is part of the Coin 3D visualization library.
    00007  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
    00008  *
    00009  *  This library is free software; you can redistribute it and/or
    00010  *  modify it under the terms of the GNU General Public License
    00011  *  ("GPL") version 2 as published by the Free Software Foundation.
    00012  *  See the file LICENSE.GPL at the root directory of this source
    00013  *  distribution for additional information about the GNU GPL.
    00014  *
    00015  *  For using Coin with software that can not be combined with the GNU
    00016  *  GPL, and for taking advantage of the additional benefits of our
    00017  *  support services, please contact Systems in Motion about acquiring
    00018  *  a Coin Professional Edition License.
    00019  *
    00020  *  See <URL:http://www.coin3d.org> for  more information.
    00021  *
    00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00023  *  <URL:http://www.sim.no>.
    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