| | |
| | | #define ID_SM_DISTANCE 0x0020 |
| | | #define ID_SM_CARSENSOR 0x0013 |
| | | |
| | | #define ID_MS_ROAD_BRIEF 0x0015 // 科目三项目标定,进出某条路的提示 |
| | | #define ID_MS_CROSSING_BRIEF 0x0016 // 科目三项目标定,接近/驶离某各路口的提示 |
| | | |
| | | #define MA_OUT_GPS_BRIEF 0x0001 |
| | | #define MA_OUT_RTK_BRIEF 0x0002 |
| | | #define MA_OUT_CAR_BRIEF 0x0004 |
| | |
| | | writer.EndObject(); |
| | | |
| | | SendMsgToMainProcIndep(ID_SM_DISTANCE, sb.GetString()); |
| | | } |
| | | |
| | | void MA_SendRoadStatus(const struct roadStatusBrief *brief) |
| | | { |
| | | StringBuffer sb; |
| | | Writer<StringBuffer> writer(sb); |
| | | |
| | | writer.StartObject(); |
| | | writer.Key("road_id"); |
| | | writer.Int(brief->road_id); |
| | | writer.Key("status"); |
| | | writer.Int(brief->status); |
| | | writer.EndObject(); |
| | | |
| | | SendMsgToMainProcIndep(ID_MS_ROAD_BRIEF, sb.GetString()); |
| | | } |
| | | |
| | | void MA_SendCrossingStatus(const struct crossingStatusBrief *brief) |
| | | { |
| | | StringBuffer sb; |
| | | Writer<StringBuffer> writer(sb); |
| | | |
| | | writer.StartObject(); |
| | | writer.Key("road_id"); |
| | | writer.Int(brief->road_id); |
| | | writer.Key("crossing_index"); |
| | | writer.Int(brief->crossing_index); |
| | | writer.Key("status"); |
| | | writer.Int(brief->status); |
| | | writer.EndObject(); |
| | | |
| | | SendMsgToMainProcIndep(ID_MS_CROSSING_BRIEF, sb.GetString()); |
| | | } |
| | | |
| | | void MA_SendExamWrong(vector<ExamFault> &ExamFaultList) |
| | |
| | | |
| | | road_exam_map map; |
| | | |
| | | map.roads.clear(); |
| | | map.specialAreas.clear(); |
| | | map.triggerLines.clear(); |
| | | |
| | | if (doc.HasMember("road")) { |
| | | const Value &a = doc["road"]; |
| | | |
| | |
| | | DEBUG("路id %d", s.GetInt()); |
| | | road.id = s.GetInt(); |
| | | } |
| | | if (itr->HasMember("start_line")) { |
| | | const Value &a2 = (*itr)["start_line"]; |
| | | |
| | | PointF p1, p2; |
| | | int n = 0; |
| | | |
| | | for (Value::ConstValueIterator itr2 = a2.Begin(); itr2 != a2.End(); ++itr2, ++n) { |
| | | DEBUG("起始线 %d", (*itr2).GetInt()); |
| | | if (n == 0) { |
| | | p1 = mapPoints[(*itr2).GetInt()]; |
| | | } else if (n == 1) { |
| | | p2 = mapPoints[(*itr2).GetInt()]; |
| | | } |
| | | } |
| | | |
| | | MakeLine(&road.startLine, &p1, &p2); |
| | | } |
| | | if (itr->HasMember("crossing")) { |
| | | const Value &a2 = (*itr)["crossing"]; |
| | | |
| | |
| | | if (!itr2->IsObject()) { |
| | | break; |
| | | } |
| | | if (itr2->HasMember("active")) { |
| | | const Value &s = (*itr2)["active"]; |
| | | temp.active = s.GetInt(); |
| | | DEBUG("路口动作 %d", temp.active); |
| | | } |
| | | if (itr2->HasMember("stop_flag")) { |
| | | const Value &s = (*itr2)["stop_flag"]; |
| | | temp.stopFlag = s.GetInt(); |
| | | DEBUG("路口停车 %d", temp.stopFlag); |
| | | } |
| | | if (itr2->HasMember("tts")) { |
| | | const Value &s = (*itr2)["tts"]; |
| | | temp.tts = s.GetString(); |
| | | DEBUG("路口提示 %s", temp.tts.c_str()); |
| | | } else { |
| | | temp.stopFlag = false; |
| | | } |
| | | if (itr2->HasMember("line")) { |
| | | const Value &s = (*itr2)["line"]; |
| | |
| | | } |
| | | if (itr2->HasMember("center_point")) { |
| | | const Value &s = (*itr2)["center_point"]; |
| | | |
| | | temp.centrePoint = mapPoints[s.GetInt()]; |
| | | temp.centrePointValid = true; |
| | | } else { |
| | | temp.centrePointValid = false; |
| | | } |
| | | crossing.push_back(temp); |
| | | } |
| | |
| | | map.specialAreas.push_back(specialArea); |
| | | } |
| | | } |
| | | if (doc.HasMember("trigger_line")) { |
| | | /*if (doc.HasMember("trigger_line")) { |
| | | const Value &a = doc["trigger_line"]; |
| | | |
| | | for (Value::ConstValueIterator itr = a.Begin(); |
| | |
| | | |
| | | map.triggerLines.push_back(trigger); |
| | | } |
| | | } |
| | | }*/ |
| | | if (doc.HasMember("red_line")) { |
| | | const Value &a = doc["red_line"]; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | vector<scheme_t> schemes; |
| | | |
| | | if (doc.HasMember("scheme")) { |
| | | const Value &a = doc["scheme"]; |
| | | |
| | | for (Value::ConstValueIterator itr = a.Begin(); |
| | | itr != a.End(); ++itr) { |
| | | scheme_t scheme; |
| | | if (itr->HasMember("name")) { |
| | | const Value &s = (*itr)["name"]; |
| | | scheme.name = s.GetString(); |
| | | } |
| | | if (itr->HasMember("crossing_active")) { |
| | | const Value &a2 = (*itr)["crossing_active"]; |
| | | |
| | | for (Value::ConstValueIterator itr2 = a2.Begin(); |
| | | itr2 != a2.End(); ++itr2) { |
| | | crossing_active_t act; |
| | | |
| | | if (itr2->HasMember("road")) { |
| | | const Value &s = (*itr2)["road"]; |
| | | act.road_id = s.GetInt(); |
| | | } |
| | | if (itr2->HasMember("idx")) { |
| | | const Value &s = (*itr2)["idx"]; |
| | | act.index = s.GetInt(); |
| | | } |
| | | if (itr2->HasMember("active")) { |
| | | const Value &s = (*itr2)["active"]; |
| | | act.active = s.GetInt(); |
| | | } |
| | | |
| | | scheme.crossingActive.push_back(act); |
| | | } |
| | | } |
| | | if (itr->HasMember("trigger_line")) { |
| | | const Value &a2 = (*itr)["trigger_line"]; |
| | | |
| | | for (Value::ConstValueIterator itr2 = a2.Begin(); |
| | | itr2 != a2.End(); ++itr2) { |
| | | trigger_line_t ins; |
| | | |
| | | if (itr2->HasMember("x_y")) { |
| | | const Value &a3 = (*itr2)["x_y"]; |
| | | if (a3.IsArray()) { |
| | | PointF point; |
| | | int n = 0; |
| | | for (Value::ConstValueIterator itr3 = a3.Begin(); |
| | | itr3 != a3.End(); ++itr3) { |
| | | if (n == 0) { |
| | | point.X = (*itr3).GetDouble(); |
| | | n = 1; |
| | | } else if (n == 1) { |
| | | point.Y = (*itr3).GetDouble(); |
| | | ins.points.push_back(point); |
| | | n = 0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (itr2->HasMember("road")) { |
| | | const Value &s = (*itr2)["road"]; |
| | | ins.road = s.GetInt(); |
| | | } |
| | | if (itr2->HasMember("type")) { |
| | | const Value &s = (*itr2)["type"]; |
| | | ins.active = s.GetInt(); |
| | | } |
| | | |
| | | scheme.triggerLines.push_back(ins); |
| | | } |
| | | } |
| | | schemes.push_back(scheme); |
| | | } |
| | | } |
| | | |
| | | DEBUG("地图解析完毕"); |
| | | |
| | | CleanRoadMap(); |
| | | SetRoadMap(map); |
| | | SetRoadMap(map, schemes); |
| | | } else { |
| | | DEBUG("############## 地图解析出错###################"); |
| | | } |