Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoFile.h
Go to the documentation of this file.
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 : Paul S. Strauss (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50#ifndef _SO_FILE_
51#define _SO_FILE_
52
57
58class SoSensor;
59class SoFieldSensor;
60
62//
63// Class: SoFile
64//
65// This node represents a subgraph that was read from a
66// named input file. When a file node is written out, just the field
67// containing the name of the file is written. (No children are
68// written out.) When one is encountered during reading, reading
69// continues from the named file, and all children found in the file
70// are added as hidden children of this node.
71//
72// Whenever the name of the input file changes
73// (name.setValue("foo.iv")), the old children are removed and the
74// contents of the new file is read in. The file node remembers
75// what directory the last file was read from, and will read the new
76// file from the same directory after checking the standard list of
77// directories (see the static methods on SoInput), assuming the
78// field isn't set to an absolute path name.
79//
81
82class SoGroup;
83
134class SoFile : public SoNode {
135
137
138 public:
139 // Fields
144
149
154
159 static void setSearchOK(SbBool flag);
160
165 static SbBool getSearchOK() { return m_searchOK; };
166
167 private:
168 // Traversal methods for all the actions:
169 virtual void doAction(SoAction *action);
170 virtual void callback(SoCallbackAction *action);
171 virtual void search(SoSearchAction *action);
172 virtual void GLRender(SoGLRenderAction *action);
173 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
174 virtual void getMatrix(SoGetMatrixAction *action);
175 virtual void handleEvent(SoHandleEventAction *action);
176 virtual void pick(SoPickAction *action);
177 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
178
179 private:
180 static void initClass();
181 static void exitClass();
182
183 // Returns pointer to children
184 virtual SoChildList *getChildren() const;
185
186 // Copies the contents of the given node into this instance.
187 // This copies without re-reading the file.
188 virtual void copyContents(const SoFieldContainer *fromFC,
189 SbBool copyConnections);
190
191 private:
192 // Reads stuff into instance of SoFile. Returns FALSE on error.
193 virtual SbBool readInstance(SoInput *in, unsigned short flags);
194
195 virtual ~SoFile();
196
197 private:
198 SoChildList* children;
199
200 void nameChangedCallback(SoInput *upIn = NULL);
201
202 // These keep the image and filename fields in sync.
203 SoFieldSensor *nameChangedSensor;
204 static void nameChangedCB(void *, SoSensor *);
205
206 // FALSE on read error.
207 SbBool readOK;
208 static SbBool m_searchOK;
209
210};
211
212#endif /* _SO_FILE_ */
213
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
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.
Sensor class that can be attached to Open Inventor fields.
Node that reads children from a named file.
Definition SoFile.h:134
SoGroup * copyChildren() const
Returns a new SoGroup containing copies of all of the file node's children.
SoFile()
Creates a file node with default settings.
static void setSearchOK(SbBool flag)
If flag is TRUE, the search action will traverse hidden children.
static SbBool getSearchOK()
Queries whether the search action will traverse the hidden children.
Definition SoFile.h:165
SoSFFilePathString name
Name of file from which to read children.
Definition SoFile.h:143
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:472
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...
Searches for nodes in a scene graph.
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:97
int SbBool
Boolean type.
Definition SbBase.h:87