public class RenderArea extends Inventor
RenderAreaListener
to receive RenderArea
events.
When using ServiceSettings.INVENTOR_SERVICE
or ServiceSettings.INVENTOR_APPLICATION
service mode, this class provides access to the scene manager and the touch manager to modify the rendering.
A RenderArea
object may be created automatically by RemoteViz or created explicitly by the application. When a client requests a connection (see RemoteVizRenderArea.connectTo()), it specifies a render area id. If a render area with that id does not exist, RemoteViz will create one and ServiceListener.onPendingCreateRenderArea() will be called. If a render area with the requested id exists, RemoteViz will use that one and ServiceListener.onPendingShareRenderArea()
will be called. An application might want to explicitly create a render area, for example, to preload a default scene graph.
A RenderArea
may have zero, one or multiple connections.
A RenderArea
allows the application to send text or binary messages to the associated client. A JavaScript client will receive the message using a listener (see RemoteVizRenderArea.addServiceListener). Messages from a client are received using one of the RenderAreaListener.onReceivedMessage()
methods.
Inventor.ConstructorCommand
VERBOSE_LEVEL, ZeroHandle
Modifier and Type | Method and Description |
---|---|
void |
addListener(RenderAreaListener listener)
Adds a
RenderAreaListener to manage the renderArea. |
void |
closeConnectionsAndDispose()
Closes all connections of the renderArea and disposes it.
|
Connection |
getConnection(int index)
Gets an existing
Connection to the renderArea. |
Connection |
getConnection(java.lang.String id)
Gets an existing
Connection to the renderArea. |
SoGLContext |
getGLContext()
Gets the OpenGL context associated with the renderArea.
|
java.lang.String |
getGpu()
Gets the Graphics Processing Unit (GPU) used to render images.
|
int |
getHeight()
Gets the renderArea height.
|
java.lang.String |
getId()
Gets the renderArea id.
|
int |
getNumConnections()
Gets the number of connections (see
Connection ) that exist for this renderArea. |
int |
getNumListeners()
Gets the number of
RenderAreaListener . |
SoSceneManager |
getSceneManager()
Gets the Open Inventor scene manager associated with the renderArea.
|
SoTouchManager |
getTouchManager()
Gets the Open Inventor touch manager associated with the renderArea.
|
int |
getWidth()
Gets the renderArea width.
|
boolean |
isDisposed()
Gets the state of the
RenderArea : alive or disposed. |
void |
removeAllListeners()
Removes all RenderAreaListeners.
|
void |
removeListener(RenderAreaListener listener)
Removes a
RenderAreaListener . |
void |
resize(int width,
int height)
Resizes the renderArea at a specific size.
|
boolean |
sendMessage(java.util.Collection<java.lang.Byte> buffer)
Calls sendMessage(buffer, new java.util.ArrayList<>()).
|
boolean |
sendMessage(java.util.Collection<java.lang.Byte> buffer,
java.util.Collection<Connection> excludedConnections)
Sends a binary message to the renderArea connections.
|
boolean |
sendMessage(java.lang.String message)
Calls sendMessage(message, new java.util.ArrayList<>()).
|
boolean |
sendMessage(java.lang.String message,
java.util.Collection<Connection> excludedConnections)
Sends a text message to the renderArea connections.
|
dispose, getNativeResourceHandle
public boolean sendMessage(java.lang.String message)
public boolean sendMessage(java.util.Collection<java.lang.Byte> buffer)
public java.lang.String getGpu()
RenderAreaHardware.setGpu
public Connection getConnection(int index)
Connection
to the renderArea.
index
- : index identifying the Connection
public int getNumListeners()
RenderAreaListener
.
RenderAreaListener
.
public int getNumConnections()
Connection
) that exist for this renderArea.
public int getHeight()
public boolean isDisposed()
RenderArea
: alive or disposed.
RemoteViz does not keep a reference to the RenderArea
object after the object is disposed. If the application kept a reference to the object, this method can be used to query its state.
The state "disposed" will be set just after triggering the listener ServiceListener.onDisposingRenderArea
.
public Connection getConnection(java.lang.String id)
Connection
to the renderArea.
id
- : ID identifying the Connection
public java.lang.String getId()
public void closeConnectionsAndDispose()
ServiceListener.onDisposingRenderArea
and ServiceListener.onDisposedRenderArea
will be triggered and a DISPOSED disconnect message will be sent to all clients of the renderArea. The listener RenderAreaListener.onClosedConnection
will not be triggered after closing connections.
See isDisposed()
.
public boolean sendMessage(java.lang.String message, java.util.Collection<Connection> excludedConnections)
message
- : the message to be sent to all connections of the renderArea
excludedConnections
- : pointer to an excluded connections array
public boolean sendMessage(java.util.Collection<java.lang.Byte> buffer, java.util.Collection<Connection> excludedConnections)
buffer
- : the binary buffer to be sent to all connections of the renderArea
excludedConnections
- : pointer to an excluded connections array
public int getWidth()
public void resize(int width, int height)
width
- : new width of the renderArea
height
- : new height of the renderAreaRenderAreaListener.onResize
public void addListener(RenderAreaListener listener)
RenderAreaListener
to manage the renderArea.
listener
- : shared_ptr pointer to the class that implements RenderAreaListener
public void removeAllListeners()
public SoSceneManager getSceneManager()
In the ServiceSettings.INDEPENDENT_SERVICE
mode, this method returns nullptr.
public SoTouchManager getTouchManager()
In the ServiceSettings.INDEPENDENT_SERVICE
mode, this method returns nullptr.
public SoGLContext getGLContext()
In the ServiceSettings.INDEPENDENT_SERVICE
mode, this method returns nullptr.
SoGLContext
public void removeListener(RenderAreaListener listener)
RenderAreaListener
.
listener
- : shared_ptr pointer to the class that implements RenderAreaListener
Generated on December 23, 2020, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com