00001 /*======================================================================= 00002 * Copyright 1991-1996, Silicon Graphics, Inc. 00003 * ALL RIGHTS RESERVED 00004 * 00005 * UNPUBLISHED -- Rights reserved under the copyright laws of the United 00006 * States. Use of a copyright notice is precautionary only and does not 00007 * imply publication or disclosure. 00008 * 00009 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND: 00010 * Use, duplication or disclosure by the Government is subject to restrictions 00011 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights 00012 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or 00013 * in similar or successor clauses in the FAR, or the DOD or NASA FAR 00014 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc., 00015 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. 00016 * 00017 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY 00018 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, 00019 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY 00020 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON 00021 * GRAPHICS, INC. 00022 **=======================================================================*/ 00023 /*======================================================================= 00024 ** Author : Paul Isaacs (MMM yyyy) 00025 **=======================================================================*/ 00026 /*======================================================================= 00027 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00028 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00029 *** *** 00030 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00031 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00032 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00033 *** *** 00034 *** RESTRICTED RIGHTS LEGEND *** 00035 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00036 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00037 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00038 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00039 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00040 *** *** 00041 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00042 *** BORDEAUX, FRANCE *** 00043 *** ALL RIGHTS RESERVED *** 00044 **=======================================================================*/ 00045 /*======================================================================= 00046 ** Modified by : VSG (MMM YYYY) 00047 **=======================================================================*/ 00048 00049 00050 #ifndef _SO_NODE_KIT_LIST_PART_ 00051 #define _SO_NODE_KIT_LIST_PART_ 00052 00053 #include <Inventor/misc/SoChildList.h> 00054 #include <Inventor/fields/SoSFName.h> 00055 #include <Inventor/fields/SoMFName.h> 00056 #include <Inventor/fields/SoSFNode.h> 00057 #include <Inventor/nodes/SoNode.h> 00058 #include <Inventor/nodes/SoNode.h> 00059 #include <Inventor/nodekits/SoNodekitParts.h> 00060 #include <Inventor/nodekits/SoBaseKit.h> 00061 00062 class SoGroup; 00063 00064 class SoGetMatrixAction; 00065 class SoGLRenderAction; 00066 class SoGetBoundingBoxAction; 00067 class SoHandleEventAction; 00068 class SoSearchAction; 00069 class SoSearchAction; 00070 class SoCallbackAction; 00071 00073 // Class: SoNodeKitListPart 00074 // 00076 00122 class SoNodeKitListPart : public SoNode { 00123 00124 SO_NODE_HEADER(SoNodeKitListPart); 00125 00126 public: 00127 00131 SoNodeKitListPart(); 00132 00136 SoType getContainerType() const; 00140 void setContainerType( SoType newContainerType ); 00141 00146 const SoTypeList &getChildTypes() const; 00153 void addChildType( SoType typeToAdd ); 00154 00158 SbBool isTypePermitted( SoType typeToCheck ) const; 00163 SbBool isChildPermitted( const SoNode *child ) const; 00164 00170 void containerSet( const SbString& fieldDataString ); 00171 00172 00178 void lockTypes(); 00183 SbBool isTypeLocked() const { return areTypesLocked; } 00184 00191 void addChild(SoNode *child); 00198 void insertChild(SoNode *child, int childIndex); 00199 00206 SoNode *getChild(int index) const; 00213 int findChild(const SoNode *child) const; 00220 int getNumChildren() const; 00227 void removeChild(int index); 00234 void removeChild(SoNode *child) 00235 { removeChild( findChild(child)); } 00242 void replaceChild(int index, SoNode *newChild); 00249 void replaceChild( SoNode *oldChild, SoNode *newChild) 00250 { replaceChild(findChild(oldChild), newChild); } 00251 00252 // Depending on the type of the container, this may 00253 // or may not affect the state. 00254 virtual SbBool affectsState() const; 00255 00256 00257 private: 00258 00259 // These functions implement all actions for nodekits. 00260 virtual void doAction( SoAction *action ); 00261 virtual void callback( SoCallbackAction *action ); 00262 virtual void GLRender( SoGLRenderAction *action ); 00263 virtual void getBoundingBox( SoGetBoundingBoxAction *action ); 00264 virtual void getMatrix(SoGetMatrixAction *action ); 00265 virtual void handleEvent( SoHandleEventAction *action ); 00266 virtual void pick( SoPickAction *action ); 00267 virtual void search( SoSearchAction *action ); 00268 virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action); 00269 00270 private: 00271 static void initClass(); 00272 static void exitClass(); 00273 00274 // Returns pointer to children 00275 virtual SoChildList *getChildren() const; 00276 00282 virtual bool affectsPath() const; 00283 00284 private: 00285 00286 SoGroup *getContainerNode(); 00287 00288 // Reads in from file. Takes care of setting parts and stuff. 00289 virtual SbBool readInstance(SoInput *in, unsigned short flags); 00290 00291 SoChildList *children; 00292 00293 // Copies the contents of the given nodekit into this instance 00294 virtual void copyContents(const SoFieldContainer *fromFC, 00295 SbBool copyConnections); 00296 00297 private: 00298 virtual ~SoNodeKitListPart(); 00299 00300 private: 00301 SoSFName containerTypeName; 00302 SoMFName childTypeNames; 00303 SoSFNode containerNode; 00304 00305 SoTypeList childTypes; 00306 00307 SbBool areTypesLocked; 00308 00309 friend class SoBaseKit; 00310 00311 }; 00312 00313 #endif /* _SO_NODE_KIT_LIST_PART_ */ 00314 00315