Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
ViewManager Class Reference

VSG extension (Preview feature) [Medical] View manager for use with viewer components. More...

#include <Medical/nodes/ViewManager.h>

+ Inheritance diagram for ViewManager:

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 ViewManager ()
 Constructor.
 
void addView (const SceneView *newView)
 Add a view.
 
int getNumViews () const
 Returns the current number of views being managed.
 
SceneViewgetView (int index) const
 Returns the view with the specified index.
 
SceneViewgetView (const SbVec2f &position) const
 Returns the first view containing the specified pixel coordinate.
 
int getViewIndex (const SceneView *view) const
 Returns the index of the specified view.
 
int getViewIndex (const SbVec2f &position) const
 Returns a view index for the specified pixel coordinate.
 
int getLastEventViewIndex () const
 Returns the index of the view that handled the last event.
 
SbVec2f getLastEventPosition () const
 Returns the position of the last event handled (in pixels).
 
void setViewport (int index, SbVec4f &vport)
 Convenience method to set the viewport of a view.
 
void setViewport (int index, float xorig, float yorig, float xsize, float ysize)
 Convenience method to set the viewport of a view.
 
void setEventCaptureView (int viewIndex)
 Set event capture view.
 
- Public Member Functions inherited from SoGroup
 SoGroup ()
 Creates an empty group node.
 
 SoGroup (int nChildren)
 Constructor that takes approximate number of children.
 
virtual SoNodegetChild (int index) const
 Returns pointer the child node with the given index.
 
virtual int findChild (const SoNode *child) const
 Finds index of given child within group.
 
virtual int getNumChildren () const
 Returns number of children.
 
virtual void removeChild (int index)
 Removes child with given index from group.
 
virtual void removeChild (SoNode *child)
 Removes first instance of given child from group.
 
virtual void removeAllChildren ()
 Removes all children from group.
 
- Public Member Functions inherited from SoNode
virtual void setOverride (const SbBool state)
 Turns the override flag on or off.
 
virtual SbBool isOverride () const
 Returns the state of the override flag.
 
virtual SoNodecopy (SbBool copyConnections=FALSE) const
 Creates and returns an exact copy of the node.
 
virtual SbBool affectsState () const
 Returns TRUE if a node has an effect on the state during traversal.
 
virtual void touch ()
 Marks an instance as modified, simulating a change to it.
 
- Public Member Functions inherited from SoFieldContainer
void setToDefaults ()
 Sets all fields in this object to their default values.
 
SbBool hasDefaultValues () const
 Returns TRUE if all of the object's fields have their default values.
 
SbBool fieldsAreEqual (const SoFieldContainer *fc) const
 Returns TRUE if this object's fields are exactly equal to fc's fields.
 
void copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE)
 Copies the contents of fc's fields into this object's fields.
 
SoNONUNICODE SbBool set (const char *fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
SbBool set (const SbString &fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
void get (SbString &fieldDataString)
 Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.
 
virtual int getFields (SoFieldList &list) const
 Appends references to all of this object's fields to resultList, and returns the number of fields appended.
 
virtual int getAllFields (SoFieldList &list) const
 Returns a list of fields, including the eventIn's and eventOut's.
 
virtual SoFieldgetField (const SbName &fieldName) const
 Returns a the field of this object whose name is fieldName.
 
virtual SoFieldgetEventIn (const SbName &fieldName) const
 Returns a the eventIn with the given name.
 
virtual SoFieldgetEventOut (const SbName &fieldName) const
 Returns the eventOut with the given name.
 
SbBool getFieldName (const SoField *field, SbName &fieldName) const
 Returns the name of the given field in the fieldName argument.
 
SbBool enableNotify (SbBool flag)
 Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).
 
SbBool isNotifyEnabled () const
 Notification is the process of telling interested objects that this object has changed.
 
virtual void setUserData (void *data)
 Sets application data.
 
void * getUserData (void) const
 Gets user application data.
 
- Public Member Functions inherited from SoBase
virtual SbName getName () const
 Returns the name of an instance.
 
virtual void setName (const SbName &name)
 Sets the name of an instance.
 
void setSynchronizable (const bool b)
 Sets this to be a ScaleViz synchronizable object.
 
bool isSynchronizable () const
 Gets the ScaleViz synchronizable state of this object.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static void initClass ()
 Initialize the class.
 
static void exitClass ()
 Finish using the class.
 
- Static Public Member Functions inherited from SoGroup
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoNode
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static SoNodegetByName (const SbName &name)
 A node's name can be set using SoBase::setName().
 
static int getByName (const SbName &name, SoNodeList &list)
 A node's name can be set using SoBase::setName().
 
- Static Public Member Functions inherited from SoFieldContainer
static SoType getClassTypeId ()
 Returns the type of this class.
 
- Static Public Member Functions inherited from SoBase
static SoType getClassTypeId ()
 Returns type identifier for this class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Additional Inherited Members

- Public Attributes inherited from SoGroup
SoSFBool boundingBoxIgnoring
 Whether to ignore this node during bounding box traversal.
 

Detailed Description

VSG extension (Preview feature) [Medical] View manager for use with viewer components.

This is a group node that manages a list of SceneView nodes to allow rendering multiple views inside a render area.

Each SceneView node defines a viewport (sub-region of the render area), a scene to render (usually including a camera node) and optionally a border. SceneView nodes may be used without a ViewManager node, but they rely on a ViewManager node to route user events like mouse button and keyboard presses to the appropriate SceneView scene graph for handling.

Primary distribution of events is based on the event position, the viewport and the order the SceneView nodes are traversed. If no mouse buttons are pressed, then all events are sent to the first SceneView whose viewport contains the event position. When a mouse button is pressed, the view that handles that event "captures" the event stream until all mouse buttons are released. This is convenient because it allows the user to drag the cursor anywhere while, for example, moving the camera. While at least one mouse button is pressed, all events are sent to the SceneView that owns the event stream. This is similar to the way the classic Open Inventor viewers capture events while a mouse button is pressed. It is also similar to the SoHandleEventAction setGrabber() feature that is used by Open Inventor draggers (see SoDragger). The ViewManager event capture and setGrabber() are independent and complementary.

The application can also choose to do "global" event handing by adding an SoEventCallback node above the ViewManager node. If the application needs to know which view the event should affect, for example a key press that means to reset the camera, use the getViewIndex(SbVec2f position) method to know which view contains the event position. Finally, on some devices it is not possible to know the position of some events, for example key press events. So ViewManager also tracks the last known event position, based on mouse move events. The application can query this using getLastEventViewIndex() and getLastEventPosition().

ViewManager also provides convenience methods for setting and getting the viewports of the child views. This is convenient for managing the layout of the viewports. For example to change from four equal size viewports to one large viewport plus three small viewports.

Note: Only SceneView nodes are allowed as children of a ViewManager node. Attempts to add any other kind of node are ignored.

Example 1:

// Create 2 x 2 view layout
ViewManager* m_viewManager = new ViewManager();
for (int i = 0; i < 4; ++i)
m_viewManager->addView( new SceneView() );
m_viewManager->getView(0)->setViewport( 0, 0.5f, 0.5f, 0.5f ); // Upper left
m_viewManager->getView(1)->setViewport( 0.5f, 0.5f, 0.5f, 0.5f ); // Upper right
m_viewManager->getView(2)->setViewport( 0, 0, 0.5f, 0.5f ); // Lower left
m_viewManager->getView(3)->setViewport( 0.5f, 0, 0.5f, 0.5f ); // Lower right
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> (Preview feature...
Definition SceneView.h:132
void setViewport(float origX, float origY, float sizeX, float sizeY)
Convenience method to set viewport in normalized coordinates with one call.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> (Preview feature...
Definition ViewManager.h:93
ViewManager()
Constructor.
void addView(const SceneView *newView)
Add a view.
SceneView * getView(int index) const
Returns the view with the specified index.

SEE ALSO

SceneView

Definition at line 93 of file ViewManager.h.

Constructor & Destructor Documentation

◆ ViewManager()

ViewManager::ViewManager ( )

Constructor.

Member Function Documentation

◆ addView()

void ViewManager::addView ( const SceneView newView)

Add a view.

Adds the specified view to the end of the list.

◆ exitClass()

static void ViewManager::exitClass ( )
static

Finish using the class.

◆ getClassTypeId()

static SoType ViewManager::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getLastEventPosition()

SbVec2f ViewManager::getLastEventPosition ( ) const

Returns the position of the last event handled (in pixels).

Generally Open Inventor sets the cursor position for all mouse and keyboard events. But this query could be useful if it is necessary to handle an event that does not have an associated position on screen. Returns (0,0) if no other info.

◆ getLastEventViewIndex()

int ViewManager::getLastEventViewIndex ( ) const

Returns the index of the view that handled the last event.

If event capture is active (a mouse button was pressed), then the index returned is the event capture view, not necessarily the same as the view currently containing the cursor. Returns -1 if not possible to answer the query.

◆ getNumViews()

int ViewManager::getNumViews ( ) const

Returns the current number of views being managed.

◆ getTypeId()

virtual SoType ViewManager::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoGroup.

◆ getView() [1/2]

SceneView * ViewManager::getView ( const SbVec2f position) const

Returns the first view containing the specified pixel coordinate.

This is the view that would handle an event at this location. This is convenient, for example, to implement global hot keys that should only affect the view that contains the event. Then it is not necessary to duplicate an SoEventCallback in each view for this purpose. Returns null if the location is not valid.

◆ getView() [2/2]

SceneView * ViewManager::getView ( int  index) const

Returns the view with the specified index.

Same as getChild() but avoids the need to cast the result. Returns null if index is not valid.

◆ getViewIndex() [1/2]

int ViewManager::getViewIndex ( const SbVec2f position) const

Returns a view index for the specified pixel coordinate.

This is the index of the view that would handle an event at this location. This is convenient, for example, to implement global hot keys that should only affect the view that contains the event. Then it is not necessary to duplicate an SoEventCallback in each view for this purpose. Returns -1 if the location is not valid.

◆ getViewIndex() [2/2]

int ViewManager::getViewIndex ( const SceneView view) const

Returns the index of the specified view.

Returns -1 if the specified view does not exist.

◆ initClass()

static void ViewManager::initClass ( )
static

Initialize the class.

◆ setEventCaptureView()

void ViewManager::setEventCaptureView ( int  viewIndex)

Set event capture view.

If viewIndex >= 0, calls enableEventHandling with true for that view and false for every other view. If viewIndex < 0, sets true for all views. Invalid indices are ignored. Used internally to manage event capture.

Generally the application should not call this method.

◆ setViewport() [1/2]

void ViewManager::setViewport ( int  index,
float  xorig,
float  yorig,
float  xsize,
float  ysize 
)

Convenience method to set the viewport of a view.

Ignored if the index is out of range.

◆ setViewport() [2/2]

void ViewManager::setViewport ( int  index,
SbVec4f vport 
)

Convenience method to set the viewport of a view.

Ignored if the index is out of range.


The documentation for this class was generated from the following file: