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_NODE_
00052 #define _SO_NODE_
00053
00054 #include <Inventor/fields/SoFieldContainer.h>
00055 #include <Inventor/nodes/SoSubNode.h>
00056 #include <Inventor/SoLists.h>
00057 #include <Inventor/SbString.h>
00058 #include <Inventor/SoType.h>
00059 #include <Inventor/sensors/SoDataSensor.h>
00060 #include <Inventor/STL/vector>
00061 #include <Inventor/SbPImpl.h>
00062 #include <bitset>
00063
00064 #ifdef _WIN32
00065 #pragma warning(push)
00066 #pragma warning(disable:4251)
00067 #endif
00068
00069 class SoNodeList;
00070 class SoAction;
00071 class SoCallbackAction;
00072 class SoChildList;
00073 class SoFieldData;
00074 class SoGLRenderAction;
00075 class SoGetBoundingBoxAction;
00076 class SoGetMatrixAction;
00077 class SoHandleEventAction;
00078 class SoInput;
00079 class SoOutput;
00080 class SoPickAction;
00081 class SoRayPickAction;
00082 class SoSearchAction;
00083 class SoWriteAction;
00084 class SbProjectionCoordinates;
00085 class SoGetPrimitiveCountAction;
00086 class SoComputeRenderUnitIDAction;
00087 class SoDistributeAction;
00088 class SoState;
00089
00091 namespace inventor
00092 {
00093 namespace impl
00094 {
00095 class SoCachedGroupImpl;
00096 }
00097 namespace node
00098 {
00099 class SoConstNode;
00100 }
00101 }
00104 SO_PIMPL_BASE_PUBLIC_DECLARATION(SoNode)
00105
00106
00107
00108
00109
00110
00111
00113
00114
00115
00145 class SoNode : public SoFieldContainer {
00146
00147 SO_NODE_ABSTRACT_HEADER(SoNode);
00148 SO_PIMPL_BASE_PUBLIC_HEADER(SoNode)
00149
00150 public:
00151
00198 inline virtual void setOverride(const SbBool state);
00199
00203 inline virtual SbBool isOverride() const;
00204
00219 virtual SoNode * copy(SbBool copyConnections = FALSE) const;
00220
00226 virtual SbBool affectsState() const;
00227
00233 static SoNode * getByName(const SbName &name);
00234
00241 static int getByName(const SbName &name, SoNodeList &list);
00242
00243 virtual void touch();
00244
00245 private:
00246
00259 inline virtual SoNode* getAlternateRep(SoAction* action);
00260
00267 inline virtual SbBool isBoundingBoxIgnoring() const;
00268
00269
00270
00271 virtual void doAction(SoAction *action);
00272
00273
00274
00275 virtual void GLRender(SoGLRenderAction *action);
00276 virtual void callback(SoCallbackAction *action);
00277 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
00278 virtual void getMatrix(SoGetMatrixAction *action);
00279 virtual void handleEvent(SoHandleEventAction *action);
00280 virtual void pick(SoPickAction *action);
00281 virtual void rayPick(SoRayPickAction *action);
00282 virtual void search(SoSearchAction *action);
00283 virtual void write(SoWriteAction *action);
00284 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
00285 virtual void distribute(SoDistributeAction *action);
00286
00287
00288
00289
00290 virtual void GLRenderBelowPath(SoGLRenderAction *action);
00291 virtual void GLRenderInPath(SoGLRenderAction *action);
00292 virtual void GLRenderOffPath(SoGLRenderAction *action);
00293
00294
00295
00296
00297 virtual void grabEventsSetup();
00298 virtual void grabEventsCleanup();
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313 virtual int32_t getRenderUnitID() const;
00314
00315 private:
00316
00317
00318
00319
00320 SoNode * copyForPROTO(SbBool copyConnections = FALSE) const;
00321 enum Stage {
00322 FIRST_INSTANCE,
00323 PROTO_INSTANCE,
00324 OTHER_INSTANCE
00325 };
00326
00327
00328 static void initClass();
00329 static void exitClass();
00330
00331
00332 static void initClasses();
00333 static void exitClasses();
00334
00335
00336 virtual void startNotify();
00337
00338
00339 virtual void notify(SoNotList *list);
00340
00341
00342 uint64_t getNodeId() const { return m_uniqueId; }
00343
00344
00345 static uint64_t getNextNodeId();
00346
00347
00348 virtual SoChildList *getChildren() const;
00349 virtual bool isSynchronizingContentOnly() { return FALSE; }
00350 virtual SoChildList *internalGetChildren() const;
00351
00352 virtual void internalRemoveChild(int);
00353 virtual void internalRemoveChild(SoNode *);
00354 virtual void internalRemoveAllChildren();
00358 virtual void internalAddChild(SoNode *);
00359 virtual int internalFindChild(const SoNode *) const;
00360 virtual void internalInsertChild(SoNode *, int);
00361 virtual SoNode *internalGetChild( int ) const;
00362 virtual void internalReplaceChild(int, SoNode *);
00363 virtual void internalReplaceChild(SoNode *, SoNode *);
00364 virtual int internalGetNumChildren();
00365
00366
00367 SoNode* getChangedChild() const;
00368 int getChangedIndex() const;
00369 SoDataSensor::ChangeType getChangeType() const;
00370
00371
00372 virtual void writeInstance(SoOutput *out);
00373
00374
00375
00376 static int getActionMethodIndex(SoType t);
00377
00378
00379
00380 virtual SoNode * addToCopyDict() const;
00381
00382
00383
00384 virtual void copyContents(const SoFieldContainer *fromFC,
00385 SbBool copyConnections);
00386
00387
00388 virtual SoFieldContainer * copyThroughConnection() const;
00389
00390
00391
00392 SoNode* getCachedAlternateRep(SoAction* action, SbBool doCache = FALSE);
00393
00399 virtual bool affectsPath() const;
00400
00401
00402 virtual void GLRenderP(SoGLRenderAction *action);
00403
00404 private:
00405
00406 static void setNextActionMethodIndex(int index);
00407 static int getNextActionMethodIndex();
00408 static void incNextActionMethodIndex();
00409
00410
00411 SoNode();
00412 virtual ~SoNode();
00413
00414 private:
00415
00416 uint64_t m_uniqueId;
00417
00418
00419 static int nextActionMethodIndex;
00420
00421
00422
00423 static void callbackS(SoAction *, SoNode *);
00424 static void GLRenderS(SoAction *, SoNode *);
00425 static void getBoundingBoxS(SoAction *, SoNode *);
00426 static void getMatrixS(SoAction *, SoNode *);
00427 static void handleEventS(SoAction *, SoNode *);
00428 static void pickS(SoAction *, SoNode *);
00429 static void rayPickS(SoAction *, SoNode *);
00430 static void searchS(SoAction *, SoNode *);
00431 static void writeS(SoAction *, SoNode *);
00432 static void getPrimitiveCountS(SoAction *, SoNode *);
00433
00434 static void distributeS(SoAction *, SoNode *);
00435
00436 void commonConstructor();
00437
00438
00439 template < class SPEC_ACTION >
00440 static void traverseS(SoAction *action, SoNode *node);
00441
00442 SoNode* getNodeToTraverse(SoAction* action, bool force = false);
00443
00444 SoNode* m_cachedAlternateRep;
00445
00446 private:
00447
00448
00449
00450 SbProjectionCoordinates *getProjectionCoordinates(){return m_projCoords;}
00451
00452 void setProjectionCoordinates(SbProjectionCoordinates *projCoords){
00453 m_projCoords = projCoords;
00454 }
00455
00456
00457 private:
00458 SbProjectionCoordinates *m_projCoords;
00459
00460 private:
00461
00462
00463 static bool s_catchGLError;
00464
00465
00466 friend class SoTraversalPassImpl;
00467 friend class SoLdmValuationAction;
00468 friend class SoPath;
00469 friend class SoLightPath;
00470 friend class SoAction;
00471 friend class StringConcatCallback;
00472 friend class SoChildList;
00473 friend class SoCacheElement;
00474 friend class inventor::impl::SoCachedGroupImpl;
00475 friend class inventor::node::SoConstNode;
00476 friend class SoCallbackAction;
00477 };
00478
00479 SoNode*
00480 SoNode::getAlternateRep(SoAction*)
00481 {
00482 return this;
00483 }
00484
00485 SbBool
00486 SoNode::isBoundingBoxIgnoring() const
00487 {
00488 return FALSE;
00489 }
00490
00491 void
00492 SoNode::setOverride(const SbBool)
00493 {
00494 #if defined(_DEBUG)
00495 SoDebugError::postWarning("SoNode::setOverride","not reimplemented and supported for this inherited node");
00496 #endif
00497 }
00498
00499 SbBool
00500 SoNode::isOverride() const
00501 {
00502 return FALSE;
00503 }
00504
00505 #ifdef _WIN32
00506 #pragma warning(pop)
00507 #endif
00508
00509 #endif
00510
00511