| http://www.sim.no/ http://www.coin3d.org/

SoBaseKit.h
1 #ifndef COIN_SOBASEKIT_H
2 #define COIN_SOBASEKIT_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <Inventor/nodekits/SoSubKit.h>
28 #include <Inventor/nodes/SoNode.h>
29 #ifdef COIN_INTERNAL
30 class SoNodeKitPath;
31 #else // !COIN_INTERNAL
32 // Include these header files for better Open Inventor compatibility.
33 #include <Inventor/SoNodeKitPath.h>
34 #include <Inventor/misc/SoChildList.h>
35 #endif // !COIN_INTERNAL
36
37 class SoGroup;
38 class SoNodekitParts;
39 class SoNodekitCatalog;
40 class SoPath;
41
42 // Convenience macros. FIXME: document. 20000113 mortene.
43
44 #define SO_GET_PART(_kit_, _name_, _classname_) \
45 ((_classname_ *)_kit_->getPart(_name_, TRUE))
46
47 #define SO_CHECK_PART(_kit_, _name_, _classname_) \
48 (static_cast<_classname_ *>(_kit_->getPart(_name_, FALSE)))
49
50 #define SO_GET_ANY_PART(_kit_, _name_, _classname_) \
51 (static_cast<_classname_ *>(_kit_->getAnyPart(_name_, TRUE, FALSE, FALSE)))
52
53 #define SO_CHECK_ANY_PART(_kit_, _name_, _classname_) \
54 (static_cast<_classname_ *>(_kit_->getAnyPart(_name_, FALSE, FALSE, FALSE)))
55
56
57 class COIN_DLL_API SoBaseKit : public SoNode {
58 typedef SoNode inherited;
59
60 SO_NODE_HEADER(SoBaseKit);
61
62 SO_KIT_CATALOG_ENTRY_HEADER(callbackList);
63
64 public:
65 static void initClass(void);
66 SoBaseKit(void);
67
68 static const SoNodekitCatalog * getClassNodekitCatalog(void);
69 virtual const SoNodekitCatalog * getNodekitCatalog(void) const;
70
71 virtual SoNode * getPart(const SbName & partname, SbBool makeifneeded);
72 SbString getPartString(const SoBase * part);
73 virtual SoNodeKitPath * createPathToPart(const SbName & partname,
74 SbBool makeifneeded,
75 const SoPath * pathtoextend = NULL);
76 virtual SbBool setPart(const SbName & partname, SoNode * from);
77 SbBool set(const char * namevaluepairliststring);
78 SbBool set(const char * partnamestring, const char * parameterstring);
79
80 virtual void doAction(SoAction * action);
81 virtual void callback(SoCallbackAction * action);
82 virtual void GLRender(SoGLRenderAction * action);
83 virtual void getBoundingBox(SoGetBoundingBoxAction * action);
84 virtual void getMatrix(SoGetMatrixAction * action);
85 virtual void handleEvent(SoHandleEventAction * action);
86 virtual void rayPick(SoRayPickAction * action);
87 virtual void search(SoSearchAction * action);
88 virtual void write(SoWriteAction * action);
89 virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
90
91 virtual SoChildList * getChildren(void) const;
92
93 void printDiagram(void);
94 void printSubDiagram(const SbName & rootname, int level);
95 void printTable(void);
96
97 virtual void addWriteReference(SoOutput * out, SbBool isfromfield = FALSE);
98 SbBool forceChildDrivenWriteRefs(SoOutput * out);
99
100 static SbBool isSearchingChildren(void);
101 static void setSearchingChildren(const SbBool newval);
102
103 protected:
104 virtual ~SoBaseKit();
105
106 static const SoNodekitCatalog ** getClassNodekitCatalogPtr(void);
107
108 virtual SoNode * addToCopyDict(void) const;
109 virtual void copyContents(const SoFieldContainer * fromfc,
110 SbBool copyconnections);
111
112 SoGroup * getContainerNode(const SbName & listname,
113 SbBool makeifneeded = TRUE);
114 virtual SoNode * getAnyPart(const SbName & partname, SbBool makeifneeded,
115 SbBool leafcheck = FALSE,
116 SbBool publiccheck = FALSE);
117 virtual SoNodeKitPath * createPathToAnyPart(const SbName & partname,
118 SbBool makeifneeded,
119 SbBool leafcheck = FALSE,
120 SbBool publiccheck = FALSE,
121 const SoPath * pathtoextend = NULL);
122 virtual SbBool setAnyPart(const SbName & partname, SoNode * from,
123 SbBool anypart = TRUE);
124 void createNodekitPartsList(void); // not part of Coin
125 void createFieldList(void); // replaces above method
126 virtual void createDefaultParts(void);
127 const SoNodekitParts * getNodekitPartsList(void) const; // not part of Coin
128 const SbList<SoSFNode*> & getCatalogInstances(void) const; // replaces above method
129
130 void catalogError(void);
131 virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways = FALSE);
132 virtual SbBool readInstance(SoInput * in, unsigned short flags);
133 virtual void setDefaultOnNonWritingFields(void);
134 void countMyFields(SoOutput * out);
135
136 virtual SbBool setPart(const int partNum, SoNode * node);
137
138 SoChildList * children;
139 SbBool connectionsSetUp;
140
141 private:
142 friend class SoInteractionKit;
143 static SbBool findPart(const SbString & partname, SoBaseKit *& kit,
144 int & partnum, SbBool & islist, int & listidx,
145 const SbBool makeifneeded, SoPath * path = NULL,
146 const SbBool recsearch = FALSE);
147 static void atexit_cleanupkit(void);
148
149 SbBool makePart(const int partnum);
150 int getRightSiblingIndex(const int partnum);
151 int findNodeInThisKit(SoNode *node, const int parentnum = -1) const;
152
153 static SoNodekitCatalog * classcatalog;
154 static const SoNodekitCatalog ** parentcatalogptr;
155 static SbBool searchchildren;
156
157 class SoBaseKitP * pimpl;
158 friend class SoBaseKitP;
159 };
160
161 #endif // !COIN_SOBASEKIT_H
SoBase
The SoBase class is the top-level superclass for a number of class-hierarchies.SoBase provides the ba...
Definition: SoBase.h:36
SoNode::copyContents
virtual void copyContents(const SoFieldContainer *from, SbBool copyconnections)
Definition: SoNode.cpp:1410
SoBaseKit
The SoBaseKit class is the toplevel superclass for nodekits.Node kits are collections of nodes and ot...
Definition: SoBaseKit.h:57
SoRayPickAction
The SoRayPickAction class does ray intersection with scene graphs.For interaction with the scene grap...
Definition: SoRayPickAction.h:41
SoNode::getPrimitiveCount
virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action)
Definition: SoNode.cpp:870
SoOutput
The SoOutput class is an abstraction of an output stream.SoOutput offers the ability to write basic t...
Definition: SoOutput.h:42
SoGetMatrixAction
The SoGetMatrixAction class is an action for accumulating the transformation matrix of a subgraph...
Definition: SoGetMatrixAction.h:37
SO_NODE_HEADER
#define SO_NODE_HEADER(classname)
SoBaseKit::children
SoChildList * children
Definition: SoBaseKit.h:138
SoFieldContainer
The SoFieldContainer class is a base class for all classes that contain fields.The classes containing...
Definition: SoFieldContainer.h:34
SoFieldContainer::addWriteReference
virtual void addWriteReference(SoOutput *out, SbBool isfromfield=FALSE)
Definition: SoFieldContainer.cpp:680
SoSearchAction
The SoSearchAction class provides methods for searching through scene graphs.Nodes can be searched fo...
Definition: SoSearchAction.h:35
SbList
The SbList class is a template container class for lists.SbList is an extension of the Coin library v...
Definition: SoType.h:46
SoNode::search
virtual void search(SoSearchAction *action)
Definition: SoNode.cpp:1148
SoBaseKit::connectionsSetUp
SbBool connectionsSetUp
Definition: SoBaseKit.h:139
SoNodeKitPath
The SoNodeKitPath class is a path that contains only nodekit nodes.All other nodes are hidden from th...
Definition: SoNodeKitPath.h:33
SoNode
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:47
SoInteractionKit
The SoInteractionKit class is a base class for draggers.This nodekit class makes it possible to set s...
Definition: SoInteractionKit.h:41
SoNode::rayPick
virtual void rayPick(SoRayPickAction *action)
Definition: SoNode.cpp:1115
SoChildList
The SoChildList class is a container for node children.This class does automatic notification on the ...
Definition: SoChildList.h:33
SoPath
The SoPath class is a container class for traversal path descriptions.SoPath objects contain a list o...
Definition: SoPath.h:43
SoNodekitCatalog
The SoNodekitCatalog class is a container for nodekit layouts.Nodekits store all their hierarchical l...
Definition: SoNodekitCatalog.h:36
SoNode::readInstance
virtual SbBool readInstance(SoInput *in, unsigned short flags)
Definition: SoNode.cpp:1466
SoNode::getMatrix
virtual void getMatrix(SoGetMatrixAction *action)
Definition: SoNode.cpp:1029
SoAction
The SoAction class is the base class for all traversal actions.Applying actions is the basic mechanis...
Definition: SoAction.h:68
SoGroup
The SoGroup class is a node which managed other node instances.The internal scene data structures in ...
Definition: SoGroup.h:31
SoNode::doAction
virtual void doAction(SoAction *action)
Definition: SoNode.cpp:785
SoHandleEventAction
The SoHandleEventAction class distributes user events to the scene.This is the action used by the GUI...
Definition: SoHandleEventAction.h:37
SoGetPrimitiveCountAction
The SoGetPrimitiveCountAction class counts the primitives in a scene.Apply this action to a scene if ...
Definition: SoGetPrimitiveCountAction.h:34
SoGetBoundingBoxAction
The SoGetBoundingBoxAction class calculates bounding boxes for nodes and subgraphs.If this action is applied to a path or scene graph root, it will calculate the bounding box and the center point of the geometry contained within the scene.
Definition: SoGetBoundingBoxAction.h:36
SoCallbackAction
The SoCallbackAction class invokes callbacks at specific nodes.This action has mechanisms for trackin...
Definition: SoCallbackAction.h:71
SoWriteAction
The SoWriteAction class writes a scene graph to file.When applied to a scene, this action writes its ...
Definition: SoWriteAction.h:33
SoInput
The SoInput class is an abstraction of file import functionality.This class takes care of most of the...
Definition: SoInput.h:52
SoNode::getBoundingBox
virtual void getBoundingBox(SoGetBoundingBoxAction *action)
Definition: SoNode.cpp:841
SoNode::GLRender
virtual void GLRender(SoGLRenderAction *action)
Definition: SoNode.cpp:930
SbString
The SbString class is a string class with convenience functions for string operations.This is the class used for storing and working with character strings. It automatically takes care of supporting all the "bookkeeping" tasks usually associated with working with character strings, like memory allocation and deallocation etc.
Definition: SbString.h:42
SoNode::write
virtual void write(SoWriteAction *action)
Definition: SoNode.cpp:1217
SoNode::callback
virtual void callback(SoCallbackAction *action)
Definition: SoNode.cpp:1002
SoNode::addToCopyDict
virtual SoNode * addToCopyDict(void) const
Definition: SoNode.cpp:1362
SoNode::handleEvent
virtual void handleEvent(SoHandleEventAction *action)
Definition: SoNode.cpp:1059
SbName
The SbName class stores strings by reference.The class is used by Coin for storing keywords...
Definition: SbName.h:31
SoNode::getChildren
virtual SoChildList * getChildren(void) const
Definition: SoNode.cpp:1293
SoGLRenderAction
The SoGLRenderAction class renders the scene graph with OpenGL calls.Applying this method at a root n...
Definition: SoGLRenderAction.h:41

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