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 : Gavin Bell (MMM yyyy) 00025 ** Modified by : David Mott (MMM yyyy) 00026 ** Modified by : Jim Kent (MMM yyyy) 00027 **=======================================================================*/ 00028 /*======================================================================= 00029 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00030 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00031 *** *** 00032 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00033 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00034 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00035 *** *** 00036 *** RESTRICTED RIGHTS LEGEND *** 00037 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00038 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00039 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00040 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00041 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00042 *** *** 00043 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00044 *** BORDEAUX, FRANCE *** 00045 *** ALL RIGHTS RESERVED *** 00046 **=======================================================================*/ 00047 /*======================================================================= 00048 ** Modified by : VSG (MMM YYYY) 00049 **=======================================================================*/ 00050 00051 00052 #ifndef _SO_WWWINLINE_ 00053 #define _SO_WWWINLINE_ 00054 00055 #include <Inventor/misc/SoChildList.h> 00056 #include <Inventor/nodes/SoNode.h> 00057 #include <Inventor/fields/SoSFNode.h> 00058 #include <Inventor/fields/SoSFFilePathString.h> 00059 #include <Inventor/fields/SoSFVec3f.h> 00060 00061 #include <Inventor/actions/SoCallbackAction.h> 00062 00063 class SoWWWInline; 00064 class SoGroup; 00065 class SoWriteAction; 00066 00071 typedef void SoWWWInlineFetchURLCB( 00072 const SbString &url, void *userData, SoWWWInline *node); 00073 00074 00076 // 00077 // Class: SoWWWInline 00078 // 00080 00118 class SoWWWInline : public SoNode { 00119 00120 SO_NODE_HEADER(SoWWWInline); 00121 00122 public: 00126 SoWWWInline(); 00127 00129 enum BboxVisibility { 00133 NEVER, 00137 UNTIL_LOADED, 00141 ALWAYS 00142 }; 00143 00148 SoSFVec3f bboxCenter; 00153 SoSFVec3f bboxSize; 00159 SoSFFilePathString name; 00167 SoSFNode alternateRep; 00168 00176 void setFullURLName(const SbString &url) { fullURL = url; } 00181 const SbString & getFullURLName(); 00182 00187 SoGroup *copyChildren() const; 00188 00194 void requestURLData() 00195 { if (! kidsRequested) requestChildrenFromURL(); } 00199 SbBool isURLDataRequested() const { return kidsRequested; } 00204 SbBool isURLDataHere() const { return kidsAreHere; } 00208 void cancelURLDataRequest() 00209 { if (!kidsAreHere) kidsRequested = FALSE; } 00210 00215 void setChildData(SoNode *urlData); 00219 SoNode * getChildData() const; 00220 00227 static void setFetchURLCallBack(SoWWWInlineFetchURLCB *f, void *userData); 00228 00235 static void setBoundingBoxVisibility(BboxVisibility b) ; 00239 static BboxVisibility getBoundingBoxVisibility() ; 00240 00244 static void setBoundingBoxColor(SbColor &c) ; 00248 static const SbColor &getBoundingBoxColor() ; 00249 00255 static void setReadAsSoFile(SbBool onOff) { readAsSoFile = onOff; }; 00259 static SbBool getReadAsSoFile() { return readAsSoFile; }; 00260 00261 00262 private: 00263 // Traversal methods for all the actions: 00264 virtual void doAction(SoAction *action); 00265 virtual void doActionOnKidsOrBox(SoAction *action); 00266 virtual void callback(SoCallbackAction *action); 00267 virtual void GLRender(SoGLRenderAction *action); 00268 virtual void getBoundingBox(SoGetBoundingBoxAction *action); 00269 virtual void getMatrix(SoGetMatrixAction *action); 00270 virtual void handleEvent(SoHandleEventAction *action); 00271 virtual void search(SoSearchAction *action); 00272 virtual void pick(SoPickAction *action); 00273 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action); 00274 00275 private: 00276 static void initClass(); 00277 static void exitClass(); 00278 const SbString & getBasePath() { return basePath; } 00279 void setBasePath( const SbString &path ) { basePath = path; } 00280 00281 // Returns pointer to children, or NULL if none 00282 virtual SoChildList *getChildren() const; 00283 00284 private: 00285 virtual ~SoWWWInline(); 00286 00287 virtual void addBoundingBoxChild(SbVec3f center, SbVec3f size); 00288 00289 // Reads into instance of SoWWWInline. Returns FALSE on error. 00290 virtual SbBool readInstance(SoInput *in, unsigned short flags); 00291 00292 // Copies the child data as well as the rest of the node (if 00293 // the child data has been set) 00294 virtual void copyContents(const SoFieldContainer *fromFC, 00295 SbBool copyConnections); 00296 private: 00297 SbString basePath; 00298 void requestChildrenFromURL(); 00299 00300 SoChildList *children; 00301 SbBool kidsRequested; 00302 SbBool kidsAreHere; 00303 SbString fullURL; 00304 00305 static SbColor bboxColor; 00306 static BboxVisibility bboxVisibility; 00307 00308 // Static methods 00309 static SoWWWInlineFetchURLCB *fetchURLcb; 00310 static void *fetchURLdata; 00311 00312 // static variable for whether to read "name" as if this 00313 // was an SoFile node 00314 static SbBool readAsSoFile; 00315 }; 00316 00317 #endif /* _SO_WWWINLINE_ */ 00318 00319 00320