#include <RemoteViz/Rendering/RenderAreaListener.h>
Public Member Functions | |
virtual | ~RenderAreaListener () |
virtual void | onOpenedConnection (RenderArea *renderArea, Connection *connection, FrameEncoders *frameEncoders) |
virtual void | onInitializedConnection (RenderArea *renderArea, Connection *sender, FrameEncoders *frameEncoders) |
virtual void | onClosedConnection (RenderArea *renderArea, const std::string &connectionId, bool aborted) |
virtual void | onReceivedMessage (RenderArea *renderArea, Connection *sender, const std::string &message) |
virtual bool | onPreRender (RenderArea *renderArea, bool &clearWindow, bool &clearZbuffer) |
virtual void | onPostRender (RenderArea *renderArea) |
virtual void | onResize (RenderArea *renderArea, unsigned int width, unsigned int height) |
virtual void | onRequestedSize (RenderArea *renderArea, Connection *sender, unsigned int width, unsigned int height) |
virtual void | onRefusedEncoder (RenderArea *renderArea, Connection *sender, FrameEncoders *encoders) |
virtual void | onRequestedFrame (RenderArea *renderArea, Connection *sender, SbRasterImage *rasterImage, bool &isInteractive) |
virtual void | onSendingFrame (RenderArea *renderArea, Connection *sender, size_t frameId, size_t dataSize, std::string &message) |
| |
virtual bool | onMouseUp (RenderArea *renderArea, Connection *sender, int x, int y, SoMouseButtonEvent::Button button) |
virtual bool | onMouseDown (RenderArea *renderArea, Connection *sender, int x, int y, SoMouseButtonEvent::Button button) |
virtual bool | onMouseDoubleClick (RenderArea *renderArea, Connection *sender, int x, int y, SoMouseButtonEvent::Button button) |
virtual bool | onMouseMove (RenderArea *renderArea, Connection *sender, int x, int y) |
virtual bool | onMouseEnter (RenderArea *renderArea, Connection *sender, int x, int y) |
virtual bool | onMouseLeave (RenderArea *renderArea, Connection *sender, int x, int y) |
virtual bool | onMouseWheel (RenderArea *renderArea, Connection *sender, int x, int y, int delta) |
virtual bool | onKeyUp (RenderArea *renderArea, Connection *sender, int x, int y, const SoKeyboardEvent::Key &key) |
virtual bool | onKeyDown (RenderArea *renderArea, Connection *sender, int x, int y, const SoKeyboardEvent::Key &key) |
virtual bool | onTouchStart (RenderArea *renderArea, Connection *sender, unsigned int id, int x, int y) |
virtual bool | onTouchMove (RenderArea *renderArea, Connection *sender, unsigned int id, int x, int y) |
virtual bool | onTouchEnd (RenderArea *renderArea, Connection *sender, unsigned int id, int x, int y) |
This virtual class enables managing a RenderArea.
virtual RemoteViz::Rendering::RenderAreaListener::~RenderAreaListener | ( | ) | [virtual] |
Destructor.
virtual void RemoteViz::Rendering::RenderAreaListener::onClosedConnection | ( | RenderArea * | renderArea, | |
const std::string & | connectionId, | |||
bool | aborted | |||
) | [virtual] |
Triggered when a client disconnects.
Default behavior : dispose the renderArea if all the connections are close.
renderArea | : pointer to the RenderArea | |
connectionId | : ID identifying the connection | |
aborted | : true if the network connection was closed unexpectedly by the client or has been lost. |
virtual void RemoteViz::Rendering::RenderAreaListener::onInitializedConnection | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
FrameEncoders * | frameEncoders | |||
) | [virtual] |
Triggered when the connection and the frame encoders are initialized successfully.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection | |
frameEncoders | : frame encoders that have been initialized by the connection |
virtual bool RemoteViz::Rendering::RenderAreaListener::onKeyDown | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
int | x, | |||
int | y, | |||
const SoKeyboardEvent::Key & | key | |||
) | [virtual] |
Triggered when a KeyDown event is received from the client.
Default behavior : accept the event by returning true.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that send the event | |
x | : horizontal coordinate | |
y | : vertical coordinate | |
key | : pressed key |
virtual bool RemoteViz::Rendering::RenderAreaListener::onKeyUp | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
int | x, | |||
int | y, | |||
const SoKeyboardEvent::Key & | key | |||
) | [virtual] |
Triggered when a KeyUp event is received from the client.
Default behavior : accept the event by returning true.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that send the event | |
x | : horizontal coordinate | |
y | : vertical coordinate | |
key | : released key |
virtual bool RemoteViz::Rendering::RenderAreaListener::onMouseDoubleClick | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
int | x, | |||
int | y, | |||
SoMouseButtonEvent::Button | button | |||
) | [virtual] |
Triggered when a MouseDoubleClick event is received from the client.
Default behavior : accept the event by returning true.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that send the event | |
x | : horizontal coordinate | |
y | : vertical coordinate | |
button | : The button that was pressed when the mouse event was fired. |
virtual bool RemoteViz::Rendering::RenderAreaListener::onMouseDown | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
int | x, | |||
int | y, | |||
SoMouseButtonEvent::Button | button | |||
) | [virtual] |
Triggered when a MouseDown event is received from the client.
Default behavior : accept the event by returning true.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that send the event | |
x | : horizontal coordinate | |
y | : vertical coordinate | |
button | : The button that was pressed when the mouse event was fired. |
virtual bool RemoteViz::Rendering::RenderAreaListener::onMouseEnter | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
int | x, | |||
int | y | |||
) | [virtual] |
Triggered when a MouseEnter event is received from the client.
Default behavior : accept the event by returning true.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that send the event | |
x | : horizontal coordinate | |
y | : vertical coordinate |
virtual bool RemoteViz::Rendering::RenderAreaListener::onMouseLeave | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
int | x, | |||
int | y | |||
) | [virtual] |
Triggered when a MouseLeave event is received from the client.
Default behavior : accept the event by returning true.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that send the event | |
x | : horizontal coordinate | |
y | : vertical coordinate |
virtual bool RemoteViz::Rendering::RenderAreaListener::onMouseMove | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
int | x, | |||
int | y | |||
) | [virtual] |
Triggered when a MouseMove event is received from the client.
Default behavior : accept the event by returning true.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that send the event | |
x | : horizontal coordinate | |
y | : vertical coordinate |
virtual bool RemoteViz::Rendering::RenderAreaListener::onMouseUp | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
int | x, | |||
int | y, | |||
SoMouseButtonEvent::Button | button | |||
) | [virtual] |
Triggered when a MouseUp event is received from the client.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that send the event | |
x | : horizontal coordinate | |
y | : vertical coordinate | |
button | : The button that was pressed when the mouse event was fired. |
virtual bool RemoteViz::Rendering::RenderAreaListener::onMouseWheel | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
int | x, | |||
int | y, | |||
int | delta | |||
) | [virtual] |
Triggered when client wheel button is rotated.
Default behavior : accept the event by returning true.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that send the event | |
x | : horizontal coordinate | |
y | : vertical coordinate | |
delta | : abstract value which indicates how far the wheel turned |
virtual void RemoteViz::Rendering::RenderAreaListener::onOpenedConnection | ( | RenderArea * | renderArea, | |
Connection * | connection, | |||
FrameEncoders * | frameEncoders | |||
) | [virtual] |
Triggered when a client connects.
If a frame encoder cannot be initialized, RenderAreaListener::onRefusedEncoder will be triggered. Otherwise, RenderAreaListener::onInitializedConnection will be triggered.
renderArea | : pointer to the RenderArea | |
connection | : pointer to the Connection | |
frameEncoders | : frame encoders for interactive and still frames Supported couple of frame encoders (still/interactive): JPEG/JPEG, PNG/JPEG, H264_NVENC/H264_NVENC, H264_OPENH264/H264_OPENH264 Default behavior: PNG/JPEG. |
virtual void RemoteViz::Rendering::RenderAreaListener::onPostRender | ( | RenderArea * | renderArea | ) | [virtual] |
Triggered when a rendering is done.
Default behavior : do nothing
In the ServiceSettings::INDEPENDENT_SERVICE mode, this callback is never triggered.
renderArea | : pointer to the RenderArea |
virtual bool RemoteViz::Rendering::RenderAreaListener::onPreRender | ( | RenderArea * | renderArea, | |
bool & | clearWindow, | |||
bool & | clearZbuffer | |||
) | [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 | : pointer to the RenderArea | |
clearWindow | : if true, this clears the graphics window before rendering | |
clearZbuffer | : if true, the z buffer will be cleared before rendering |
virtual void RemoteViz::Rendering::RenderAreaListener::onReceivedMessage | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
const std::string & | message | |||
) | [virtual] |
Triggered when a message is received from a client.
Default behavior : do nothing
renderArea | : pointer to the RenderArea | |
message | : the message sent by the client | |
sender | : pointer to the Connection |
virtual void RemoteViz::Rendering::RenderAreaListener::onRefusedEncoder | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
FrameEncoders * | encoders | |||
) | [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 others encoders automatically (fallback): H264_NVENC/H264_NVENC => H264_OPENH264/H264_OPENH264 => PNG/JPEG => JPEG/JPEG
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that requests a frame encoder | |
encoders | : frame encoders refused by the connection |
virtual void RemoteViz::Rendering::RenderAreaListener::onRequestedFrame | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
SbRasterImage * | rasterImage, | |||
bool & | isInteractive | |||
) | [virtual] |
Triggered when a new frame is requested by a connection.
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. This method only works when the ServiceSettings::INDEPENDENT_SERVICE mode is enabled.
IMPORTANT: This callback is executed in a separate thread for each connection requesting a frame.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that send the event | |
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 void RemoteViz::Rendering::RenderAreaListener::onRequestedSize | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
unsigned int | width, | |||
unsigned int | height | |||
) | [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 | : pointer to the RenderArea | |
sender | : pointer to the connection that made the size request | |
width | : requested width | |
height | : requested height |
virtual void RemoteViz::Rendering::RenderAreaListener::onResize | ( | RenderArea * | renderArea, | |
unsigned int | width, | |||
unsigned int | height | |||
) | [virtual] |
Triggered when the renderArea is resized.
Default behavior : do nothing
renderArea | : pointer to the RenderArea | |
width | : new width of the renderArea | |
height | : new height of the renderArea |
virtual void RemoteViz::Rendering::RenderAreaListener::onSendingFrame | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
size_t | frameId, | |||
size_t | dataSize, | |||
std::string & | message | |||
) | [virtual] |
Triggered before sending a frame to the client.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that send the event | |
frameId | : unique frame ID. | |
dataSize | : data size of the frame. | |
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 bool RemoteViz::Rendering::RenderAreaListener::onTouchEnd | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
unsigned int | id, | |||
int | x, | |||
int | y | |||
) | [virtual] |
Triggered when a TouchEnd event is received from the client.
Default behavior : accept the event by returning true.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that send the event | |
id | : touch identifier | |
x | : horizontal coordinate | |
y | : vertical coordinate |
virtual bool RemoteViz::Rendering::RenderAreaListener::onTouchMove | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
unsigned int | id, | |||
int | x, | |||
int | y | |||
) | [virtual] |
Triggered when a TouchMove event is received from the client.
Default behavior : accept the event by returning true.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that send the event | |
id | : touch identifier | |
x | : horizontal coordinate | |
y | : vertical coordinate |
virtual bool RemoteViz::Rendering::RenderAreaListener::onTouchStart | ( | RenderArea * | renderArea, | |
Connection * | sender, | |||
unsigned int | id, | |||
int | x, | |||
int | y | |||
) | [virtual] |
Triggered when a TouchStart event is received from the client.
Default behavior : accept the event by returning true.
renderArea | : pointer to the RenderArea | |
sender | : pointer to the connection that send the event | |
id | : touch identifier | |
x | : horizontal coordinate | |
y | : vertical coordinate |