drawThread
This commit is contained in:
Binary file not shown.
@@ -98,17 +98,19 @@ void getMsgCallback(mqtt::const_message_ptr msg)
|
|||||||
try {
|
try {
|
||||||
// TODO 处理接收到到的位置数据
|
// TODO 处理接收到到的位置数据
|
||||||
auto json = nlohmann::json::parse(payload);
|
auto json = nlohmann::json::parse(payload);
|
||||||
//绘制标况
|
//绘制 接收到的坐标 的方框
|
||||||
for(auto & ii :json)
|
thread([json](){
|
||||||
{
|
for(auto & ii :json)
|
||||||
int x = static_cast<int>(ii["x"]);
|
{
|
||||||
int y = static_cast<int>(ii["y"]);
|
int x = static_cast<int>(ii["x"]);
|
||||||
int w = static_cast<int>(ii["w"]);
|
int y = static_cast<int>(ii["y"]);
|
||||||
int h = static_cast<int>(ii["h"]);
|
int w = static_cast<int>(ii["w"]);
|
||||||
double distance = static_cast<double>(ii["distance"]);
|
int h = static_cast<int>(ii["h"]);
|
||||||
drawRect(x,y,w,h,distance);
|
double distance = static_cast<double>(ii["distance"]);
|
||||||
}
|
drawRect(x,y,w,h,distance);
|
||||||
|
}
|
||||||
|
}).detach();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (const nlohmann::json::parse_error &e) {
|
catch (const nlohmann::json::parse_error &e) {
|
||||||
cerr << "JSON 解析错误: " << e.what() << "\n原始 payload: " << payload << "\n";
|
cerr << "JSON 解析错误: " << e.what() << "\n原始 payload: " << payload << "\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user