Class ImageDefaultVisualizer.ImageVisual
The ITextureVisual implementation that subscribes to an image topic, lazily converts raw message data to a Texture2D, and notifies registered texture-change listeners.
Inherited Members
Namespace: Unity.SimulationPro.Foundation.Visualizations
Assembly: Unity.SimulationPro.Foundation.Visualizations.dll
Syntax
public class ImageDefaultVisualizer.ImageVisual : ITextureVisual, IVisual
Constructors
ImageVisual(IConnector, string, ImageDefaultVisualizer)
Creates an ImageDefaultVisualizer.ImageVisual that subscribes to the given topic and uses the factory settings for conversion and display.
Declaration
public ImageVisual(IConnector connector, string topic, ImageDefaultVisualizer factory)
Parameters
| Type | Name | Description |
|---|---|---|
| IConnector | connector | The connector used to subscribe to the topic. |
| string | topic | ROS topic name. |
| ImageDefaultVisualizer | factory | The factory component that supplies debayer, flip, gradient, and brightness settings. |
Properties
IsDrawingEnabled
The is drawing enabled.
Declaration
public bool IsDrawingEnabled { get; }
Property Value
| Type | Description |
|---|---|
| bool |
message
Gets the most recently received image message.
Declaration
public ImageMsg message { get; }
Property Value
| Type | Description |
|---|---|
| ImageMsg |
Methods
AddMessage(IMessage)
Handles an incoming image message, marking cached textures dirty and notifying texture-change listeners.
Declaration
public virtual void AddMessage(IMessage message)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | message | The incoming ImageMsg. |
GetTexture()
Returns the fully converted and cached Texture2D for the most recently received message, rebuilding it if dirty.
Declaration
public Texture2D GetTexture()
Returns
| Type | Description |
|---|---|
| Texture2D | The converted image texture, 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. |