00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef _SO_VRMLSWITCH_
00052 #define _SO_VRMLSWITCH_
00053
00054 #include <Inventor/VRMLnodes/SoVRMLParent.h>
00055 #include <Inventor/misc/SoChildList.h>
00056 #include <Inventor/fields/SoSFInt32.h>
00057 #include <Inventor/fields/SoSFVec3f.h>
00058 #include <Inventor/fields/SoMFNode.h>
00059 #include <Inventor/fields/SoSFNode.h>
00060 #include <Inventor/nodes/SoNode.h>
00061
00062
00063 #if defined(OIV_IGNORE_VRML_DEPRECATED)
00064 #include <SoDeprecationRules.h>
00065 #pragma push_macro("SoDEPRECATED_CLASS")
00066 #pragma push_macro("SoDEPRECATED_TYPEDEF")
00067 #undef SoDEPRECATED_CLASS
00068 #undef SoDEPRECATED_TYPEDEF
00069 #define SoDEPRECATED_CLASS(x,y)
00070 #define SoDEPRECATED_TYPEDEF(x,y)
00071 #endif
00072
00084 #define SO_SWITCH_NONE (-1)
00085
00086 #define SO_SWITCH_INHERIT (-2)
00087
00088 #define SO_SWITCH_ALL (-3)
00089 class SoDEPRECATED SoVRMLSwitch : public SoVRMLParent {
00186
00187 SO_NODE_HEADER(SoVRMLSwitch);
00188
00189 public:
00190
00203 SoMFNode choice;
00208 SoSFInt32 whichChoice;
00212 SoVRMLSwitch();
00213
00217 SoVRMLSwitch(int nChoices);
00218
00223 virtual SbBool affectsState() const;
00224
00228 void addChoice(SoNode *choice1);
00229
00233 void insertChoice(SoNode *choice1, int newLevelIndex);
00234
00238 SoNode * getChoice(int index) const;
00239
00243 int findChoice(const SoNode *choice1) const;
00244
00248 int getNumChoices() const;
00249
00253 void removeChoice(int index);
00254
00258 void removeChoice(SoNode *choice1)
00259 { removeChoice(findChoice(choice1)); }
00260
00264 void removeAllChoices();
00265
00269 void replaceChoice(int index, SoNode *newChoice);
00270
00274 void replaceChoice(SoNode *oldChoice, SoNode *newChoice)
00275 { replaceChoice(findChoice(oldChoice), newChoice); }
00276
00277 private:
00278
00279 virtual void doAction(SoAction *action);
00280 virtual void callback(SoCallbackAction *action);
00281 virtual void GLRender(SoGLRenderAction *action);
00282 virtual void pick(SoPickAction *action);
00283 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
00284 virtual void handleEvent(SoHandleEventAction *action);
00285 virtual void getMatrix(SoGetMatrixAction *action);
00286 virtual void search(SoSearchAction *action);
00287 virtual void write(SoWriteAction *action);
00288
00289 private:
00290 static void initClass();
00291 static void exitClass();
00292
00293
00294 void addChild(SoNode *child);
00295
00296
00297 void insertChild(SoNode *child, int newChildIndex);
00298
00299
00300 SoNode * getChild(int index) const;
00301
00302
00303 int findChild(const SoNode *child) const;
00304
00305
00306 int getNumChildren() const;
00307
00308
00309 void removeChild(int index);
00310
00311
00312 void removeChild(SoNode *child)
00313 { removeChild(findChild(child)); }
00314
00315
00316 void removeAllChildren();
00317
00318
00319 void replaceChild(int index, SoNode *newChild);
00320
00321
00322 void replaceChild(SoNode *oldChild, SoNode *newChild)
00323 { replaceChild(findChild(oldChild), newChild); }
00324
00325
00326 virtual void copyContents(const SoFieldContainer *fromFC,
00327 SbBool copyConnections);
00328
00334 virtual bool affectsPath() const;
00335
00336 private:
00337 SoMFNode addChildren;
00338 SoMFNode removeChildren;
00339 void processAddChildren();
00340 void processRemoveChildren();
00341
00342 virtual ~SoVRMLSwitch();
00343 virtual void notify(SoNotList *);
00344 virtual SbBool readInstance(SoInput *in, unsigned short flags);
00345 int internalSetValue;
00346
00347 private:
00348
00349
00350 void doChild(SoAction *action, int matchIndex = -1);
00351 };
00352
00353
00354
00355 #if defined(OIV_IGNORE_VRML_DEPRECATED)
00356 #pragma pop_macro("SoDEPRECATED_TYPEDEF")
00357 #pragma pop_macro("SoDEPRECATED_CLASS")
00358 #endif
00359
00360 #endif
00361