| | |
| | | if (!doc.HasParseError()) { |
| | | CleanRoadMap(); |
| | | |
| | | DEBUG("开始解析路考地图"); |
| | | |
| | | vector<double> mapPoints; |
| | | mapPoints.clear(); |
| | | |
| | | if (doc.HasMember("points")) { |
| | | const Value &s = doc["points"]; |
| | | |
| | | DEBUG("得到所有点"); |
| | | // X-Y坐标集合 |
| | | for (Value::ConstValueIterator itr2 = s.Begin(); |
| | | itr2 != s.End(); ++itr2) { |
| | |
| | | const Value &a = doc["maps"]; |
| | | |
| | | for (Value::ConstValueIterator itr = a.Begin(); itr != a.End(); ++itr) { |
| | | |
| | | DEBUG("得到各子地图"); |
| | | if (itr->IsObject()) { |
| | | // a Map |
| | | int id, type; |
| | |
| | | vector<vector<int>> greenLines; |
| | | vector<vector<int>> triggerLines; |
| | | vector<vector<int>> redAreas; |
| | | vector<int> area; |
| | | vector<int> stopLine; |
| | | |
| | | stopLine.clear(); |
| | | area.clear(); |
| | | tts.clear(); |
| | | redLines.clear(); |
| | | greenLines.clear(); |
| | |
| | | } |
| | | } |
| | | |
| | | if (itr->HasMember("trigger_line")) { |
| | | const Value &s = (*itr)["trigger_line"]; |
| | | if (itr->HasMember("all_trigger_line")) { |
| | | const Value &s = (*itr)["all_trigger_line"]; |
| | | |
| | | for (Value::ConstValueIterator itrLine = s.Begin(); |
| | | itrLine != s.End(); ++itrLine) { |
| | |
| | | } |
| | | } |
| | | |
| | | if (itr->HasMember("area")) { |
| | | const Value &s = (*itr)["area"]; |
| | | |
| | | for (Value::ConstValueIterator itrPoint = s.Begin(); |
| | | itrPoint != s.End(); ++itrPoint) { |
| | | area.push_back((*itrPoint).GetInt()); |
| | | } |
| | | } |
| | | |
| | | if (itr->HasMember("stop_line")) { |
| | | const Value &s = (*itr)["stop_line"]; |
| | | |
| | | for (Value::ConstValueIterator itrPoint = s.Begin(); |
| | | itrPoint != s.End(); ++itrPoint) { |
| | | stopLine.push_back((*itrPoint).GetInt()); |
| | | } |
| | | } |
| | | |
| | | if (itr->HasMember("id")) { |
| | | const Value &s = (*itr)["id"]; |
| | | id = s.GetInt(); |
| | |
| | | tts = s.GetString(); |
| | | } |
| | | |
| | | AddRoadMapParent(id, type, tts, redLines, redAreas, greenLines, triggerLines); |
| | | AddRoadMapParent(id, type, tts, redLines, redAreas, greenLines, triggerLines, area, stopLine); |
| | | } |
| | | } |
| | | } |