#include <RemoteViz/Rendering/RenderAreaListener.h>
Public Member Functions | |
virtual | ~RenderAreaListener () |
Destructor. | |
virtual void | onOpenedConnection (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > connection, std::shared_ptr< FrameEncoders > frameEncoders) |
Triggered when a client connects to the RenderArea. | |
virtual void | onInitializedConnection (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, std::shared_ptr< const FrameEncoders > frameEncoders) |
Triggered when the connection and the frame encoders are initialized successfully. | |
virtual void | onClosedConnection (std::shared_ptr< RenderArea > renderArea, const std::string &connectionId, bool aborted) |
Triggered when a connection is closed. | |
virtual void | onReceivedMessage (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, const std::string &message) |
Triggered when a text message is received from a client. | |
virtual void | onReceivedMessage (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, const std::vector< unsigned char > &buffer) |
Triggered when a binary message is received from a client. | |
virtual bool | onPreRender (std::shared_ptr< RenderArea > renderArea, bool &clearWindow, bool &clearZbuffer) |
Triggered before a rendering is done. | |
virtual void | onPostRender (std::shared_ptr< RenderArea > renderArea) |
Triggered after a rendering is done. | |
virtual void | onResize (std::shared_ptr< RenderArea > renderArea, unsigned int width, unsigned int height) |
Triggered when the renderArea is resized. | |
virtual void | onRequestedSize (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, unsigned int width, unsigned int height) |
Triggered when a client requests a new renderArea size. | |
virtual void | onRefusedEncoder (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, std::shared_ptr< FrameEncoders > encoders) |
Triggered when a frame encoder cannot be initialized. | |
virtual bool | onMouseUp (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, int x, int y, SoMouseButtonEvent::Button button) |
Triggered when a MouseUp event is received from the client. | |
virtual bool | onMouseDown (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, int x, int y, SoMouseButtonEvent::Button button) |
Triggered when a MouseDown event is received from the client. | |
virtual bool | onMouseDoubleClick (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, int x, int y, SoMouseButtonEvent::Button button) |
Triggered when a MouseDoubleClick event is received from the client. | |
virtual bool | onMouseMove (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, int x, int y) |
Triggered when a MouseMove event is received from the client. | |
virtual bool | onMouseEnter (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, int x, int y) |
Triggered when a MouseEnter event is received from the client. | |
virtual bool | onMouseLeave (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, int x, int y) |
Triggered when a MouseLeave event is received from the client. | |
virtual bool | onMouseWheel (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, int x, int y, int delta) |
Triggered when a mouse wheel event (rotatation) is received from the client. | |
virtual bool | onKeyUp (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, int x, int y, const SoKeyboardEvent::Key &key) |
Triggered when a KeyUp event is received from the client. | |
virtual bool | onKeyDown (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, int x, int y, const SoKeyboardEvent::Key &key) |
Triggered when a KeyDown event is received from the client. | |
virtual bool | onTouchStart (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, unsigned int id, int x, int y) |
Triggered when a TouchStart event is received from the client. | |
virtual bool | onTouchMove (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, unsigned int id, int x, int y) |
Triggered when a TouchMove event is received from the client. | |
virtual bool | onTouchEnd (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, unsigned int id, int x, int y) |
Triggered when a TouchEnd event is received from the client. | |
virtual void | onRequestedFrame (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, SbRasterImage *rasterImage, bool &isInteractive) |
Triggered when a new frame is requested by a connection. | |
virtual void | onSendingFrame (std::shared_ptr< RenderArea > renderArea, std::shared_ptr< Connection > sender, std::string &message) |
Triggered before sending a frame to the client. | |
This class can be overridden by an application to receive notifications from a RenderArea.
There are several categories of notifications:
For notifications related to the lifetime of the RenderArea itself, see the ServiceListener class.
Typically the application will attach a listener to the RenderArea in the onInstantiatedRenderArea() method of its ServiceListener. But applications can also create a RenderArea explicitly and attach a listener.
A typical sequence of calls to this listener is:
Definition at line 83 of file RenderAreaListener.h.
|
virtual |
Destructor.
|
virtual |
Triggered when a connection is closed.
Default behavior : Dispose the renderArea if all its connections are closed and the application does not have a reference to the renderArea. If the application has a reference, it can use RenderArea::isDisposed() to know the state.
renderArea | : the RenderArea |
connectionId | : ID identifying the connection |
aborted | : true if the network connection was closed unexpectedly by the client or has been lost. |
|
virtual |
Triggered when the connection and the frame encoders are initialized successfully.
Use the FrameEncoders object to query which frame encoders will actually be used.
renderArea | : the RenderArea requested by the connection |
sender | : the Connection |
frameEncoders | : frame encoders that have been initialized by the connection |
|
virtual |
Triggered when a KeyDown event is received from the client.
Default behavior : Accept the event by returning true.
renderArea | : the RenderArea that will process the event |
sender | : the connection that sent the event |
x | : horizontal coordinate |
y | : vertical coordinate |
key | : pressed key |
|
virtual |
Triggered when a KeyUp event is received from the client.
Default behavior : accept the event by returning true.
renderArea | : the RenderArea that will process the event |
sender | : the connection that sent the event |
x | : horizontal coordinate |
y | : vertical coordinate |
key | : released key |
|
virtual |
Triggered when a MouseDoubleClick event is received from the client.
Default behavior : Accept the event by returning true.
renderArea | : the RenderArea that will process the event |
sender | : the connection that sent the event |
x | : horizontal coordinate |
y | : vertical coordinate |
button | : The button that was pressed when the mouse event was fired. |
|
virtual |
Triggered when a MouseDown event is received from the client.
Default behavior : Accept the event by returning true.
renderArea | : the RenderArea that will process the event |
sender | : the connection that sent the event |
x | : horizontal coordinate |
y | : vertical coordinate |
button | : The button that was pressed when the mouse event was fired. |
|
virtual |
Triggered when a MouseEnter event is received from the client.
Default behavior : Accept the event by returning true.
renderArea | : the RenderArea that will process the event |
sender | : the connection that sent the event |
x | : horizontal coordinate |
y | : vertical coordinate |
|
virtual |
Triggered when a MouseLeave event is received from the client.
Default behavior : Accept the event by returning true.
renderArea | : the RenderArea that will process the event |
sender | : the connection that sent the event |
x | : horizontal coordinate |
y | : vertical coordinate |
|
virtual |
Triggered when a MouseMove event is received from the client.
Default behavior : Accept the event by returning true.
renderArea | : the RenderArea that will process the event |
sender | : the connection that sent the event |
x | : horizontal coordinate |
y | : vertical coordinate |
|
virtual |
Triggered when a MouseUp event is received from the client.
Default behavior : Accept the event by returning true.
renderArea | : the RenderArea that will process the event |
sender | : the connection that sent the event |
x | : horizontal coordinate |
y | : vertical coordinate |
button | : The button that was pressed when the mouse event was fired. |
|
virtual |
Triggered when a mouse wheel event (rotatation) is received from the client.
Default behavior : Accept the event by returning true.
renderArea | : the RenderArea that will process the event |
sender | : the connection that sent the event |
x | : horizontal coordinate |
y | : vertical coordinate |
delta | : abstract value which indicates how far the wheel turned |
|
virtual |
Triggered when a client connects to the RenderArea.
Use this method to set the encoding format for images sent to the client, using the frameEncoders parameter. The default is JPEG for interactive frames (i.e. while the user is interacting) and PNG for still frames. Video encoding (H264 or VP9) may provide better performance by reducing bandwidth requirements. Use the ConnectionSettings::isSupportedEncoders() method to query if the proposed encoders are available. If a requested frame encoder cannot be initialized, RenderAreaListener::onRefusedEncoder will be triggered. Otherwise, RenderAreaListener::onInitializedConnection will be triggered.
renderArea | : the RenderArea requested by the connection |
connection | : the Connection |
frameEncoders | : frame encoders for interactive and still frames Supported pairs of frame encoders (still/interactive): JPEG/JPEG, PNG/JPEG, H264_NVENC/H264_NVENC, H264_OPENH264/H264_OPENH264, VP9_VPX/VP9_VPX Default behavior: PNG/JPEG. |
|
virtual |
Triggered after a rendering is done.
Default behavior : Do nothing.
In the ServiceSettings::INDEPENDENT_SERVICE mode, this callback is never triggered.
renderArea | : the RenderArea that performed the rendering. |
|
virtual |
Triggered before a rendering is done.
Default behavior : Do the rendering by returning true.
In the ServiceSettings::INDEPENDENT_SERVICE mode, this callback is never triggered.
renderArea | : the RenderArea that will perform the rendering. |
clearWindow | : if true, this clears the graphics window before rendering |
clearZbuffer | : if true, the z buffer will be cleared before rendering |
|
virtual |
Triggered when a text message is received from a client.
Default behavior : do nothing
renderArea | : the RenderArea requested by the connection |
sender | : the Connection that receives the text message |
message | : the received message sent by the client |
|
virtual |
Triggered when a binary message is received from a client.
Default behavior : do nothing
renderArea | : the RenderArea |
sender | : the Connection that receives the binary message |
buffer | : the received binary buffer sent by the client |
|
virtual |
Triggered when a frame encoder cannot be initialized.
If this case occurs, set another frame encoder. The status of encoders explains the reason for refusal.
Default behavior: Try to load other encoders automatically (fallback): H264_NVENC/H264_NVENC => VP9_VPX/VP9_VPX => H264_OPENH264/H264_OPENH264 => PNG/JPEG => JPEG/JPEG Fallback directly to JPEG/JPEG if the pair of frame encoders are incompatible. If none of frame encoders can be initialized, the connection will be closed.
renderArea | : the RenderArea of the Connection |
sender | : the connection that requests frame encoders |
encoders | : frame encoders refused by the connection |
|
virtual |
Triggered when a new frame is requested by a connection.
This method only works when the ServiceSettings::INDEPENDENT_SERVICE mode is enabled.
To send a new frame to the client, set the pixel buffer of the raster image using a buffer object. If the buffer object of the raster image is NULL, no frame will be sent to the client. IMPORTANT: This callback is executed in a separate thread for each connection requesting a frame.
renderArea | : the RenderArea of the Connection |
sender | : the connection that requests a new frame |
rasterImage | : contains the RGB raster image to render. |
isInteractive | : This value can be modified to indicate if an user interaction is in progress. Default value is true. If true (interactive frame), the frame will be compressed with the interactive frame encoder and a quality adapted to the bandwidth setting. If false (still frame), the frame will be compressed with the still frame encoder and the best available quality. |
|
virtual |
Triggered when a client requests a new renderArea size.
To resize the renderArea, call the method RenderArea::resize.
Default behavior : Resize the renderArea to the requested size.
renderArea | : the RenderArea of the Connection |
sender | : the connection that made the size request |
width | : requested width |
height | : requested height |
|
virtual |
Triggered when the renderArea is resized.
See RenderArea::resize(). Default behavior : Do nothing.
renderArea | : the resized RenderArea |
width | : new width of the renderArea |
height | : new height of the renderArea |
|
virtual |
Triggered before sending a frame to the client.
The sending frame can be retrieved using Connection::getLastEncodedFrame. IMPORTANT: This callback is executed in a separate thread for each connection sending a frame.
renderArea | : the RenderArea of the Connection |
sender | : the connection that will send the frame to the client |
message | : This value can be modified to attach a text message to the frame. Default value is an empty string. This message can be retrieved from the client listeners: onReceivedFrame and onDecodedFrame. |
|
virtual |
Triggered when a TouchEnd event is received from the client.
Default behavior : Accept the event by returning true.
renderArea | : the RenderArea that will process the event |
sender | : the connection that sent the event |
id | : touch identifier |
x | : horizontal coordinate |
y | : vertical coordinate |
|
virtual |
Triggered when a TouchMove event is received from the client.
Default behavior : Accept the event by returning true.
renderArea | : the RenderArea that will process the event |
sender | : the connection that sent the event |
id | : touch identifier |
x | : horizontal coordinate |
y | : vertical coordinate |
|
virtual |
Triggered when a TouchStart event is received from the client.
Default behavior : Accept the event by returning true.
renderArea | : the RenderArea that will process the event |
sender | : the connection that sent the event |
id | : touch identifier |
x | : horizontal coordinate |
y | : vertical coordinate |