Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoWWWInline.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Gavin Bell (MMM yyyy)
25** Modified by : David Mott (MMM yyyy)
26** Modified by : Jim Kent (MMM yyyy)
27**=======================================================================*/
28/*=======================================================================
29 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
30 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
31 *** ***
32 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
33 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
34 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
35 *** ***
36 *** RESTRICTED RIGHTS LEGEND ***
37 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
38 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
39 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
40 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
41 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
42 *** ***
43 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
44 *** BORDEAUX, FRANCE ***
45 *** ALL RIGHTS RESERVED ***
46**=======================================================================*/
47/*=======================================================================
48** Modified by : VSG (MMM YYYY)
49**=======================================================================*/
50
51
52#ifndef _SO_WWWINLINE_
53#define _SO_WWWINLINE_
54
55#include <Inventor/misc/SoChildList.h>
56#include <Inventor/nodes/SoNode.h>
57#include <Inventor/fields/SoSFNode.h>
58#include <Inventor/fields/SoSFFilePathString.h>
59#include <Inventor/fields/SoSFVec3f.h>
60
61#include <Inventor/actions/SoCallbackAction.h>
62
63class SoWWWInline;
64class SoGroup;
65class SoWriteAction;
66
75 const SbString &url, void *userData, SoWWWInline *node);
76
77
79//
80// Class: SoWWWInline
81//
83
120class SoWWWInline : public SoNode {
121
122 SO_NODE_HEADER(SoWWWInline);
123
124 public:
129
145
170
178 void setFullURLName(const SbString &url) { fullURL = url; }
184
190
197 { if (! kidsRequested) requestChildrenFromURL(); }
201 SbBool isURLDataRequested() const { return kidsRequested; }
206 SbBool isURLDataHere() const { return kidsAreHere; }
211 { if (!kidsAreHere) kidsRequested = FALSE; }
212
217 void setChildData(SoNode *urlData);
222
229 static void setFetchURLCallBack(SoWWWInlineFetchURLCB *f, void *userData);
230
242
246 static void setBoundingBoxColor(SbColor &c) ;
250 static const SbColor &getBoundingBoxColor() ;
251
257 static void setReadAsSoFile(SbBool onOff) { readAsSoFile = onOff; };
261 static SbBool getReadAsSoFile() { return readAsSoFile; };
262
263
264 private:
265 // Traversal methods for all the actions:
266 virtual void doAction(SoAction *action);
267 virtual void doActionOnKidsOrBox(SoAction *action);
268 virtual void callback(SoCallbackAction *action);
269 virtual void GLRender(SoGLRenderAction *action);
270 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
271 virtual void getMatrix(SoGetMatrixAction *action);
272 virtual void handleEvent(SoHandleEventAction *action);
273 virtual void search(SoSearchAction *action);
274 virtual void pick(SoPickAction *action);
275 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
276
277 private:
278 static void initClass();
279 static void exitClass();
280 const SbString & getBasePath() { return basePath; }
281 void setBasePath( const SbString &path ) { basePath = path; }
282
283 // Returns pointer to children, or NULL if none
284 virtual SoChildList *getChildren() const;
285
286 // Copies the child data as well as the rest of the node (if
287 // the child data has been set)
288 virtual void copyContents(const SoFieldContainer *fromFC,
289 SbBool copyConnections);
290
291 private:
292 virtual ~SoWWWInline();
293
294 virtual void addBoundingBoxChild(SbVec3f center, SbVec3f size);
295
296 // Reads into instance of SoWWWInline. Returns FALSE on error.
297 virtual SbBool readInstance(SoInput *in, unsigned short flags);
298
299 private:
300 SbString basePath;
301 void requestChildrenFromURL();
302
303 SoChildList *children;
304 SbBool kidsRequested;
305 SbBool kidsAreHere;
306 SbString fullURL;
307
308 static SbColor bboxColor;
309 static BboxVisibility bboxVisibility;
310
311 // Static methods
312 static SoWWWInlineFetchURLCB *fetchURLcb;
313 static void *fetchURLdata;
314
315 // static variable for whether to read "name" as if this
316 // was an SoFile node
317 static SbBool readAsSoFile;
318};
319
320#endif /* _SO_WWWINLINE_ */
321
322
Color vector class.
Definition SbColor.h:82
Class for smart character strings.
Definition SbString.h:202
3D vector class.
Definition SbVec.h:932
Abstract base class for all actions.
Definition SoAction.h:132
Performs a generic traversal of a scene graph or path.
Abstract base class for objects that contain fields.
Renders a scene graph using Open Inventor's Render Engine.
Computes bounding box of a scene.
Computes transformation matrix for a subgraph.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Counts number of...
Base class for all group nodes.
Definition SoGroup.h:122
Allows nodes in a graph to receive input events.
Used to read Open Inventor data files.
Definition SoInput.h:363
Abstract base class for all database nodes.
Definition SoNode.h:145
friend class SoChildList
Definition SoNode.h:473
Abstract base class for picking objects in a scene.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Field containing...
Field containing a a node.
Definition SoSFNode.h:97
Field containing a three-dimensional vector.
Definition SoSFVec3f.h:80
Searches for nodes in a scene graph.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Node that refers...
const SbString & getFullURLName()
Returns the fullURL set by setFullURLName, or if not set, returns the contents of the name field.
SoGroup * copyChildren() const
Return a copy of the hidden children as a Group.
static const SbColor & getBoundingBoxColor()
Queries the color of bounding boxes displayed.
BboxVisibility
BboxVisibility.
@ NEVER
Do not show bounding box.
@ ALWAYS
Show bounding box along with data.
@ UNTIL_LOADED
Show bounding box (if specified) until data is loaded.
static void setReadAsSoFile(SbBool onOff)
Sets the ReadAsSoFile flag.
void requestURLData()
Requests that URL data be fetched.
static SbBool getReadAsSoFile()
Queries the ReadAsSoFile flag.
static void setBoundingBoxColor(SbColor &c)
Specifies the color of bounding boxes displayed.
void setChildData(SoNode *urlData)
Sets the child data the inline should display.
SoSFNode alternateRep
Specifies child data that can be used instead of fetching data from the URL.
static void setFetchURLCallBack(SoWWWInlineFetchURLCB *f, void *userData)
Application callbacks invoked when the inline needs its URL data fetched.
SoSFFilePathString name
Specifies the URL which the application should fetch as child data to this node (e....
SoNode * getChildData() const
Gets the child data the inline should display.
void cancelURLDataRequest()
Cancels the active URL data fetch request.
static BboxVisibility getBoundingBoxVisibility()
Queries when bounding boxes are displayed.
SoWWWInline()
Creates an inline node with default settings.
SbBool isURLDataRequested() const
Returns whether URL data has been requested.
SoSFVec3f bboxCenter
Defines the center of the bounding box surrounding the URL child data.
SbBool isURLDataHere() const
Returns whether URL data is here (i.e. whether setChildData() has been called.)
void setFullURLName(const SbString &url)
If the name field contains a relative URL (e.g. "foo.wrl" instead of "http://bogus....
void SoWWWInlineFetchURLCB(const SbString &url, void *userData, SoWWWInline *node)
This is the format for callbacks that will get URL data for us.
Definition SoWWWInline.h:74
SoSFVec3f bboxSize
Defines the size of the bounding box surrounding the URL child data.
static void setBoundingBoxVisibility(BboxVisibility b)
Specifies when bounding boxes are displayed.
Writes a scene graph to a file.
int SbBool
Boolean type.
Definition SbBase.h:87