Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SceneView.h
1// Define a view (within a render area)
2
4//
5// This class is part of the Open Inventor Medical utility library.
6//
7// The medical utility classes are provided as a prebuilt library named
8// "fei_inventor_medical", that can be used directly in an Open Inventor
9// application. The classes in the prebuilt library are documented and
10// supported by Thermo Fisher Scientific. These classes are also provided as source code.
11//
12// Please see $OIVHOME/include/Medical/InventorMedical.h for the full text.
13//
15
16#ifndef _SCENE_VIEW_H_
17#define _SCENE_VIEW_H_
18
19// Note: Full header files are required to use SoRef on member variables.
20#include <Inventor/nodes/SoLineSet.h>
21#include <Inventor/nodes/SoSeparator.h>
22#include <Inventor/nodes/SoSwitch.h>
23#include <Inventor/nodes/SoViewport.h>
24
25#include <Inventor/fields/SoSFBool.h>
26#include <Inventor/fields/SoSFNode.h>
27#include <Inventor/fields/SoSFVec2f.h>
28#include <Inventor/SbViewportRegion.h>
29
30#include <Medical/InventorMedical.h>
31
32class SoAction;
33class SoNodeSensor;
34
132class INVENTORMEDICAL_API SceneView : public SoSeparator {
133
134 SO_NODE_HEADER(SceneView);
135
136public:
137
143
149
152
163
164
167 void setViewport( float origX, float origY, float sizeX, float sizeY );
168
171 void setViewport( const SbVec4f& viewport );
172
174 const SbVec4f& getViewport() const;
175
179
182
188
190 static void initClass();
191
193 static void exitClass();
194
197
198 private:
199
201 virtual void addChild( SoNode* child );
202 virtual int findChild( const SoNode* child ) const;
203 virtual SoNode* getChild( int index ) const;
204 virtual void insertChild( SoNode* child, int newChildIndex );
205 virtual void removeChild( SoNode* child );
206 virtual void removeChild( int index );
207 virtual void removeAllChildren();
208 virtual void replaceChild( SoNode* oldChild, SoNode* newChild );
209 virtual void replaceChild( int index, SoNode* newChild );
210 virtual int getNumChildren() const;
211
212private:
214 virtual ~SceneView();
215
216 // Internal helpers
217 void viewportFieldChanged();
218 void viewportParentChanged( const SbViewportRegion& vpregion );
219 void updateOurViewport();
220 static void callback(void* userData, SoAction* action);
221
222 // Internal state
223 SbVec4f m_curViewport; // Current viewport in normalized coords
224 SbViewportRegion m_vportRegion; // Used to answer queries
225
226 SbVec4f m_viewport; // What we actually set (pixels) as float
227 SbVec4i32 m_viewportPixels; // What we actually set (pixels) as int
228 SbVec2i32 m_viewportOrig; // What we actually set (pixels)
229 SbVec2i32 m_viewportSize; // What we actually set (pixels)
230
231 SbVec2i32 m_parentOrig; // What we inherited (pixels)
232 SbVec2i32 m_parentSize; // What we inherited (pixels)
233
234 SoRef<SoSwitch> m_masterSwitch; // Internal scene graph
235 SoRef<SoViewport> m_vportNode;
236 SoRef<SoSeparator> m_sceneNode;
237 SoRef<SoSwitch> m_borderSwitch;
238 SoRef<SoLineSet> m_borderLine;
239
240 bool m_handleEvents; // See enableEventHandling() method.
241
242 SoNodeSensor* m_sensor;
243 bool m_ignoreSensor; // Used to temporarily disable sensor
244 static void sensorCB( void* data, SoSensor* sensor );
245};
246
247#endif
2D vector class.
Definition SbVec.h:517
4D vector class.
Definition SbVec.h:2214
4D vector class.
Definition SbVec.h:2639
Class for representing a viewport.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> (Preview feature...
Definition SceneView.h:132
SoSFBool drawBorder
Enable drawing a border around the view's viewport.
Definition SceneView.h:162
SoSFVec2f viewportSize
Viewport size (normalized device coordinates 0..1).
Definition SceneView.h:148
void enableEventHandling(SbBool onoff)
Enable handling events.
const SbViewportRegion & getViewportRegion() const
Returns the actual viewport in pixels.
const SbVec4f & getViewportPixels() const
Returns the actual viewport in pixels.
SoSFVec2f viewportOrigin
Viewport origin (normalized device coordinates 0..1).
Definition SceneView.h:142
SoSFBool active
Enable rendering the view.
Definition SceneView.h:151
SceneView()
Constructor.
void setViewport(const SbVec4f &viewport)
Convenience method to set viewport in normalized coordinates with one call.
void setViewport(float origX, float origY, float sizeX, float sizeY)
Convenience method to set viewport in normalized coordinates with one call.
const SbVec4f & getViewport() const
Returns the current viewport as a convenient single object.
static void exitClass()
Finish using the class.
static void initClass()
Initialize the class.
Abstract base class for all actions.
Definition SoAction.h:132
virtual void removeChild(int index)
Removes child with given index from group.
virtual void replaceChild(int index, SoNode *newChild)
Replaces child with given index with new child.
virtual SoNode * getChild(int index) const
Returns pointer the child node with the given index.
virtual void addChild(SoNode *child)
Adds a child as last one in group.
virtual int findChild(const SoNode *child) const
Finds index of given child within group.
virtual void insertChild(SoNode *child, int newChildIndex)
Adds a child so that it becomes the one with the given index.
virtual int getNumChildren() const
Returns number of children.
virtual void removeAllChildren()
Removes all children from group.
Abstract base class for all database nodes.
Definition SoNode.h:145
Sensor class that can be attached to Open Inventor nodes.
Smart pointer for any class inheriting SoRefCounter.
Definition SoRef.h:90
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing a two-dimensional vector.
Definition SoSFVec2f.h:78
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
Group node that saves and restores traversal state.
int SbBool
Boolean type.
Definition SbBase.h:87