Class DrawingVisualizer<T>.DrawingVisual
Subscribes to a topic and delegates drawing and GUI to the parent DrawingVisualizer<T>.
Implements
Inherited Members
Namespace: Unity.SimulationPro.Foundation.Visualizations
Assembly: Unity.SimulationPro.Foundation.Visualizations.dll
Syntax
public class DrawingVisualizer<T>.DrawingVisual : IVisual
Constructors
DrawingVisual(IConnector, string, DrawingVisualizer<T>)
Creates a new DrawingVisualizer<T>.DrawingVisual and subscribes to the specified topic.
Declaration
public DrawingVisual(IConnector connector, string topic, DrawingVisualizer<T> factory)
Parameters
| Type | Name | Description |
|---|---|---|
| IConnector | connector | The connector to subscribe on. |
| string | topic | ROS topic name. |
| DrawingVisualizer<T> | factory | The parent factory used for drawing and GUI creation. |
Properties
Drawing
Gets the Drawing3d canvas used by this visual, or null if no drawing has been created yet.
Declaration
public Drawing3d Drawing { get; }
Property Value
| Type | Description |
|---|---|
| Drawing3d |
IsDrawingEnabled
Gets a value indicating whether 3D drawing is currently enabled for this visual.
Declaration
public bool IsDrawingEnabled { get; }
Property Value
| Type | Description |
|---|---|
| bool |
hasDrawing
Gets a value indicating whether a Drawing3d canvas has been allocated for this visual.
Declaration
public bool hasDrawing { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
AddMessage(IMessage)
Processes an incoming message, updating the stored state and triggering a redraw if drawing is enabled and the frame has advanced.
Declaration
public virtual void AddMessage(IMessage message)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | message | The message data to visualize. |
DeleteDrawing()
Destroys the underlying Drawing3d object and sets it to null.
Declaration
public void DeleteDrawing()
OnGUI()
Renders the 2D GUI panel for this visual using the most recently received message.
Declaration
public void OnGUI()
Redraw()
Redraws the 3D visualization using the most recently received message.
Declaration
public void Redraw()
SetDrawingEnabled(bool)
Enables or disables 3D drawing for this visual. When disabled, any existing drawing is cleared. When enabled, the last received message is redrawn.
Declaration
public void SetDrawingEnabled(bool enabled)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enabled | Whether drawing should be enabled. |