Coin Logo http://www.sim.no/
http://www.coin3d.org/

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) by Kongsberg Oil & Gas Technologies.
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 Kongsberg Oil & Gas Technologies
00018  *  about acquiring a Coin Professional Edition License.
00019  *
00020  *  See http://www.coin3d.org/ for more information.
00021  *
00022  *  Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 #include <Inventor/actions/SoAction.h>
00028 #include <Inventor/actions/SoSubAction.h>
00029 #include <Inventor/tools/SbLazyPimplPtr.h>
00030 #include <Inventor/SbViewportRegion.h>
00031 #include <Inventor/SbBox3f.h>
00032 #include <Inventor/SbXfBox3f.h>
00033 
00034 class SoGetBoundingBoxActionP;
00035 
00036 class COIN_DLL_API SoGetBoundingBoxAction : public SoAction {
00037   typedef SoAction inherited;
00038 
00039   SO_ACTION_HEADER(SoGetBoundingBoxAction);
00040 
00041 public:
00042   static void initClass(void);
00043 
00044   SoGetBoundingBoxAction(const SbViewportRegion & vp);
00045   virtual ~SoGetBoundingBoxAction(void);
00046 
00047   enum ResetType { TRANSFORM = 0x1, BBOX = 0x2, ALL = TRANSFORM | BBOX };
00048 
00049   void setViewportRegion(const SbViewportRegion & newregion);
00050   const SbViewportRegion & getViewportRegion(void) const;
00051 
00052   SbBox3f getBoundingBox(void) const;
00053   SbXfBox3f & getXfBoundingBox(void);
00054 
00055   const SbVec3f & getCenter(void) const;
00056 
00057   void setInCameraSpace(const SbBool flag);
00058   SbBool isInCameraSpace(void) const;
00059 
00060   void setResetPath(const SoPath * path, const SbBool resetbefore = TRUE,
00061                     const ResetType what = ALL);
00062   const SoPath * getResetPath(void) const;
00063   SbBool isResetPath(void) const;
00064   SbBool isResetBefore(void) const;
00065   SoGetBoundingBoxAction::ResetType getWhatReset(void) const;
00066 
00067 
00068   void checkResetBefore(void);
00069   void checkResetAfter(void);
00070 
00071   void extendBy(const SbBox3f & box);
00072   void extendBy(const SbXfBox3f & box);
00073 
00074   void setCenter(const SbVec3f & center, const SbBool transformcenter);
00075   SbBool isCenterSet(void) const;
00076   void resetCenter(void);
00077 
00078 protected:
00079   virtual void beginTraversal(SoNode * node);
00080 
00081 private:
00082   enum { CENTER_SET = 0x1, CAMERA_SPACE = 0x2, RESET_BEFORE= 0x4 };
00083 
00084   SbXfBox3f bbox;
00085   SbVec3f center;
00086   SbViewportRegion vpregion;
00087   ResetType resettype;
00088   const SoPath * resetpath;
00089   unsigned int flags;
00090 
00091 private:
00092   SbLazyPimplPtr<SoGetBoundingBoxActionP> pimpl;
00093 
00094   SoGetBoundingBoxAction(const SoGetBoundingBoxAction & rhs);
00095   SoGetBoundingBoxAction & operator = (const SoGetBoundingBoxAction & rhs);
00096 }; // SoGetBoundingBoxAction
00097 
00098 #endif // !COIN_SOGETBOUNDINGBOXACTION_H

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated for Coin by Doxygen 1.7.5.1.