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

SoIntersectionDetectionAction.h

00001 #ifndef COIN_SOINTERSECTIONDETECTIONACTION_H
00002 #define COIN_SOINTERSECTIONDETECTIONACTION_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/tools/SbPimplPtr.h>
00028 #include <Inventor/actions/SoSubAction.h>
00029 #include <Inventor/actions/SoAction.h>
00030 #include <Inventor/actions/SoCallbackAction.h>
00031 
00032 struct SoIntersectingPrimitive {
00033   SoPath * path;
00034   enum PrimitiveType {
00035     SEGMENT = 2,
00036     LINE_SEGMENT = 2,
00037     TRIANGLE = 3
00038   } type;
00039   SbVec3f vertex[3];
00040   SbVec3f xf_vertex[3];
00041 };
00042 
00043 class COIN_DLL_API SoIntersectionDetectionAction : public SoAction {
00044   typedef SoAction hinherited;
00045   SO_ACTION_HEADER(SoIntersectionDetectionAction);
00046 public:
00047   static void initClass(void);
00048   SoIntersectionDetectionAction(void);
00049   virtual ~SoIntersectionDetectionAction(void);
00050 
00051   enum Resp {
00052     NEXT_PRIMITIVE,
00053     NEXT_SHAPE,
00054     ABORT
00055   };
00056 
00057   typedef SoCallbackAction::Response SoIntersectionVisitationCB(void * closure, const SoPath * where);
00058   typedef SbBool SoIntersectionFilterCB(void * closure, const SoPath * p1, const SoPath * p2);
00059   typedef Resp SoIntersectionCB(void * closure, const SoIntersectingPrimitive * p1, const SoIntersectingPrimitive * p2);
00060 
00061   void setIntersectionDetectionEpsilon(float epsilon);
00062   float getIntersectionDetectionEpsilon(void) const;
00063 
00064   static void setIntersectionEpsilon(float epsilon);
00065   static float getIntersectionEpsilon(void);
00066 
00067   void setTypeEnabled(SoType type, SbBool enable);
00068   SbBool isTypeEnabled(SoType type, SbBool checkgroups = FALSE) const;
00069 
00070   void setManipsEnabled(SbBool enable);
00071   SbBool isManipsEnabled(void) const;
00072 
00073   void setDraggersEnabled(SbBool enable);
00074   SbBool isDraggersEnabled(void) const;
00075 
00076   void setShapeInternalsEnabled(SbBool enable);
00077   SbBool isShapeInternalsEnabled(void) const;
00078 
00079   void addVisitationCallback(SoType type, SoIntersectionVisitationCB * cb, void * closure);
00080   void removeVisitationCallback(SoType type, SoIntersectionVisitationCB * cb, void * closure);
00081 
00082   virtual void apply(SoNode * node);
00083   virtual void apply(SoPath * path);
00084   virtual void apply(const SoPathList & paths, SbBool obeysRules = FALSE);
00085 
00086   virtual void setFilterCallback(SoIntersectionFilterCB * cb, void * closure = NULL);
00087   virtual void addIntersectionCallback(SoIntersectionCB * cb, void * closure  = NULL);
00088   virtual void removeIntersectionCallback(SoIntersectionCB * cb, void * closure  = NULL);
00089 
00090 private:
00091   class PImpl;
00092   SbPimplPtr<PImpl> pimpl;
00093 
00094   SoIntersectionDetectionAction(const SoIntersectionDetectionAction & rhs); // N/A
00095   SoIntersectionDetectionAction & operator = (const SoIntersectionDetectionAction & rhs); // N/A
00096 
00097 };
00098 
00099 #endif // !COIN_SOINTERSECTIONDETECTIONACTION_H

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

Generated on Sun May 1 2011 02:58:21 for Coin by Doxygen 1.7.3.