From d9dc7419b35b7762bc5222cf874ccc39d2d66f43 Mon Sep 17 00:00:00 2001 From: yy1717 <fctom1215@outlook.com> Date: 星期一, 10 八月 2020 18:36:31 +0800 Subject: [PATCH] 坐标 --- lib/src/main/cpp/master/comm_if.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 46 insertions(+), 1 deletions(-) diff --git a/lib/src/main/cpp/master/comm_if.cpp b/lib/src/main/cpp/master/comm_if.cpp index 5ff520f..57cd155 100644 --- a/lib/src/main/cpp/master/comm_if.cpp +++ b/lib/src/main/cpp/master/comm_if.cpp @@ -808,7 +808,7 @@ MakeLine(&road.startLine, &p1, &p2); } - if (itr->HasMember("stop_line")) { + /*if (itr->HasMember("stop_line")) { const Value &a2 = (*itr)["stop_line"]; PointF p1, p2; @@ -824,7 +824,52 @@ } MakeLine(&road.stopLine, &p1, &p2); + }*/ + if (itr->HasMember("crossing") && itr->IsArray()) { + const Value &a2 = (*itr)["crossing"]; + + vector<stop_line_t> crossing; + + for (Value::ConstValueIterator itr2 = a2.Begin(); itr2 != a2.End(); ++itr2) { + stop_line_t temp; + if (!itr2->IsObject()) { + break; + } + if (itr2->HasMember("active")) { + const Value &s = (*itr2)["active"]; + temp.active = s.GetInt(); + } + if (itr2->HasMember("stop_flag")) { + const Value &s = (*itr2)["stop_flag"]; + temp.stopFlag = s.GetInt(); + } + if (itr2->HasMember("tts")) { + const Value &s = (*itr2)["tts"]; + temp.tts = s.GetString(); + } + if (itr2->HasMember("line")) { + const Value &s = (*itr2)["line"]; + PointF p1, p2; + int n = 0; + + if (s.IsArray() && s.Size() >= 2) { + for (Value::ConstValueIterator itr3 = s.Begin(); itr3 != s.End(); ++itr3, ++n) { + if (n == 0) { + p1 = mapPoints[(*itr3).GetInt()]; + } else if (n == 1) { + p2 = mapPoints[(*itr3).GetInt()]; + } + } + MakeLine(&temp.line, &p1, &p2); + } + } + + crossing.push_back(temp); + } + + road.stopLine.assign(crossing.begin(), crossing.end()); } + if (itr->HasMember("active")) { const Value &s = (*itr)["active"]; DEBUG("璺彛鍔ㄤ綔 %d", s.GetInt()); -- Gitblit v1.8.0