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

SoNode.h

00001 #ifndef COIN_SONODE_H
00002 #define COIN_SONODE_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) 1998-2007 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 http://www.coin3d.org/ for more information.
00021  *
00022  *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 #include <Inventor/fields/SoFieldContainer.h>
00028 
00029 class SoAction;
00030 class SoCallbackAction;
00031 class SoChildList;
00032 class SoGLRenderAction;
00033 class SoGetBoundingBoxAction;
00034 class SoGetMatrixAction;
00035 class SoGetPrimitiveCountAction;
00036 class SoHandleEventAction;
00037 class SoNodeList;
00038 class SoNotList;
00039 class SoOutput;
00040 class SoPickAction;
00041 class SoRayPickAction;
00042 class SoSearchAction;
00043 class SoWriteAction;
00044 class SoAudioRenderAction;
00045 class SbDict;
00046 
00047 class COIN_DLL_API SoNode : public SoFieldContainer {
00048   typedef SoFieldContainer inherited;
00049 
00050 public:
00051   // Probably not interesting for the application programmer..?
00052 #ifndef DOXYGEN_SKIP_THIS
00053   enum Stage { FIRST_INSTANCE, PROTO_INSTANCE, OTHER_INSTANCE };
00054 #endif // !DOXYGEN_SKIP_THIS
00055 
00056   void setOverride(const SbBool state);
00057   SbBool isOverride(void) const;
00058 
00059   enum NodeType {
00060     INVENTOR     = 0x0000,
00061     VRML1        = 0x0001,
00062     VRML2        = 0x0002,
00063     INVENTOR_1   = 0x0004,
00064     INVENTOR_2_0 = 0x0008,
00065     INVENTOR_2_1 = 0x0010,
00066     INVENTOR_2_5 = 0x0020,
00067     INVENTOR_2_6 = 0x0040,
00068     COIN_1_0     = 0x0080,
00069     COIN_2_0     = 0x0100,
00070     EXTENSION    = 0x0200,
00071     COIN_2_2     = 0x0400,
00072     COIN_2_3     = 0x0800,
00073     COIN_2_4     = 0x1000,
00074     INVENTOR_5_0 = 0x2000,
00075     COIN_2_5     = 0x4000
00076   };
00077 
00078   static uint32_t getCompatibilityTypes(const SoType & nodetype);
00079   void setNodeType(const NodeType type);
00080   NodeType getNodeType(void) const;
00081 
00082   virtual SoNode * copy(SbBool copyconnections = FALSE) const;
00083   virtual SbBool affectsState(void) const;
00084 
00085   virtual void doAction(SoAction * action);
00086   virtual void GLRender(SoGLRenderAction * action);
00087   virtual void GLRenderBelowPath(SoGLRenderAction * action);
00088   virtual void GLRenderInPath(SoGLRenderAction * action);
00089   virtual void GLRenderOffPath(SoGLRenderAction * action);
00090   virtual void callback(SoCallbackAction * action);
00091   virtual void getBoundingBox(SoGetBoundingBoxAction * action);
00092   virtual void getMatrix(SoGetMatrixAction * action);
00093   virtual void handleEvent(SoHandleEventAction * action);
00094   virtual void pick(SoPickAction * action);
00095   virtual void rayPick(SoRayPickAction * action);
00096   virtual void search(SoSearchAction * action);
00097   virtual void write(SoWriteAction * action);
00098   virtual void audioRender(SoAudioRenderAction * action);
00099   virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
00100 
00101   virtual void grabEventsSetup(void);
00102   virtual void grabEventsCleanup(void);
00103 
00104   virtual void startNotify(void);
00105   virtual void notify(SoNotList * l);
00106 
00107   uint32_t getNodeId(void) const;
00108   virtual SoChildList * getChildren(void) const;
00109 
00110   virtual void writeInstance(SoOutput * out);
00111   virtual SoNode * addToCopyDict(void) const;
00112   virtual void copyContents(const SoFieldContainer * from,
00113                             SbBool copyconnections);
00114   virtual SoFieldContainer * copyThroughConnection(void) const;
00115 
00116 
00117   static SoType getClassTypeId(void);
00118   static SoNode * getByName(const SbName & name);
00119   static int getByName(const SbName & name, SoNodeList & l);
00120 
00121   static void initClass(void);
00122   static void initClasses(void);
00123 
00124   static uint32_t getNextNodeId(void);
00125   static int getActionMethodIndex(const SoType type);
00126 
00127   static void getBoundingBoxS(SoAction * action, SoNode * node);
00128   static void GLRenderS(SoAction * action, SoNode * node);
00129   static void callbackS(SoAction * action, SoNode * node);
00130   static void getMatrixS(SoAction * action, SoNode * node);
00131   static void handleEventS(SoAction * action, SoNode * node);
00132   static void pickS(SoAction * action, SoNode * node);
00133   static void rayPickS(SoAction * action, SoNode * node);
00134   static void searchS(SoAction * action, SoNode * node);
00135   static void writeS(SoAction * action, SoNode * node);
00136   static void audioRenderS(SoAction * action, SoNode * node);
00137   static void getPrimitiveCountS(SoAction * action, SoNode * node);
00138 
00139 protected:
00140   SoNode(void);
00141   virtual ~SoNode();
00142 
00143   virtual SbBool readInstance(SoInput * in, unsigned short flags);
00144 
00145   static const SoFieldData ** getFieldDataPtr(void);
00146 
00147   // These are necessary to avoid problems with us not exporting the
00148   // nextActionMethodIndex member into Win32 DLLs (we'll get
00149   // unresolved symbol for extension node classes if the SoSubNode
00150   // macros accesses the nextActionMethodIndex directly).
00151   static void setNextActionMethodIndex(int index);
00152   static int getNextActionMethodIndex(void);
00153   static void incNextActionMethodIndex(void);
00154 
00155   static void setCompatibilityTypes(const SoType & nodetype, const uint32_t bitmask);
00156 
00157   uint32_t uniqueId;
00158   static uint32_t nextUniqueId;
00159   static int nextActionMethodIndex;
00160 
00161 private:
00162   static SoType classTypeId;
00163   uint32_t stateflags;
00164   void clearStateFlags(const unsigned int bits);
00165   void setStateFlags(const unsigned int bits);
00166   SbBool getState(const unsigned int bits) const;
00167   // OBSOLETE, only kept for Coin 2.x ABI compatibility.
00168   static SbDict * compatibilitydict;
00169 
00170   static void cleanupClass(void);
00171 };
00172 
00173 #ifndef COIN_INTERNAL
00174 // For SGI / TGS Open Inventor compile-time compatibility.
00175 #include <Inventor/SoLists.h>
00176 #endif // COIN_INTERNAL
00177 
00178 #endif // !COIN_SONODE_H

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Mon Feb 23 16:33:24 2009 for Coin by Doxygen. 1.5.8