ImFusion SDK 4.3
ViewObject Class Referenceabstract

#include <ImFusion/GUI/ViewObject.h>

Wraps a GlObject pairing it with an optional EventHandler in order to attach it to a View. More...

+ Inheritance diagram for ViewObject:

Detailed Description

Wraps a GlObject pairing it with an optional EventHandler in order to attach it to a View.

Creating a ViewObject and attaching it to a View (in contrast to attaching a plain GlObject to a GlView) allows for receiving and handling user input events (e.g. mouse events). Usually, event handling logic is implemented by the EventHandler and the ViewObject is merely supposed to coordinate.

In contrast to a ViewOverlay a ViewObject resides in world space and is rendered as part of the scene of the parent View.

Classes

class  EventHandler
 Interface to be used as base class for event handlers of ViewObjects. More...
 

Public Member Functions

 ViewObject (std::unique_ptr< GlObject > glObject)
 Instantiate a new ViewObject taking ownership of the underlying GlObject which must not be null.
 
virtual EventResult handleInputEvent (const InputEvent &event, const View &view)=0
 Gets called by the parent view in order to handle user input events.
 
const GlObjectglObject () const
 Get the underlying abstract GlObject.
 
GlObjectglObject ()
 
const GlObjectgl () const
 Original API methods for the underlying abstract GlObject.
 
GlObjectgl ()
 

Protected Attributes

std::unique_ptr< GlObjectm_glObject
 

Constructor & Destructor Documentation

◆ ViewObject()

ViewObject ( std::unique_ptr< GlObject > glObject)
explicit

Instantiate a new ViewObject taking ownership of the underlying GlObject which must not be null.

Exceptions
std::runtime_errorif glObject is nullptr

Member Function Documentation

◆ handleInputEvent()

virtual EventResult handleInputEvent ( const InputEvent & event,
const View & view )
pure virtual

Gets called by the parent view in order to handle user input events.

It returns an EventResult to indicated if and how event propagation should continue.

Parameters
eventUser input event to handle.
viewParent View where the event originates from. This additional payload enables you to add the same ViewObject to multiple views and still implement view-specific handling logic.

Implemented in SliceIndicator, TypedViewObject< ObjectType, EventHandlerType >, TypedViewObject< GlBox, GUI::BoxAnnotationEventHandler >, TypedViewObject< ImFusion::GlCircle, ImFusion::LabelingManipulator >, and InteractiveObject.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close