Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoGroup.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Paul S. Strauss (MMM yyyy)
25** Modified by : Nick Thompson (MMM yyyy)
26**=======================================================================*/
27/*=======================================================================
28 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
29 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
30 *** ***
31 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
32 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
33 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
34 *** ***
35 *** RESTRICTED RIGHTS LEGEND ***
36 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
37 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
38 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
39 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
40 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
41 *** ***
42 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
43 *** BORDEAUX, FRANCE ***
44 *** ALL RIGHTS RESERVED ***
45**=======================================================================*/
46/*=======================================================================
47** Modified by : VSG (MMM YYYY)
48**=======================================================================*/
49
50
51#ifndef _SO_GROUP_
52#define _SO_GROUP_
53
54class SoChildList;
55
56#include <Inventor/nodes/SoNode.h>
57#include <Inventor/sensors/SoDataSensor.h> // for ChangeType
58#include <Inventor/fields/SoSFBool.h>
59#include <Inventor/SbPImpl.h>
60
61SO_PIMPL_PUBLIC_DECLARATION(SoGroup)
62
63
64//
65// Class: SoGroup
66//
67// Base group node: all children are traversed.
68//
70
121class SoGroup : public SoNode
122{
123 SO_NODE_HEADER(SoGroup);
124 SO_PIMPL_PUBLIC_HEADER(SoGroup)
125
126 public:
131
136
141 SoGroup(int nChildren);
142
147 virtual void addChild(SoNode *child);
148
154 virtual void insertChild(SoNode *child, int newChildIndex);
155
160 virtual SoNode *getChild(int index) const;
161
165 virtual int findChild(const SoNode *child) const;
166
170 virtual int getNumChildren() const;
171
177 virtual void removeChild(int index);
178
183 virtual void removeChild(SoNode *child)
184 { removeChild(findChild(child)); }
185
190 virtual void removeAllChildren();
191
197 virtual void replaceChild(int index, SoNode *newChild);
198
203 virtual void replaceChild(SoNode *oldChild, SoNode *newChild)
204 { replaceChild(findChild(oldChild), newChild); }
205
206 private:
207
213 inline virtual SbBool isBoundingBoxIgnoring() const
214 { return boundingBoxIgnoring.getValue(); }
215
216 // Implement actions
217 virtual void doAction(SoAction *action);
218 virtual void callback(SoCallbackAction *action);
219 virtual void GLRender(SoGLRenderAction *action);
220 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
221 virtual void getMatrix(SoGetMatrixAction *action);
222 virtual void handleEvent(SoHandleEventAction *action);
223 virtual void pick(SoPickAction *action);
224 virtual void search(SoSearchAction *action);
225 virtual void write(SoWriteAction *action);
226 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
227
228private:
229 static void initClass();
230 static void exitClass();
231
232 // Returns pointer to children
233 virtual SoChildList *getChildren() const;
234
235 // Internal child management following inheritance of classes.
236 virtual void internalRemoveChild( int index ) { removeChild(index); }
237 virtual void internalRemoveChild( SoNode *child ) { removeChild(findChild(child)); }
238 virtual void internalRemoveAllChildren() { removeAllChildren(); }
239 virtual void internalAddChild( SoNode *child ) { addChild(child); }
240 virtual int internalFindChild( const SoNode *child ) const { return findChild(child); }
241 virtual void internalInsertChild( SoNode *child, int newChildIndex ) { insertChild(child, newChildIndex); }
242 virtual SoNode *internalGetChild( int index) const { return getChild(index); }
243 virtual void internalReplaceChild( int index, SoNode *newChild) { replaceChild(index, newChild); }
244 virtual void internalReplaceChild( SoNode *oldChild, SoNode *newChild) { replaceChild(oldChild,newChild); }
245
246 virtual void notify(SoNotList *list);
247
248 virtual bool isGroup() { return true; }
249
250 // Copies the contents of the given node into this instance
251 virtual void copyContents(const SoFieldContainer *fromFC, SbBool copyConnections);
252
253 // serialize children list
254 static void writeChildren( SoWriteAction *action, SoChildList* children_ );
255
256 private:
257 SoChildList *children;
258
259 // Reads stuff into instance of SoGroup. Returns FALSE on error
260 virtual SbBool readInstance(SoInput *in, unsigned short flags);
261
262 // Reads just the children into instance of SoGroup. Returns FALSE on error
263 virtual SbBool readChildren(SoInput *in);
264
265 virtual ~SoGroup();
266
267
268private:
269
270 void commonConstructor();
271
272};
273
274
275#endif /* _SO_GROUP_ */
276
Abstract base class for all actions.
Definition SoAction.h:132
Performs a generic traversal of a scene graph or path.
Abstract base class for objects that contain fields.
Renders a scene graph using Open Inventor's Render Engine.
Computes bounding box of a scene.
Computes transformation matrix for a subgraph.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Counts number of...
Base class for all group nodes.
Definition SoGroup.h:122
virtual void removeChild(int index)
Removes child with given index from group.
virtual void removeChild(SoNode *child)
Removes first instance of given child from group.
Definition SoGroup.h:183
virtual void replaceChild(int index, SoNode *newChild)
Replaces child with given index with new child.
virtual void replaceChild(SoNode *oldChild, SoNode *newChild)
Replaces first instance of given child with new child.
Definition SoGroup.h:203
virtual SoNode * getChild(int index) const
Returns pointer the child node with the given index.
virtual void addChild(SoNode *child)
Adds a child as last one in group.
SoGroup()
Creates an empty group node.
virtual int findChild(const SoNode *child) const
Finds index of given child within group.
SoGroup(int nChildren)
Constructor that takes approximate number of children.
SoSFBool boundingBoxIgnoring
Whether to ignore this node during bounding box traversal.
Definition SoGroup.h:130
virtual void insertChild(SoNode *child, int newChildIndex)
Adds a child so that it becomes the one with the given index.
virtual int getNumChildren() const
Returns number of children.
virtual void removeAllChildren()
Removes all children from group.
Allows nodes in a graph to receive input events.
Used to read Open Inventor data files.
Definition SoInput.h:363
Abstract base class for all database nodes.
Definition SoNode.h:145
Abstract base class for picking objects in a scene.
Field containing a single Boolean value.
Definition SoSFBool.h:79
SbBool getValue() const
Returns this field's value.
Definition SoSFBool.h:82
Searches for nodes in a scene graph.
Writes a scene graph to a file.
int SbBool
Boolean type.
Definition SbBase.h:87