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

SoBaseKit.h

00001 /**************************************************************************\
00002  *
00003  *  This file is part of the Coin 3D visualization library.
00004  *  Copyright (C) 1998-2002 by Systems in Motion. All rights reserved.
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public License
00008  *  version 2.1 as published by the Free Software Foundation. See the
00009  *  file LICENSE.LGPL at the root directory of the distribution for
00010  *  more details.
00011  *
00012  *  If you want to use Coin for applications not compatible with the
00013  *  LGPL, please contact SIM to acquire a Professional Edition license.
00014  *
00015  *  Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY
00016  *  http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097
00017  *
00018 \**************************************************************************/
00019 
00020 #ifndef COIN_SOBASEKIT_H
00021 #define COIN_SOBASEKIT_H
00022 
00023 #include <Inventor/nodekits/SoSubKit.h>
00024 #include <Inventor/nodes/SoNode.h>
00025 #ifdef COIN_INTERNAL
00026 class SoNodeKitPath;
00027 #else // !COIN_INTERNAL
00028 // Include this header file for better Open Inventor compatibility.
00029 #include <Inventor/SoNodeKitPath.h>
00030 #endif // !COIN_INTERNAL
00031 
00032 class SoGroup;
00033 class SoNodekitParts;
00034 class SoNodekitCatalog;
00035 class SoPath;
00036 
00037 // Convenience macros. FIXME: document. 20000113 mortene.
00038 
00039 #define SO_GET_PART(_kit_, _name_, _classname_) \
00040  ((_classname_ *)_kit_->getPart(_name_, TRUE))
00041 
00042 #define SO_CHECK_PART(_kit_, _name_, _classname_) \
00043  ((_classname_ *)_kit_->getPart(_name_, FALSE))
00044 
00045 #define SO_GET_ANY_PART(_kit_, _name_, _classname_) \
00046  ((_classname_ *)_kit_->getAnyPart(_name_, TRUE, FALSE, FALSE))
00047 
00048 #define SO_CHECK_ANY_PART(_kit_, _name_, _classname_) \
00049  ((_classname_ *)_kit_->getAnyPart(_name_, FALSE, FALSE, FALSE))
00050 
00051 
00052 class COIN_DLL_API SoBaseKit : public SoNode {
00053   typedef SoNode inherited;
00054 
00055   SO_NODE_HEADER(SoBaseKit);
00056 
00057   SO_KIT_CATALOG_ENTRY_HEADER(callbackList);
00058 
00059 public:
00060   static void initClass(void);
00061   SoBaseKit(void);
00062 
00063   static const SoNodekitCatalog * getClassNodekitCatalog(void);
00064   virtual const SoNodekitCatalog * getNodekitCatalog(void) const;
00065 
00066   virtual SoNode * getPart(const SbName & partname, SbBool makeifneeded);
00067   SbString getPartString(const SoBase * part);
00068   virtual SoNodeKitPath * createPathToPart(const SbName & partname,
00069                                            SbBool makeifneeded,
00070                                            const SoPath * pathtoextend = NULL);
00071   virtual SbBool setPart(const SbName & partname, SoNode * from);
00072   SbBool set(const char * namevaluepairliststring);
00073   SbBool set(const char * partnamestring, const char * parameterstring);
00074 
00075   virtual void doAction(SoAction * action);
00076   virtual void callback(SoCallbackAction * action);
00077   virtual void GLRender(SoGLRenderAction * action);
00078   virtual void getBoundingBox(SoGetBoundingBoxAction * action);
00079   virtual void getMatrix(SoGetMatrixAction * action);
00080   virtual void handleEvent(SoHandleEventAction * action);
00081   virtual void rayPick(SoRayPickAction * action);
00082   virtual void search(SoSearchAction * action);
00083   virtual void write(SoWriteAction * action);
00084   virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
00085 
00086   virtual SoChildList * getChildren(void) const;
00087 
00088   void printDiagram(void);
00089   void printSubDiagram(const SbName & rootname, int level);
00090   void printTable(void);
00091 
00092   virtual void addWriteReference(SoOutput * out, SbBool isfromfield = FALSE);
00093   SbBool forceChildDrivenWriteRefs(SoOutput * out);
00094 
00095   static SbBool isSearchingChildren(void);
00096   static void setSearchingChildren(const SbBool newval);
00097   static SoNode * typeCheck(const SbName & partname, const SoType & parttype,
00098                             SoNode * node);
00099 
00100 
00101 protected:
00102   virtual ~SoBaseKit();
00103 
00104   static const SoNodekitCatalog ** getClassNodekitCatalogPtr(void);
00105 
00106   virtual SoNode * addToCopyDict(void) const;
00107   virtual void copyContents(const SoFieldContainer * fromfc,
00108                             SbBool copyconnections);
00109 
00110   SoGroup * getContainerNode(const SbName & listname,
00111                              SbBool makeifneeded = TRUE);
00112   virtual SoNode * getAnyPart(const SbName & partname, SbBool makeifneeded,
00113                               SbBool leafcheck = FALSE,
00114                               SbBool publiccheck = FALSE);
00115   virtual SoNodeKitPath * createPathToAnyPart(const SbName & partname,
00116                                               SbBool makeifneeded,
00117                                               SbBool leafcheck = FALSE,
00118                                               SbBool publiccheck = FALSE,
00119                                               const SoPath * pathtoextend = NULL);
00120   virtual SbBool setAnyPart(const SbName & partname, SoNode * from,
00121                             SbBool anypart = TRUE);
00122   void createNodekitPartsList(void); // not part of Coin
00123   void createFieldList(void); // replaces above method
00124   virtual void createDefaultParts(void);
00125   const SoNodekitParts * getNodekitPartsList(void) const; // not part of Coin
00126   const SbList<SoSFNode*> & getCatalogInstances(void) const; // replaces above method
00127 
00128   void catalogError(void);
00129   virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways = FALSE);
00130   virtual SbBool readInstance(SoInput * in, unsigned short flags);
00131   virtual void setDefaultOnNonWritingFields(void);
00132   void countMyFields(SoOutput * out);
00133 
00134   virtual SbBool setPart(const int partNum, SoNode * node);
00135 
00136   SoChildList * children;
00137   SbBool connectionsSetUp;
00138 
00139 private:
00140   friend class SoInteractionKit;
00141   static SbBool findPart(const SbString & partname, SoBaseKit *& kit,
00142                          int & partnum, SbBool & islist, int & listidx,
00143                          const SbBool makeifneeded, SoPath * path = NULL,
00144                          const SbBool recsearch = FALSE);
00145 
00146   SbBool makePart(const int partnum);
00147   int getRightSiblingIndex(const int partnum);
00148   int findNodeInThisKit(SoNode *node, const int parentnum = -1) const;
00149 
00150   static SoNodekitCatalog * classcatalog;
00151   static const SoNodekitCatalog ** parentcatalogptr;
00152   static SbBool searchchildren;
00153 
00154   class SoBaseKitP * pimpl;
00155   friend class SoBaseKitP;
00156 };
00157 
00158 #endif // !COIN_SOBASEKIT_H

Generated at Tue Mar 5 03:31:12 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001