14 cfg.background_color = wxColour(0x2A, 0x2A, 0x2A);
15 cfg.grid_color = wxColour(0x3E, 0x3E, 0x3E);
18 cfg.node_color = wxColour(0x4B, 0x4B, 0x4B);
19 cfg.border_color = wxColour(0x78, 0x78, 0x78);
20 cfg.text_color = wxColour(0xB4, 0xB4, 0xB4);
21 cfg.selected_border_color = wxColour(0x30, 0x5C, 0xDE);
22 cfg.hovered_border_color = wxColour(0x90, 0xEE, 0x90);
23 cfg.connection_color = wxColour(0xFF, 0xFF, 0xFF);
25 cfg.action_type_color = wxColour(0x4A, 0x90, 0xD9);
26 cfg.control_type_color = wxColour(0x5C, 0xB8, 0x5C);
27 cfg.condition_type_color = wxColour(0xF0, 0xAD, 0x4E);
28 cfg.decorator_type_color = wxColour(0x9B, 0x59, 0xB6);
29 cfg.behavior_tree_type_color = wxColour(0xD9, 0x53, 0x4F);
31 cfg.highlight_path_to_selected =
true;
32 cfg.path_highlight_color = wxColour(0x90, 0xEE, 0x90);
34 cfg.enable_viewport_culling =
true;
35 cfg.viewport_culling_margin = 1500;
37 cfg.show_navigation_info =
false;
53 int status = statusProvider->GetNodeStatus(
static_cast<int64_t
>(node->
GetId()));
60 return wxColour(std::min(255, base.Red() + 20), std::min(255, base.Green() + 20),
61 std::min(255, base.Blue() + 20));
64 return wxColour(std::min(255, base.Red() + 10), std::min(255, base.Green() + 10),
65 std::min(255, base.Blue() + 10));
71 int64_t nodeId =
static_cast<int64_t
>(node->
GetId());
80 if (statusProvider->IsNodeInExecutionPath(nodeId))
83 int status = statusProvider->GetNodeStatus(nodeId);
94 int status = statusProvider->GetNodeStatus(
static_cast<int64_t
>(node->
GetId()));
102 dc.SetUserScale(1.0, 1.0);
103 dc.SetDeviceOrigin(0, 0);
105 wxSize panelSize = GetSize();
107 int rightX = panelSize.x - 10;
109 wxFont infoFont(9, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
110 dc.SetFont(infoFont);
112 wxString connText =
m_connected ? wxString::Format(
"Connected | Ticks: %d",
m_tickCount) :
"Disconnected";
113 wxColour connColor =
m_connected ? wxColour(100, 200, 100) : wxColour(200, 100, 100);
114 dc.SetTextForeground(connColor);
115 wxSize connExtent = dc.GetTextExtent(connText);
116 dc.DrawText(connText, rightX - connExtent.x, y);
117 y += connExtent.y + 4;
119 dc.SetTextForeground(wxColour(160, 160, 160));
121 wxString zoomText = wxString::Format(
"Zoom: %.0f%% | Pan: (%d, %d)",
GetZoom() * 100, viewOfs.x, viewOfs.y);
123 zoomText +=
" | FOCUS MODE";
124 wxSize zoomExtent = dc.GetTextExtent(zoomText);
125 dc.DrawText(zoomText, rightX - zoomExtent.x, y);
126 y += zoomExtent.y + 4;
130 wxString selText =
"Selected: " + selectedNode->GetName() +
" [" + selectedNode->GetTypeString() +
"]";
133 if (statusProvider) {
134 int status = statusProvider->GetNodeStatus(
static_cast<int64_t
>(selectedNode->GetId()));
135 wxString statusNames[] = {
"Idle",
"Running",
"Success",
"Failure",
"Halted"};
136 if (status >= 0 && status <= 4)
137 selText +=
" | " + statusNames[status];
140 dc.SetTextForeground(wxColour(200, 200, 200));
141 wxSize selExtent = dc.GetTextExtent(selText);
142 dc.DrawText(selText, rightX - selExtent.x, y);
143 y += selExtent.y + 4;
147 if (tree && tree->HasRootNode()) {
148 dc.SetTextForeground(wxColour(130, 130, 130));
149 wxString statsText = wxString::Format(
"Nodes: %lu",
static_cast<unsigned long>(tree->GetNodeCount()));
150 wxSize statsExtent = dc.GetTextExtent(statsText);
151 dc.DrawText(statsText, rightX - statsExtent.x, y);
Abstract interface for tree nodes that can be visualized.
virtual size_t GetId() const =0
float GetZoom() const
Returns the current zoom factor.
TreeCanvas(wxWindow *parent, wxWindowID id=wxID_ANY)
Constructor.
void SetShowMinimap(bool show)
Enables or disables minimap display.
IStatusProvider * GetStatusProvider() const
Returns the status overlay provider.
void SetShowOverlayInfo(bool show)
Enables or disables overlay info display.
void SetShowBreadcrumb(bool show)
Enables or disables breadcrumb display.
EmberCore::ITreeNode * GetSelectedNode() const
Returns the currently selected node.
void SetShowGrid(bool show)
Enables or disables grid display.
TreeCanvasConfig & GetConfig()
Returns mutable configuration.
bool IsInFocusMode() const
Returns whether focus mode is active.
std::shared_ptr< EmberCore::ITreeStructure > GetTree() const
Returns the current tree structure.
wxPoint GetViewOffset() const
Returns the current view offset.
wxColour GetNodeBorderColor(EmberCore::ITreeNode *node, bool selected, bool hovered) override
Returns border color based on node status, selection, and hover.
wxColour GetNodeTextColor(EmberCore::ITreeNode *node, bool selected, bool hovered) override
Returns text color based on node status, selection, and hover.
MonitorTreeCanvas(wxWindow *parent, wxWindowID id=wxID_ANY)
void ApplyBaseConfig()
Applies base visualization configuration (colors, layout, etc.).
void OnBeforePaintOverlays(wxDC &dc) override
Paints connection info overlay before other overlays.
wxColour GetNodeFillColor(EmberCore::ITreeNode *node, bool selected, bool hovered) override
Returns fill color based on node status, selection, and hover.
void SetConnectionInfo(bool connected, int tickCount)
Sets connection state and tick count for the overlay display.
static wxColour GetExecutionPathColor()
Color for nodes in the execution path.
static wxColour GetBorderColor(int status)
Returns border color for the given status code.
static wxColour GetTextColor(int status)
Returns text color for the given status code.
static wxColour GetFillColor(int status)
Returns fill color for the given status code.
wxColour selected_border_color
wxColour hovered_border_color