Class TextureVisualizer<T>.TextureVisual
Subscribes to a topic, caches generated textures, and notifies registered listeners when the texture changes.
Inherited Members
Namespace: Unity.SimulationPro.Foundation.Visualizations
Assembly: Unity.SimulationPro.Foundation.Visualizations.dll
Syntax
public class TextureVisualizer<T>.TextureVisual : ITextureVisual, IVisual
Constructors
TextureVisual(IConnector, string, TextureVisualizer<T>)
Creates a new TextureVisualizer<T>.TextureVisual and subscribes to the specified topic.
Declaration
public TextureVisual(IConnector connector, string topic, TextureVisualizer<T> factory)
Parameters
| Type | Name | Description |
|---|---|---|
| IConnector | connector | The connector to subscribe on. |
| string | topic | ROS topic name. |
| TextureVisualizer<T> | factory | The parent factory used for texture creation and GUI. |
Properties
IsDrawingEnabled
The is drawing enabled.
Declaration
public bool IsDrawingEnabled { get; }
Property Value
| Type | Description |
|---|---|
| bool |
message
Gets the most recently received message, or the default value if no message has arrived yet.
Declaration
public T message { get; }
Property Value
| Type | Description |
|---|---|
| T |
meta
Gets the metadata associated with the most recently received message.
Declaration
public MessageMetadata meta { get; }
Property Value
| Type | Description |
|---|---|
| MessageMetadata |
Methods
AddMessage(IMessage)
Stores the incoming message, clears the cached texture and GUI action, and notifies all registered texture-change listeners.
Declaration
public void AddMessage(IMessage message)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | message | The message data to visualize. |
GetTexture()
Gets the texture generated from the last received message, creating it on first access.
Declaration
public Texture2D GetTexture()
Returns
| Type | Description |
|---|---|
| Texture2D | The texture for the last received message, or |
ListenForTextureChange(Action<Texture2D>)
Registers a callback that is invoked each time a new texture is generated from an incoming message.
Declaration
public void ListenForTextureChange(Action<Texture2D> callback)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<Texture2D> | callback | The action to invoke with the new Texture2D. |
OnGUI()
On GUI.
Declaration
public void OnGUI()
Redraw()
Redraw.
Declaration
public void Redraw()
SetDrawingEnabled(bool)
No-op; this visual renders to a GUI texture and has no 3D drawing.
Declaration
public void SetDrawingEnabled(bool enabled)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enabled | Whether drawing should be enabled. |