Class DrawingVisualizer<T>
Abstract base class for visualizers that render incoming ROS messages as 3D geometry using a Drawing3d canvas.
Inheritance
Inherited Members
Namespace: Unity.SimulationPro.Foundation.Visualizations
Assembly: Unity.SimulationPro.Foundation.Visualizations.dll
Syntax
public abstract class DrawingVisualizer<T> : BaseVisualFactory<T>, IVisualFactory, IPriority where T : IMessage
Type Parameters
| Name | Description |
|---|---|
| T | The ROS message type this visualizer subscribes to. |
Properties
CanShowDrawing
Gets a value indicating whether this factory produces visuals that support 3D drawing output.
Declaration
public override bool CanShowDrawing { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
Methods
CreateGUI(T, MessageMetadata)
Returns an Action that renders the 2D GUI for the given message. By default displays a string representation of the message.
Declaration
public virtual Action CreateGUI(T message, MessageMetadata meta)
Parameters
| Type | Name | Description |
|---|---|---|
| T | message | The message data to visualize. |
| MessageMetadata | meta | Contextual metadata about the message. |
Returns
| Type | Description |
|---|---|
| Action | A GUI rendering action. |
CreateVisual(string)
Creates a new IVisual instance for the given topic. Called the first time a topic is encountered.
Declaration
protected override IVisual CreateVisual(string topic)
Parameters
| Type | Name | Description |
|---|---|---|
| string | topic | ROS topic name. |
Returns
| Type | Description |
|---|---|
| IVisual | A new IVisual for the topic. |
Overrides
Draw(Drawing3d, T, MessageMetadata)
Override this method to render message data into the provided Drawing3d canvas.
Declaration
public virtual void Draw(Drawing3d drawing, T message, MessageMetadata meta)
Parameters
| Type | Name | Description |
|---|---|---|
| Drawing3d | drawing | The 3D drawing canvas. |
| T | message | The message data to visualize. |
| MessageMetadata | meta | Contextual metadata about the message. |
Draw(DrawingVisual, T, MessageMetadata)
Called to render a message into the DrawingVisualizer<T>.DrawingVisual. Delegates to Draw(Drawing3d, T, MessageMetadata) by default.
Declaration
public virtual void Draw(DrawingVisualizer<T>.DrawingVisual drawing, T message, MessageMetadata meta)
Parameters
| Type | Name | Description |
|---|---|---|
| DrawingVisualizer<T>.DrawingVisual | drawing | The drawing visual providing the Drawing3d canvas. |
| T | message | The message data to visualize. |
| MessageMetadata | meta | Contextual metadata about the message. |
SelectColor(Color, MessageMetadata)
Returns userColor if it is non-zero and non-transparent; otherwise returns a color derived from the topic name.
Declaration
public Color SelectColor(Color userColor, MessageMetadata meta)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | userColor | The user-configured color. |
| MessageMetadata | meta | Metadata providing the topic name used for automatic color selection. |
Returns
| Type | Description |
|---|---|
| Color | The resolved color. |
SelectLabel(string, MessageMetadata)
Returns userLabel if non-empty; otherwise returns the topic name from meta.
Declaration
public string SelectLabel(string userLabel, MessageMetadata meta)
Parameters
| Type | Name | Description |
|---|---|---|
| string | userLabel | The user-configured label. |
| MessageMetadata | meta | Metadata providing the topic name used as the fallback label. |
Returns
| Type | Description |
|---|---|
| string | The resolved label string. |