存到json
This commit is contained in:
+16
-7
@@ -346,12 +346,14 @@ void Config::setVirtualMargin(QMap<int, Config::_latlng> mvs,int type)
|
||||
{
|
||||
QJsonObject obj = getJsonObject("VirtualMargin");//总
|
||||
|
||||
QJsonArray notice_obj = obj.value("orange").toArray();
|
||||
QJsonArray warning_obj = obj.value("red").toArray();
|
||||
QJsonArray notice_obj;
|
||||
QJsonArray warning_obj;
|
||||
|
||||
|
||||
if(type == 0)//红
|
||||
{
|
||||
notice_obj = obj.value("orange").toArray();
|
||||
|
||||
foreach (Config::_latlng latlng, mvs) {
|
||||
|
||||
QJsonObject v;
|
||||
@@ -359,16 +361,23 @@ void Config::setVirtualMargin(QMap<int, Config::_latlng> mvs,int type)
|
||||
v["index"] = latlng.index;
|
||||
v["latitude"] = latlng.latitude;
|
||||
v["longitude"] = latlng.longitude;
|
||||
|
||||
warning_obj.append(v);
|
||||
}
|
||||
}
|
||||
else if(type == 1)//黄
|
||||
{
|
||||
foreach (QJsonValue v, notice_obj) {
|
||||
Config::_latlng latlng;
|
||||
warning_obj = obj.value("red").toArray();
|
||||
|
||||
latlng.index = v.toObject().value("index").toInt();
|
||||
latlng.latitude = v.toObject().value("latitude").toDouble();
|
||||
latlng.longitude = v.toObject().value("longitude").toDouble();
|
||||
foreach (Config::_latlng latlng, mvs) {
|
||||
|
||||
QJsonObject v;
|
||||
|
||||
v["index"] = latlng.index;
|
||||
v["latitude"] = latlng.latitude;
|
||||
v["longitude"] = latlng.longitude;
|
||||
|
||||
notice_obj.append(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user