You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
643 B
23 lines
643 B
#include "UIcommon.h"
|
|
std::vector<AgentState> ConvertToVec(QJsonArray arr)
|
|
{
|
|
std::vector<AgentState> states;
|
|
// 遍历二维数组的每一行
|
|
for (int i = 0; i < arr.size(); ++i) {
|
|
|
|
QJsonValue row_value = arr.at(i);
|
|
// 检查该值是否为数组类型(确保是二维数组结构)
|
|
if (!row_value.isArray()) {
|
|
qDebug() << "convert array error";
|
|
return states;
|
|
}
|
|
QJsonArray row_arr = row_value.toArray();
|
|
AgentState state(row_arr[0].toDouble(), row_arr[1].toDouble(), row_arr[2].toDouble());
|
|
states.push_back(state);
|
|
}
|
|
return states;
|
|
}
|
|
|
|
|
|
|