Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
ViewManager.h
1// View manager
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 _VIEW_MANAGER_H_
17#define _VIEW_MANAGER_H_
18
19#include <Inventor/nodes/SoGroup.h>
20#include <Medical/InventorMedical.h>
21
22// It's convenient for applications to get this automatically.
23#include "SceneView.h"
24
25class SoNodeSensor;
27class SoPickAction;
28
93class INVENTORMEDICAL_API ViewManager : public SoGroup {
94
95 SO_NODE_HEADER(ViewManager);
96
97public:
98
100 static void initClass();
101
103 static void exitClass();
104
107
110 void addView( const SceneView* newView );
111
113 int getNumViews() const;
114
118 SceneView* getView( int index ) const;
119
126 SceneView* getView( const SbVec2f& position ) const;
127
130 int getViewIndex( const SceneView* view ) const;
131
138 int getViewIndex( const SbVec2f& position ) const;
139
147
154
157 void setViewport( int index, SbVec4f& vport );
158
161 void setViewport( int index, float xorig, float yorig, float xsize, float ysize );
162
170 void setEventCaptureView( int viewIndex );
171
172 private:
173
175 virtual void addChild( SoNode* child );
176 virtual void insertChild( SoNode *child, int newChildIndex );
177 virtual void replaceChild( SoNode* oldChild, SoNode* newChild );
178 virtual void replaceChild( int index, SoNode* newChild );
179
180private:
182 virtual ~ViewManager();
183
184 // Actions we handle directly
185 virtual void handleEvent( SoHandleEventAction* action );
186
187 // Internal state
188 int m_numViews; // Remember this to check for changes
189 unsigned int m_buttonsPressed; // Which buttons are currently pressed?
190
191 SbVec2f m_eventPos; // Position of last event handled
192 int m_eventViewIndex; // View that handled the last event
193 int m_captureViewIndex; // View that "owns" the event stream
194
195 SoNodeSensor* m_sensor;
196 static void sensorCB( void* data, SoSensor* sensor );
197};
198
199#endif
2D vector class.
Definition SbVec.h:76
4D vector class.
Definition SbVec.h:2214
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> (Preview feature...
Definition SceneView.h:132
Base class for all group nodes.
Definition SoGroup.h:122
virtual void replaceChild(int index, SoNode *newChild)
Replaces child with given index with new child.
virtual void addChild(SoNode *child)
Adds a child as last one in group.
virtual void insertChild(SoNode *child, int newChildIndex)
Adds a child so that it becomes the one with the given index.
Allows nodes in a graph to receive input events.
Abstract base class for all database nodes.
Definition SoNode.h:145
Sensor class that can be attached to Open Inventor nodes.
Abstract base class for picking objects in a scene.
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> (Preview feature...
Definition ViewManager.h:93
int getLastEventViewIndex() const
Returns the index of the view that handled the last event.
ViewManager()
Constructor.
void setViewport(int index, SbVec4f &vport)
Convenience method to set the viewport of a view.
void setEventCaptureView(int viewIndex)
Set event capture view.
int getNumViews() const
Returns the current number of views being managed.
static void exitClass()
Finish using the class.
void addView(const SceneView *newView)
Add a view.
SceneView * getView(int index) const
Returns the view with the specified index.
SceneView * getView(const SbVec2f &position) const
Returns the first view containing the specified pixel coordinate.
void setViewport(int index, float xorig, float yorig, float xsize, float ysize)
Convenience method to set the viewport of a view.
SbVec2f getLastEventPosition() const
Returns the position of the last event handled (in pixels).
int getViewIndex(const SbVec2f &position) const
Returns a view index for the specified pixel coordinate.
int getViewIndex(const SceneView *view) const
Returns the index of the specified view.
static void initClass()
Initialize the class.