SceneView Class Reference
[Nodes]

VSG extension [PREVIEW] [Medical] Defines a view for use with ViewManager. More...

#include <Medical/nodes/SceneView.h>

Inheritance diagram for SceneView:
SoSeparator SoGroup SoNode SoFieldContainer SoBase SoRefCounter SoTypedObject

List of all members.

Public Member Functions

virtual SoType getTypeId () const
void setViewport (float origX, float origY, float sizeX, float sizeY)
void setViewport (const SbVec4f &viewport)
const SbVec4fgetViewport () const
const SbViewportRegiongetViewportRegion () const
const SbVec4fgetViewportPixels () const
void enableEventHandling (SbBool onoff)
 SceneView ()

Static Public Member Functions

static SoType getClassTypeId ()
static void initClass ()
static void exitClass ()

Public Attributes

SoSFVec2f viewportOrigin
SoSFVec2f viewportSize
SoSFBool active
SoSFBool drawBorder

Detailed Description

VSG extension [PREVIEW] [Medical] Defines a view for use with ViewManager.

This class defines a "view" consisting of a viewport (subregion) inside the render area, a scene graph to be rendered and an optional border.

This class is conceptually similar to the older class PoSceneView, but is designed to be used with the Viewer Component classes, specifically SceneExaminer, and with the ViewManager class.

Usually the specified scene graph will contain its own camera node and one or more light nodes. If the user should be able to manipulate the camera, we recommend adding a SceneExaminer node (which automatically creates a camera, headlight and event handlers) and then setting the actual scene to be rendered as a child of the SceneExaminer.

Normally the SceneView node(s) should be added as children of a ViewManager node. This is not required if no nodes in the view need to handle events, for example if the view is an orientation indicator or bird's eye view and its camera is linked to a main camera. However the ViewManager node is needed to deliver events to its SceneView children based on the position of the event and the order of the SceneView children. The SoHandleEventAction will only be allowed to traverse a SceneView node's scene graph if the event position is inside that SceneView's viewport or the SceneView has "captured" events. See ViewManager for more details.

Note that the specified viewport is relative to the node's inherited viewport. For the "first level" of SceneView nodes the viewport is relative to the entire render area, as expected. However this feature allows the powerful capability to "nest" SceneView nodes. If a SceneView node is the child of another SceneView node, the child's viewport is relative to the viewport set by the parent node. For example, one quadrant of the render area could be subdivided into multiple smaller viewports to create a "light box" view. The viewport definition may be dynamically changed to create a different layout of views. For example four equal size viewports can be dynamically changed to one large viewport plus three small viewports. The convenience methods in the ViewManager node make it easy to modify the view layout.

The active field can be used to prevent a view from being rendered. This is convenient, for example, when switching from a four view layout to a one or two view layout. In this case it is not necessary to remove the inactive SceneView nodes from their parent ViewManager, just set 'active' to false.

Data nodes, e.g. SoVolumeData, that are shared by multiple views may be placed in the scene graph above the ViewManager node. But note that in most cases Open Inventor cannot compute the correct bounding box without traversing the data node. This means that calling viewAll() on the SceneExaminer inside a view will compute the correct view volume. You can work around this by placing an SoBBox node under the SceneView and setting its 'boundingBox' field to (for example) the extent of the SoVolumeData node. Alternatively you can create one instance of the data node and add that instance under the SceneExaminer in each view that needs that data. In this case the viewAll() should work as expected. Do not create a separate instance of the data node for each view as this will cause the data to be loaded multiple times.

Tiling: Even when working in normalized coordinates it is necessary to take some care about the size of the viewports in pixels. For example, if the render area is 1024 pixels wide, then creating two tiles (viewports) with width 0.5 will result in two non-overlapping viewports, each 512 pixels wide as expected. But 1024 is not evenly divisible by 3, so creating three tiles with width 0.3333 means that each tile will be 341 pixels wide and 3 * 341 = 1023, leaving a 1 pixel gap. In this case it is necessary to make one of the viewports 1 pixel larger than the others. The width of 1 pixel in normalized coordinates is simply 1 / widthOfParentViewport (in pixels).

Limitations:

FILE FORMAT/DEFAULT

SEE ALSO

ViewManager, SceneExaminer

What is a Preview Feature ?:

Constructor & Destructor Documentation

SceneView::SceneView (  ) 

Constructor.


Member Function Documentation

void SceneView::enableEventHandling ( SbBool  onoff  ) 

Enable handling events.

Default is true. This method is used by the ViewManager node to temporarily disable event handling without triggering notification. Generally the application should not call this method directly.

static void SceneView::exitClass (  )  [static]

Finish using the class.

Reimplemented from SoSeparator.

static SoType SceneView::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoSeparator.

virtual SoType SceneView::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Reimplemented from SoSeparator.

const SbVec4f& SceneView::getViewport (  )  const

Returns the current viewport as a convenient single object.

const SbVec4f& SceneView::getViewportPixels (  )  const

Returns the actual viewport in pixels.

const SbViewportRegion& SceneView::getViewportRegion (  )  const

Returns the actual viewport in pixels.

Convenient to use with (for example) viewAll().

static void SceneView::initClass (  )  [static]

Initialize the class.

Reimplemented from SoSeparator.

void SceneView::setViewport ( const SbVec4f viewport  ) 

Convenience method to set viewport in normalized coordinates with one call.

Modifies the 'viewportOrig' and 'viewportSize' fields.

void SceneView::setViewport ( float  origX,
float  origY,
float  sizeX,
float  sizeY 
)

Convenience method to set viewport in normalized coordinates with one call.

Modifies the 'viewportOrig' and 'viewportSize' fields.


Member Data Documentation

Enable rendering the view.

Default is true.

Enable drawing a border around the view's viewport.

Default is true.

  • The border is 1 pixel wide and uses the outermost pixels of the viewport, effectively reducing the size of the viewport by two pixels in each direction.
  • If two adjacent views have their border enabled the result will usually be a two pixel wide line (1 pixel in each view). However, see the discussion about "tiling" above. If the pixel size of the views are not taken into account then border lines may overlap or show a one pixel gap.

Viewport origin (normalized device coordinates 0..1).

Default is 0,0. Illegal values, e.g. < 0 or > 1, are clamped to 0..1.

Viewport size (normalized device coordinates 0..1).

Default is 1,1. Illegal values, e.g. < 0 or > 1, are clamped to 0..1.


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

Open Inventor Toolkit reference manual, generated on 4 Sep 2023
Copyright © Thermo Fisher Scientific All rights reserved.
https://www.openinventor.com/