Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoNodeKitListPart.h
Go to the documentation of this file.
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 Isaacs (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50#ifndef _SO_NODE_KIT_LIST_PART_
51#define _SO_NODE_KIT_LIST_PART_
52
61
62class SoGroup;
63
68class SoSearchAction;
69class SoSearchAction;
71
73// Class: SoNodeKitListPart
74//
76
121class SoNodeKitListPart : public SoNode {
122
124
125 public:
126
131
139 void setContainerType( SoType newContainerType );
140
145 const SoTypeList &getChildTypes() const;
152 void addChildType( SoType typeToAdd );
153
157 SbBool isTypePermitted( SoType typeToCheck ) const;
162 SbBool isChildPermitted( const SoNode *child ) const;
163
169 void containerSet( const SbString& fieldDataString );
170
171
177 void lockTypes();
182 SbBool isTypeLocked() const { return areTypesLocked; }
183
190 void addChild(SoNode *child);
197 void insertChild(SoNode *child, int childIndex);
198
205 SoNode *getChild(int index) const;
212 int findChild(const SoNode *child) const;
219 int getNumChildren() const;
226 void removeChild(int index);
233 void removeChild(SoNode *child)
234 { removeChild( findChild(child)); }
241 void replaceChild(int index, SoNode *newChild);
248 void replaceChild( SoNode *oldChild, SoNode *newChild)
249 { replaceChild(findChild(oldChild), newChild); }
250
251 // Depending on the type of the container, this may
252 // or may not affect the state.
253 virtual SbBool affectsState() const;
254
255
256 private:
257
258 // These functions implement all actions for nodekits.
259 virtual void doAction( SoAction *action );
260 virtual void callback( SoCallbackAction *action );
261 virtual void GLRender( SoGLRenderAction *action );
262 virtual void getBoundingBox( SoGetBoundingBoxAction *action );
263 virtual void getMatrix(SoGetMatrixAction *action );
264 virtual void handleEvent( SoHandleEventAction *action );
265 virtual void pick( SoPickAction *action );
266 virtual void search( SoSearchAction *action );
267 virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action);
268
269 private:
270 static void initClass();
271 static void exitClass();
272
273 // Returns pointer to children
274 virtual SoChildList *getChildren() const;
275
281 virtual bool affectsPath() const;
282
283 // Copies the contents of the given nodekit into this instance
284 virtual void copyContents(const SoFieldContainer *fromFC,
285 SbBool copyConnections);
286
287 private:
288
289 SoGroup *getContainerNode();
290
291 // Reads in from file. Takes care of setting parts and stuff.
292 virtual SbBool readInstance(SoInput *in, unsigned short flags);
293
294 SoChildList *children;
295
296 private:
297 virtual ~SoNodeKitListPart();
298
299 private:
300 SoSFName containerTypeName;
301 SoMFName childTypeNames;
302 SoSFNode containerNode;
303
304 SoTypeList childTypes;
305
306 SbBool areTypesLocked;
307
308 friend class SoBaseKit;
309
310};
311
312#endif /* _SO_NODE_KIT_LIST_PART_ */
313
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
Class for smart character strings.
Definition SbString.h:202
Abstract base class for all actions.
Definition SoAction.h:132
Base class for all node kits.
Definition SoBaseKit.h:302
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
Allows nodes in a graph to receive input events.
Used to read Open Inventor data files.
Definition SoInput.h:363
Multiple-value field containing any number of names.
Definition SoMFName.h:94
Abstract base class for all database nodes.
Definition SoNode.h:145
friend class SoChildList
Definition SoNode.h:472
Group node with restricted children.
void removeChild(SoNode *child)
Removes first instance of given child from nodekit.
void lockTypes()
This function permanently locks the permitted child types and the container type permanently.
void addChildType(SoType typeToAdd)
Permits the node type typeToAdd as a child.
void addChild(SoNode *child)
Adds child as last one in nodekit.
SbBool isTypePermitted(SoType typeToCheck) const
Returns whether a node of type typeToCheck may be added as a child.
int getNumChildren() const
Returns the number of children in the nodekit.
void removeChild(int index)
Removes child with given index from the nodekit.
int findChild(const SoNode *child) const
Finds index of given child within nodekit.
void setContainerType(SoType newContainerType)
Sets the type of node used as the container .
SbBool isChildPermitted(const SoNode *child) const
Returns whether the node child may be added to this list.
SoType getContainerType() const
Gets the type of node used as the container .
virtual SbBool affectsState() const
Returns TRUE if a node has an effect on the state during traversal.
void replaceChild(int index, SoNode *newChild)
Replaces child with given index with new child.
const SoTypeList & getChildTypes() const
Returns the permitted child node types.
SoNode * getChild(int index) const
Returns the child node with the given index.
SoNodeKitListPart()
Constructor.
void containerSet(const SbString &fieldDataString)
Sends a string to the set() method on the container node.
void replaceChild(SoNode *oldChild, SoNode *newChild)
Replaces first instance of given child with new child.
void insertChild(SoNode *child, int childIndex)
Adds a child so that it becomes the one with the given index.
SbBool isTypeLocked() const
Returns whether the permitted child types and the container type are locked (i.e.
Abstract base class for picking objects in a scene.
Field containing a name.
Definition SoSFName.h:84
Field containing a a node.
Definition SoSFNode.h:97
Searches for nodes in a scene graph.
Stores runtime type information.
Definition SoType.h:98
Maintains a list of SoTypes.
Definition SoTypeList.h:72
int SbBool
Boolean type.
Definition SbBase.h:87