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-2014 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 00117 class SoWWWInline : public SoNode { 00118 00119 SO_NODE_HEADER(SoWWWInline); 00120 00121 public: 00125 SoWWWInline(); 00126 00128 enum BboxVisibility { 00132 NEVER, 00136 UNTIL_LOADED, 00140 ALWAYS 00141 }; 00142 00147 SoSFVec3f bboxCenter; 00152 SoSFVec3f bboxSize; 00158 SoSFFilePathString name; 00166 SoSFNode alternateRep; 00167 00175 void setFullURLName(const SbString &url) { fullURL = url; } 00180 const SbString & getFullURLName(); 00181 00186 SoGroup *copyChildren() const; 00187 00193 void requestURLData() 00194 { if (! kidsRequested) requestChildrenFromURL(); } 00198 SbBool isURLDataRequested() const { return kidsRequested; } 00203 SbBool isURLDataHere() const { return kidsAreHere; } 00207 void cancelURLDataRequest() 00208 { if (!kidsAreHere) kidsRequested = FALSE; } 00209 00214 void setChildData(SoNode *urlData); 00218 SoNode * getChildData() const; 00219 00226 static void setFetchURLCallBack(SoWWWInlineFetchURLCB *f, void *userData); 00227 00234 static void setBoundingBoxVisibility(BboxVisibility b) ; 00238 static BboxVisibility getBoundingBoxVisibility() ; 00239 00243 static void setBoundingBoxColor(SbColor &c) ; 00247 static const SbColor &getBoundingBoxColor() ; 00248 00254 static void setReadAsSoFile(SbBool onOff) { readAsSoFile = onOff; }; 00258 static SbBool getReadAsSoFile() { return readAsSoFile; }; 00259 00260 00261 private: 00262 // Traversal methods for all the actions: 00263 virtual void doAction(SoAction *action); 00264 virtual void doActionOnKidsOrBox(SoAction *action); 00265 virtual void callback(SoCallbackAction *action); 00266 virtual void GLRender(SoGLRenderAction *action); 00267 virtual void getBoundingBox(SoGetBoundingBoxAction *action); 00268 virtual void getMatrix(SoGetMatrixAction *action); 00269 virtual void handleEvent(SoHandleEventAction *action); 00270 virtual void search(SoSearchAction *action); 00271 virtual void pick(SoPickAction *action); 00272 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action); 00273 00274 private: 00275 static void initClass(); 00276 static void exitClass(); 00277 const SbString & getBasePath() { return basePath; } 00278 void setBasePath( const SbString &path ) { basePath = path; } 00279 00280 // Returns pointer to children, or NULL if none 00281 virtual SoChildList *getChildren() const; 00282 00283 // Copies the child data as well as the rest of the node (if 00284 // the child data has been set) 00285 virtual void copyContents(const SoFieldContainer *fromFC, 00286 SbBool copyConnections); 00287 00288 private: 00289 virtual ~SoWWWInline(); 00290 00291 virtual void addBoundingBoxChild(SbVec3f center, SbVec3f size); 00292 00293 // Reads into instance of SoWWWInline. Returns FALSE on error. 00294 virtual SbBool readInstance(SoInput *in, unsigned short flags); 00295 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