Class PoBaseView

  • All Implemented Interfaces:
    SafeDisposable
    Direct Known Subclasses:
    PoSceneView, PoView

    public class PoBaseView
    extends SoBaseKit
    Abstract base class for views. Views allow the application to specify multiple cameras, each with its own separate viewport (region of the 3D window). This is more powerful than just using multiple SoCamera nodes, because camera nodes do not allow specifying a viewport (the viewport is always the full window).

    In addition, when mouse event locations are mapped back into 3D space, Open Inventor automatically uses the view volume of the camera associated with the view whose viewport currently contains the mouse cursor.

    Views can be used to efficiently create the effect of multiple windows, without the overhead and system dependent code to manage multiple windows. For example, views can be used to subdivide the window into multiple independent views of a 3D scene or to create an inset "bird's eye" view inside the window.

    Basically, a view consists of a camera (specifically an SoCameraKit) and a viewport attached to this camera. The viewport is the region of the graphics window in which the scene graph will be rendered.

    NOTES:

    • If you use a viewer, you should call the method SoBaseKit.setSearchingChildren(true) to allow the viewer to search for cameras inside nodekits (like this one).
    • Do not place a camera node before this nodekit.
    • Create a camera for each view and set it using the setPart method. See example in PoSceneView.
    • When you use HardCopy, the graphics window is the paper sheet.

    LIMITATIONS:

    • The field SoCamera.viewportMapping must be equal to ADJUST_CAMERA in order to have a correct vectorisation when you use HardCopy,
    • Do not use the SoBoxHighlightRenderAction class on a scene graph which contains a view,
    • Do not push view,
    • Be careful when you use the method viewAll() of the class SoXtViewer, because this method works on the entire scene graph and not on a portion of a scene graph. Overload this method according to your requirements,
    • Some of the viewer functions/buttons do not work correctly with views.
      For example, saveHomePosition() and resetToHomePosition() do not work correctly because the viewer only stores one copy of the camera.
    • The viewer rendering options, e.g. wireframe, apply to ALL views inside the viewer. You can implement these effects per-view using an SoDrawStyle node and setOverride() if necessary.

    CHANGES:

    • Since Open Inventor 8.1, PoBaseView and related classes (PoView, PoSceneView) have been moved from MeshViz into core Open Inventor.
    • Since Open Inventor 8.1, the callback viewingEventCB no longer needs to be registered. This is now done automatically in the So<XXX>Viewer classes.

    Action behavior:

    Sets: SoViewportRegionElement, SoLogicalViewportElement, SoModifyViewVolumeElement, SoUpdateAreaElement

    See Also:
    PoView, PoSceneView
    • Field Detail

      • viewportOrigin

        public final SoSFVec2f viewportOrigin
        Lower-left corner coordinates of the viewport of the view.
        These coordinates must be given in the normalized space [0-1]*[0-1]. The coordinate (0,0) is the lower- left corner of the display window and (1,1) is the upper-right corner. Default is 0,0.
      • viewportSize

        public final SoSFVec2f viewportSize
        Size of the viewport of the view.
        viewportSize[0] is the viewport's width and viewportSize[1] is the viewport's height, each in normalized space. Therefore viewportOrigin[0]+viewportSize[0] and viewportOrigin[1]+viewportSize[1] must be less than or equal to 1. Default is 1,1.
    • Method Detail

      • sensitiveOnEvents

        public void sensitiveOnEvents​(boolean flag)
        Specifies if the view is sensitive to events. Default is false.
      • isSensitiveOnEvents

        public boolean isSensitiveOnEvents()
        Returns true if the view is sensitive to events.
      • isPointWithinViewport

        public boolean isPointWithinViewport​(float x,
                                             float y)
        Indicates if a point defined in the normalized space [0-1]x[0-1] is in the viewport of the view.