drawThread

This commit is contained in:
2025-11-17 16:29:08 +08:00
parent 462fa65d95
commit dcecf87fd0
2 changed files with 13 additions and 11 deletions

Binary file not shown.

View File

@@ -98,16 +98,18 @@ void getMsgCallback(mqtt::const_message_ptr msg)
try {
// TODO 处理接收到到的位置数据
auto json = nlohmann::json::parse(payload);
//绘制标况
for(auto & ii :json)
{
int x = static_cast<int>(ii["x"]);
int y = static_cast<int>(ii["y"]);
int w = static_cast<int>(ii["w"]);
int h = static_cast<int>(ii["h"]);
double distance = static_cast<double>(ii["distance"]);
drawRect(x,y,w,h,distance);
}
//绘制 接收到的坐标 的方框
thread([json](){
for(auto & ii :json)
{
int x = static_cast<int>(ii["x"]);
int y = static_cast<int>(ii["y"]);
int w = static_cast<int>(ii["w"]);
int h = static_cast<int>(ii["h"]);
double distance = static_cast<double>(ii["distance"]);
drawRect(x,y,w,h,distance);
}
}).detach();
}
catch (const nlohmann::json::parse_error &e) {