Open Inventor Reference
SoNode.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * Further, this software is distributed without any warranty that it is
16  * free of the rightful claim of any third person regarding infringement
17  * or the like. Any license provided herein, whether implied or
18  * otherwise, applies only to this software file. Patent licenses, if
19  * any, provided herein do not apply to combinations of this program with
20  * other software, or any other product whatsoever.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27  * Mountain View, CA 94043, or:
28  *
29  * http://www.sgi.com
30  *
31  * For further information regarding this notice, see:
32  *
33  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34  *
35  */
36 
37 
38 /*
39  * Copyright (C) 1990,91 Silicon Graphics, Inc.
40  *
41  _______________________________________________________________________
42  ______________ S I L I C O N G R A P H I C S I N C . ____________
43  |
44  | $Revision: 1.1.1.1 $
45  |
46  | Description:
47  | This file defines the base SoNode class.
48  |
49  | Author(s) : Paul S. Strauss, Nick Thompson
50  |
51  ______________ S I L I C O N G R A P H I C S I N C . ____________
52  _______________________________________________________________________
53  */
54 
55 #ifndef _SO_NODE_
56 #define _SO_NODE_
57 
60 #include <Inventor/SoLists.h>
61 #include <Inventor/SbString.h>
62 #include <Inventor/SoType.h>
63 
64 class SoAction;
65 class SoCallbackAction;
66 class SoChildList;
67 class SoFieldData;
68 class SoGLRenderAction;
70 class SoGetMatrixAction;
72 class SoInput;
73 class SoOutput;
74 class SoPickAction;
75 class SoRayPickAction;
76 class SoSearchAction;
77 class SoWriteAction;
78 
79 
80 
83 
102 
104 
105  public:
106 
108  void setOverride(bool state);
109 
111  bool isOverride() const { return override; }
112 
114  static SoType getClassTypeId() { return classTypeId; }
115 
122  SoNode * copy(bool copyConnections = FALSE) const;
123 
128  virtual bool affectsState() const;
129 
135  static SoNode * getByName(const SbName &name);
140  static int getByName(const SbName &name, SoNodeList &list);
141 
142  SoEXTENDER public:
143 
146  virtual void doAction(SoAction *action);
147 
150  virtual void GLRender(SoGLRenderAction *action);
151  virtual void callback(SoCallbackAction *action);
152  virtual void getBoundingBox(SoGetBoundingBoxAction *action);
153  virtual void getMatrix(SoGetMatrixAction *action);
154  virtual void handleEvent(SoHandleEventAction *action);
155  virtual void pick(SoPickAction *action);
156  virtual void rayPick(SoRayPickAction *action);
157  virtual void search(SoSearchAction *action);
158  virtual void write(SoWriteAction *action);
159 
163  virtual void GLRenderBelowPath(SoGLRenderAction *action);
164  virtual void GLRenderInPath(SoGLRenderAction *action);
165  virtual void GLRenderOffPath(SoGLRenderAction *action);
166 
170  virtual void grabEventsSetup();
171  virtual void grabEventsCleanup();
172 
173  SoINTERNAL public:
174  enum Stage {
177  OTHER_INSTANCE
178  };
179 
181  static void initClass();
182 
184  static void initClasses();
185 
187  virtual void startNotify();
188 
190  virtual void notify(SoNotList *list);
191 
193  SbNodeIdType getNodeId() const { return uniqueId; }
194 
196  static SbNodeIdType getNextNodeId() { return nextUniqueId; }
197 
199  virtual SoChildList *getChildren() const;
200 
202  virtual void writeInstance(SoOutput *out);
203 
207  { return t.getData(); }
208 
211  virtual SoNode * addToCopyDict() const;
212 
215  virtual void copyContents(const SoFieldContainer *fromFC,
216  bool copyConnections);
217 
220 
221  protected:
224  static const SoFieldData **getFieldDataPtr() { return NULL; }
225 
228  virtual ~SoNode();
229 
232 
235 
238 
239  private:
240  static SoType classTypeId;
241 
242  bool override;
243 
246  static void callbackS(SoAction *, SoNode *);
247  static void GLRenderS(SoAction *, SoNode *);
248  static void getBoundingBoxS(SoAction *, SoNode *);
249  static void getMatrixS(SoAction *, SoNode *);
250  static void handleEventS(SoAction *, SoNode *);
251  static void pickS(SoAction *, SoNode *);
252  static void rayPickS(SoAction *, SoNode *);
253  static void searchS(SoAction *, SoNode *);
254  static void writeS(SoAction *, SoNode *);
255 };
256 
257 #endif /* _SO_NODE_ */
#define SoEXTENDER
Provide inline template functions for abs, swap, min, max, and clamp.
Definition: SbBasic.h:154
#define FALSE
Definition: SbBasic.h:79
#define SoINTERNAL
Definition: SbBasic.h:155
size_t SbNodeIdType
Type of unique ids of SoNode, used in the notification/change detection handling.
Definition: SbBasic.h:90
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition: SbSystem.h:81
Character string stored in a hash table.
Definition: SbString.h:264
Abstract base class for all actions.
Definition: SoAction.h:179
Performs a generic traversal of the scene graph.
This class maintains a list of child nodes for any node.
Definition: SoChildList.h:83
Abstract base class for objects that contain fields.
The SoFieldData class holds data about fields of an object: the number of fields the object has,...
Definition: SoFieldData.h:88
Renders a scene graph using OpenGL.
Computes bounding box of a scene.
Computes transformation matrix for subgraph.
Allows nodes in a graph to receive input events.
Used to read Inventor data files.
Definition: SoInput.h:128
Maintains a list of pointers to nodes.
Definition: SoLists.h:177
Abstract base class for all database nodes.
Definition: SoNode.h:103
bool isOverride() const
Returns the state of the override flag.
Definition: SoNode.h:111
SoNode * copy(bool copyConnections=FALSE) const
Creates and returns an exact copy of the node.
static SoType getClassTypeId()
Returns type identifier for the SoNode class.
Definition: SoNode.h:114
virtual void getMatrix(SoGetMatrixAction *action)
virtual SoNode * addToCopyDict() const
Recursively adds this node and all nodes under it to the copy dictionary.
static int getByName(const SbName &name, SoNodeList &list)
Returns the number of nodes with the given name, and adds to list pointers to those nodes.
virtual void notify(SoNotList *list)
Propagates modification notification through an instance.
virtual void GLRenderBelowPath(SoGLRenderAction *action)
These methods make render traversal faster by implementing different rendering paths corresponding to...
virtual void GLRenderOffPath(SoGLRenderAction *action)
static SbNodeIdType nextUniqueId
Next available unique id.
Definition: SoNode.h:234
static void initClass()
Initializes base node class.
static SbNodeIdType getNextNodeId()
Returns the next available unique id.
Definition: SoNode.h:196
virtual void writeInstance(SoOutput *out)
Writes instance to SoOutput. (Used for either stage of writing.)
virtual void doAction(SoAction *action)
This method performs the "typical" operation of a node for any action.
virtual void GLRender(SoGLRenderAction *action)
These virtual functions implement all of the actions for nodes, Most of the default implementations d...
virtual void grabEventsCleanup()
SoNode()
Constructor, destructor.
virtual void search(SoSearchAction *action)
virtual void rayPick(SoRayPickAction *action)
virtual void startNotify()
Initiates notification from an instance.
static void initClasses()
Initialize ALL Inventor node classes.
SbNodeIdType uniqueId
Unique id for this node.
Definition: SoNode.h:231
virtual bool affectsState() const
Returns TRUE if a node has an effect on the state during traversal.
static int nextActionMethodIndex
Next index into the action method table.
Definition: SoNode.h:237
virtual void grabEventsSetup()
These virtual functions are called when a node gains or loses status as "grabber" of events (see Hand...
static const SoFieldData ** getFieldDataPtr()
This is used by the field-inheritence mechanism, hidden in the SoSubNode macros.
Definition: SoNode.h:224
virtual void getBoundingBox(SoGetBoundingBoxAction *action)
virtual void write(SoWriteAction *action)
virtual void callback(SoCallbackAction *action)
static int getActionMethodIndex(SoType t)
Returns the index of this node in the action/method table, given its type.
Definition: SoNode.h:206
virtual void pick(SoPickAction *action)
virtual void copyContents(const SoFieldContainer *fromFC, bool copyConnections)
Copies the contents of the given node into this instance.
SbNodeIdType getNodeId() const
Returns the unique id for a node.
Definition: SoNode.h:193
virtual void GLRenderInPath(SoGLRenderAction *action)
virtual void handleEvent(SoHandleEventAction *action)
void setOverride(bool state)
Turns override flag on or off.
virtual ~SoNode()
Stage
Definition: SoNode.h:174
@ FIRST_INSTANCE
First real instance being constructed.
Definition: SoNode.h:175
@ PROTO_INSTANCE
Prototype instance being constructed.
Definition: SoNode.h:176
virtual SoChildList * getChildren() const
Returns pointer to children, or NULL if none.
static SoNode * getByName(const SbName &name)
Returns the last node given the specified name.
virtual SoFieldContainer * copyThroughConnection() const
Copies an instance that is encountered through a field connection.
Holds a list of SoNotRec notification records.
Used to write Inventor data files.
Definition: SoOutput.h:90
Abstract base class for picking objects in a scene.
Definition: SoPickAction.h:77
Intersects objects with a ray cast into scene.
Searches for nodes in a scene graph.
SoType has no virtual functions to keep it small...
Definition: SoType.h:103
short getData() const
Get data.
Definition: SoType.h:177
Writes a scene graph to a file.
Definition: SoWriteAction.h:80