Open Inventor Reference
|
00001 /* 00002 * 00003 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * Further, this software is distributed without any warranty that it is 00016 * free of the rightful claim of any third person regarding infringement 00017 * or the like. Any license provided herein, whether implied or 00018 * otherwise, applies only to this software file. Patent licenses, if 00019 * any, provided herein do not apply to combinations of this program with 00020 * other software, or any other product whatsoever. 00021 * 00022 * You should have received a copy of the GNU Lesser General Public 00023 * License along with this library; if not, write to the Free Software 00024 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 * 00026 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, 00027 * Mountain View, CA 94043, or: 00028 * 00029 * http://www.sgi.com 00030 * 00031 * For further information regarding this notice, see: 00032 * 00033 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ 00034 * 00035 */ 00036 00037 00038 /* 00039 * 00040 _______________________________________________________________________ 00041 ______________ S I L I C O N G R A P H I C S I N C . ____________ 00042 | 00043 | $Revision: 1.1.1.1 $ 00044 | 00045 | Description: 00046 | Defines the SoWWWInline class 00047 | 00048 | Author(s): Gavin Bell, David Mott, Jim Kent 00049 | 00050 ______________ S I L I C O N G R A P H I C S I N C . ____________ 00051 _______________________________________________________________________ 00052 */ 00053 00054 #ifndef _SO_WWWINLINE_ 00055 #define _SO_WWWINLINE_ 00056 00057 #include <Inventor/misc/SoChildList.h> 00058 #include <Inventor/nodes/SoSubNode.h> 00059 #include <Inventor/fields/SoSFNode.h> 00060 #include <Inventor/fields/SoSFString.h> 00061 #include <Inventor/fields/SoSFVec3f.h> 00062 00063 #include <Inventor/actions/SoCallbackAction.h> 00064 00065 class SoWWWInline; 00066 class SoGroup; 00067 class SoWriteAction; 00068 00071 typedef void INVENTOR_API SoWWWInlineFetchURLCB( 00072 const SbString &url, void *userData, SoWWWInline *node); 00073 00074 00075 00078 00094 00095 00096 class INVENTOR_API SoWWWInline : public SoNode { 00097 00098 SO_NODE_HEADER(SoWWWInline); 00099 00100 public: 00101 00103 SoWWWInline(); 00104 00105 enum BboxVisibility { 00106 NEVER, 00107 UNTIL_LOADED, 00108 ALWAYS 00109 }; 00110 00111 SoSFVec3f bboxCenter; 00112 SoSFVec3f bboxSize; 00113 SoSFString name; 00114 SoSFNode alternateRep; 00115 00117 void setFullURLName(const SbString &url) { fullURL = url; } 00124 const SbString & getFullURLName(); 00125 00127 SoGroup *copyChildren() const; 00128 00132 void requestURLData() 00133 { if (! kidsRequested) requestChildrenFromURL(); } 00136 SbBool isURLDataRequested() const { return kidsRequested; } 00139 SbBool isURLDataHere() const { return kidsAreHere; } 00141 void cancelURLDataRequest() 00142 { if (!kidsAreHere) kidsRequested = FALSE; } 00143 00146 void setChildData(SoNode *urlData); 00149 SoNode * getChildData() const; 00150 00154 static void setFetchURLCallBack(SoWWWInlineFetchURLCB *f, void *userData); 00155 00160 static void setBoundingBoxVisibility(BboxVisibility b) { bboxVisibility = b; } 00162 static BboxVisibility getBoundingBoxVisibility() { return bboxVisibility; } 00163 00165 static void setBoundingBoxColor(SbColor &c) { bboxColor = c; } 00167 static const SbColor &getBoundingBoxColor() { return bboxColor; } 00168 00169 00170 SoEXTENDER public: 00172 virtual void doAction(SoAction *action); 00173 virtual void doActionOnKidsOrBox(SoAction *action); 00174 virtual void callback(SoCallbackAction *action); 00175 virtual void GLRender(SoGLRenderAction *action); 00176 virtual void getBoundingBox(SoGetBoundingBoxAction *action); 00177 virtual void getMatrix(SoGetMatrixAction *action); 00178 virtual void handleEvent(SoHandleEventAction *action); 00179 virtual void search(SoSearchAction *action); 00180 virtual void pick(SoPickAction *action); 00181 00182 SoINTERNAL public: 00183 static void initClass(); 00184 00186 virtual SoChildList *getChildren() const; 00187 00188 protected: 00189 virtual ~SoWWWInline(); 00190 00191 virtual void addBoundingBoxChild(SbVec3f center, SbVec3f size); 00192 00194 virtual SbBool readInstance(SoInput *in, unsigned short flags); 00195 00198 virtual void copyContents(const SoFieldContainer *fromFC, 00199 SbBool copyConnections); 00200 00201 private: 00202 void requestChildrenFromURL(); 00203 00204 SoChildList *children; 00205 SbBool kidsRequested; 00206 SbBool kidsAreHere; 00207 SbString fullURL; 00208 00209 static SbColor bboxColor; 00210 static BboxVisibility bboxVisibility; 00211 00213 static SoWWWInlineFetchURLCB *fetchURLcb; 00214 static void *fetchURLdata; 00215 }; 00216 00217 #endif /* _SO_WWWINLINE_ */ 00218