![]() |
http://www.sim.no/ http://www.coin3d.org/ |
00001 #ifndef COIN_SOPATH_H 00002 #define COIN_SOPATH_H 00003 00004 /**************************************************************************\ 00005 * 00006 * This file is part of the Coin 3D visualization library. 00007 * Copyright (C) 1998-2008 by Kongsberg SIM. All rights reserved. 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License 00011 * ("GPL") version 2 as published by the Free Software Foundation. 00012 * See the file LICENSE.GPL at the root directory of this source 00013 * distribution for additional information about the GNU GPL. 00014 * 00015 * For using Coin with software that can not be combined with the GNU 00016 * GPL, and for taking advantage of the additional benefits of our 00017 * support services, please contact Kongsberg SIM about acquiring 00018 * a Coin Professional Edition License. 00019 * 00020 * See http://www.coin3d.org/ for more information. 00021 * 00022 * Kongsberg SIM, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY. 00023 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org 00024 * 00025 \**************************************************************************/ 00026 00027 #include <Inventor/misc/SoBase.h> 00028 #include <Inventor/lists/SbList.h> 00029 #include <Inventor/lists/SoNodeList.h> 00030 00031 #ifndef COIN_INTERNAL 00032 // For SGI / TGS Open Inventor compile-time compatibility. 00033 #include <Inventor/SoLists.h> 00034 #endif // !COIN_INTERNAL 00035 00036 00037 class SoWriteAction; 00038 class SoNotList; 00039 class SoInput; 00040 class SoPathList; 00041 00042 00043 class COIN_DLL_API SoPath : public SoBase { 00044 typedef SoBase inherited; 00045 00046 public: 00047 static void initClass(void); 00048 00049 SoPath(const int approxlength = 4); 00050 SoPath(SoNode * const head); 00051 SoPath(const SoPath & rhs); 00052 00053 SoPath & operator=(const SoPath & rhs); 00054 00055 static SoType getClassTypeId(void); 00056 virtual SoType getTypeId(void) const; 00057 00058 void setHead(SoNode * const head); 00059 SoNode * getHead(void) const; 00060 void append(const int childindex); 00061 void append(SoNode * const node); 00062 void append(const SoPath * const frompath); 00063 void push(const int childindex); 00064 void pop(void); 00065 SoNode * getTail(void) const; 00066 SoNode * getNode(const int index) const; 00067 SoNode * getNodeFromTail(const int index) const; 00068 int getIndex(const int index) const; 00069 int getIndexFromTail(const int index) const; 00070 int getLength(void) const; 00071 void truncate(const int length); 00072 00073 int findFork(const SoPath * const path) const; 00074 int findNode(const SoNode * const node) const; 00075 00076 SbBool containsNode(const SoNode * const node) const; 00077 SbBool containsPath(const SoPath * const path) const; 00078 SoPath * copy(const int startfromnodeindex = 0, int numnodes = 0) const; 00079 friend COIN_DLL_API SbBool operator==(const SoPath & lhs, const SoPath & rhs); 00080 friend COIN_DLL_API SbBool operator!=(const SoPath & lhs, const SoPath & rhs); 00081 00082 static SoPath * getByName(const SbName name); 00083 static int getByName(const SbName name, SoPathList & l); 00084 00085 void insertIndex(SoNode * const parent, const int newindex); 00086 void removeIndex(SoNode * const parent, const int oldindex); 00087 void replaceIndex(SoNode * const parent, const int index, 00088 SoNode * const newchild); 00089 SbBool isRelevantNotification(SoNotList * const l) const; 00090 00091 virtual void write(SoWriteAction * action); 00092 00093 protected: 00094 virtual ~SoPath(); 00095 void auditPath(const SbBool flag); 00096 00097 private: 00098 static void cleanupClass(void); 00099 static void * createInstance(void); 00100 void append(SoNode * const node, const int index); 00101 int getFullLength(void) const; 00102 void truncate(const int length, const SbBool donotify); 00103 virtual SbBool readInstance(SoInput * in, unsigned short flags); 00104 void setFirstHidden(void); 00105 00106 SoNodeList nodes; 00107 SbList<int> indices; 00108 SbBool isauditing; 00109 int firsthidden; 00110 SbBool firsthiddendirty; 00111 static SoType classTypeId; 00112 00113 friend class SoFullPath; 00114 friend class SoNodeKitPath; 00115 friend class SoAction; 00116 friend class SoTempPath; 00117 }; 00118 00120 00121 inline int 00122 SoPath::getFullLength(void) const 00123 { 00124 return this->nodes.getLength(); 00125 } 00126 00127 inline void 00128 SoPath::push(const int childindex) 00129 { 00130 this->append(childindex); 00131 } 00132 00133 inline void 00134 SoPath::pop(void) 00135 { 00136 this->truncate(this->getFullLength() - 1); 00137 } 00138 00140 00141 00142 #ifndef COIN_INTERNAL 00143 // For SGI / TGS Open Inventor compile-time compatibility. 00144 #include <Inventor/SoFullPath.h> 00145 #include <Inventor/misc/SoLightPath.h> 00146 #endif // COIN_INTERNAL 00147 00148 #endif // !COIN_SOPATH_H
Copyright © 1998-2008 by Kongsberg SIM. All rights reserved.
Generated on Tue May 5 02:52:06 2009 for Coin by Doxygen 1.5.5.