From 27fc91fbe8f88b6885356e68828cfe1ce1db7601 Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期三, 28 二月 2024 09:53:13 +0800
Subject: [PATCH] 坐标
---
lib/src/main/cpp/master/comm_if.cpp | 822 +++++++---------------------------------------------------
1 files changed, 107 insertions(+), 715 deletions(-)
diff --git a/lib/src/main/cpp/master/comm_if.cpp b/lib/src/main/cpp/master/comm_if.cpp
index 486fa55..1415432 100644
--- a/lib/src/main/cpp/master/comm_if.cpp
+++ b/lib/src/main/cpp/master/comm_if.cpp
@@ -87,7 +87,7 @@
#define MA_OUT_DBG_INFO 0x0010
-static int OnOff = 0;//0xFFFF;
+static int OnOff = 0xFFFF;
struct msg_2_main_t {
int cmd;
@@ -115,6 +115,8 @@
}
lock_guard<mutex> lock(msg_mutex);
+
+// DEBUG("鍔犲叆浼犺緭闃熷垪 0x%04X, 褰撳墠闀垮害 %d", cmd, MessageBuffer.size());
MessageBuffer.push_front(msg);
@@ -164,6 +166,7 @@
{
if (v.IsArray()) {
PointF point;
+
for (int i = 0; i < v.Size();) {
if (v.Size() - i >= 2) {
point.X = v[i].GetDouble();
@@ -359,9 +362,9 @@
writer.Int(brief->horn);
writer.Key("wiper");
writer.Int(brief->wiper);
- writer.Key("hand_break");
+ writer.Key("hand_brake");
writer.Int(brief->handBreak);
- writer.Key("main_break");
+ writer.Key("brake");
writer.Int(brief->mainBreak);
writer.Key("left_turn_lamp");
writer.Int(brief->leftTurnLamp);
@@ -740,686 +743,10 @@
ConfigPlatform(&cfg);
break;
}
- case ID_MS_ROAD_MAP: {
- Document doc;
- doc.Parse(value);
-
- 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) {
- mapPoints.push_back((*itr2).GetDouble());
- }
-
- }
-
- if (doc.HasMember("maps")) {
- const Value &a = doc["maps"];
-
- for (Value::ConstValueIterator itr = a.Begin(); itr != a.End(); ++itr) {
-
- DEBUG("寰楀埌鍚勫瓙鍦板浘");
- if (itr->IsObject()) {
- // a Map
- int id, type;
- int stop_flag = 0;
- string tts;
-
- vector<vector<int>> redLines;
- vector<vector<int>> greenLines;
- vector<vector<int>> triggerLines;
- vector<vector<int>> redAreas;
- vector<vector<int>> roadEdgeLines;
-
- vector<int> area;
- vector<int> stopLine;
-
- roadEdgeLines.clear();
- stopLine.clear();
- area.clear();
- tts.clear();
- redLines.clear();
- greenLines.clear();
- triggerLines.clear();
- redAreas.clear();
-
- vector<int> points;
-
- if (itr->HasMember("red_line")) {
- const Value &s = (*itr)["red_line"];
-
- for (Value::ConstValueIterator itrLine = s.Begin();
- itrLine != s.End(); ++itrLine) {
- points.clear();
- for (Value::ConstValueIterator itrPoint = (*itrLine).Begin();
- itrPoint != (*itrLine).End(); ++itrPoint) {
- points.push_back((*itrPoint).GetInt());
- }
- redLines.push_back(points);
- }
- }
-
- if (itr->HasMember("green_line")) {
- const Value &s = (*itr)["green_line"];
-
- for (Value::ConstValueIterator itrLine = s.Begin();
- itrLine != s.End(); ++itrLine) {
- points.clear();
- for (Value::ConstValueIterator itrPoint = (*itrLine).Begin();
- itrPoint != (*itrLine).End(); ++itrPoint) {
- points.push_back((*itrPoint).GetInt());
- }
- greenLines.push_back(points);
- }
- }
-
- if (itr->HasMember("all_trigger_line")) {
- const Value &s = (*itr)["all_trigger_line"];
-
- for (Value::ConstValueIterator itrLine = s.Begin();
- itrLine != s.End(); ++itrLine) {
- points.clear();
- for (Value::ConstValueIterator itrPoint = (*itrLine).Begin();
- itrPoint != (*itrLine).End(); ++itrPoint) {
- points.push_back((*itrPoint).GetInt());
- }
- triggerLines.push_back(points);
- }
- }
-
- if (itr->HasMember("red_area")) {
- const Value &s = (*itr)["red_area"];
-
- for (Value::ConstValueIterator itrLine = s.Begin();
- itrLine != s.End(); ++itrLine) {
- points.clear();
- for (Value::ConstValueIterator itrPoint = (*itrLine).Begin();
- itrPoint != (*itrLine).End(); ++itrPoint) {
- points.push_back((*itrPoint).GetInt());
- }
- redAreas.push_back(points);
- }
- }
-
- if (itr->HasMember("road_edge_line")) {
- const Value &s = (*itr)["road_edge_line"];
-
- for (Value::ConstValueIterator itrLine = s.Begin();
- itrLine != s.End(); ++itrLine) {
- points.clear();
- for (Value::ConstValueIterator itrPoint = (*itrLine).Begin();
- itrPoint != (*itrLine).End(); ++itrPoint) {
- points.push_back((*itrPoint).GetInt());
- }
- roadEdgeLines.push_back(points);
- }
- }
-
- 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();
- }
-
- if (itr->HasMember("item")) {
- const Value &s = (*itr)["item"];
- type = s.GetInt();
- }
-
- if (itr->HasMember("stop_flag")) {
- const Value &s = (*itr)["stop_flag"];
- stop_flag = s.GetInt();
- }
-
- if (itr->HasMember("tts")) {
- const Value &s = (*itr)["tts"];
- tts = s.GetString();
- }
-
- }
- }
- }
- } else {
- DEBUG("############## 鍦板浘瑙f瀽鍑洪敊###################");
- }
- break;
- }
- case ID_MS_ROAD_MAP2: {
- Document doc;
- doc.Parse(value);
- if (!doc.HasParseError()) {
- DEBUG("寮�濮嬭В鏋愯矾鑰冨湴鍥�");
-
- vector<PointF> mapPoints;
- mapPoints.clear();
-
- if (doc.HasMember("points")) {
- const Value &s = doc["points"];
-
- DEBUG("寰楀埌鎵�鏈夌偣 鍏� %d", s.Size()/2);
-
- int n = 0;
- PointF temp;
-
- // X-Y鍧愭爣闆嗗悎
- for (Value::ConstValueIterator itr = s.Begin();
- itr != s.End(); ++itr, ++n) {
- if ((n % 2) == 0) {
- temp.X = (*itr).GetDouble();
- } else {
- temp.Y = (*itr).GetDouble();
- mapPoints.push_back(temp);
- }
- }
- }
-
- road_exam_map map;
-
- if (doc.HasMember("road")) {
- const Value &a = doc["road"];
-
- if (a.IsArray()) {
- for (Value::ConstValueIterator itr = a.Begin(); itr != a.End(); ++itr) {
- road_t road;
-
- if (itr->HasMember("id")) {
- const Value &s = (*itr)["id"];
- DEBUG("璺痠d %d", s.GetInt());
- road.id = s.GetInt();
- }
- if (itr->HasMember("crossing")) {
- 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("stop_flag")) {
- const Value &s = (*itr2)["stop_flag"];
- temp.stopFlag = s.GetInt();
- DEBUG("璺彛鍋滆溅 %d", temp.stopFlag);
- } else {
- temp.stopFlag = false;
- }
- 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);
- }
- }
- 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);
- }
-
- road.stopLine.assign(crossing.begin(), crossing.end());
- }
-
- if (itr->HasMember("next_road")) {
- const Value &s = (*itr)["next_road"];
- road.targetRoad = s.GetInt();
- }
- if (itr->HasMember("left_edge")) {
- const Value &a2 = (*itr)["left_edge"];
- DEBUG("宸﹁竟绾�");
-
- if (a2.IsArray()) {
- for (Value::ConstValueIterator itr2 = a2.Begin(); itr2 != a2.End(); ++itr2) {
- edge_t edge;
-
- if (itr2->HasMember("type")) {
- const Value &s = (*itr2)["type"];
- DEBUG("\t绫诲瀷 %d", s.GetInt());
-
- edge.character = s.GetInt();
- }
- if (itr2->HasMember("line")) {
- const Value &a3 = (*itr2)["line"];
- if (a3.IsArray()) {
- for (Value::ConstValueIterator itr3 = a3.Begin(); itr3 != a3.End(); ++itr3) {
- DEBUG("\t绾跨偣 %d", (*itr3).GetInt());
- edge.points.push_back(mapPoints[(*itr3).GetInt()]);
- }
- }
- }
-
- road.leftEdge.push_back(edge);
- }
- }
- }
- if (itr->HasMember("right_edge")) {
- const Value &a2 = (*itr)["right_edge"];
- DEBUG("鍙宠竟绾�");
- if (a2.IsArray()) {
- for (Value::ConstValueIterator itr2 = a2.Begin(); itr2 != a2.End(); ++itr2) {
- edge_t edge;
-
- if (itr2->HasMember("type")) {
- const Value &s = (*itr2)["type"];
- DEBUG("\t绫诲瀷 %d", s.GetInt());
- edge.character = s.GetInt();
- }
- if (itr2->HasMember("line")) {
- const Value &a3 = (*itr2)["line"];
- if (a3.IsArray()) {
- for (Value::ConstValueIterator itr3 = a3.Begin(); itr3 != a3.End(); ++itr3) {
- DEBUG("\t绾跨偣 %d", (*itr3).GetInt());
- edge.points.push_back(mapPoints[(*itr3).GetInt()]);
- }
- }
- }
-
- road.rightEdge.push_back(edge);
- }
- }
- }
- if (itr->HasMember("separate")) {
- const Value &a2 = (*itr)["separate"];
- DEBUG("鍒嗛亾鏁伴噺 %d", a2.Size());
-
- for (Value::ConstValueIterator itr2 = a2.Begin(); itr2 != a2.End(); ++itr2) {
- separate_t sep;
- if (!itr2->IsObject())
- break;
-
- if (itr2->HasMember("lane_guide")) {
- const Value &a3 = (*itr2)["lane_guide"];
-
- for (Value::ConstValueIterator itr3 = a3.Begin(); itr3 != a3.End(); ++itr3) {
- lane_direct_t temp;
-
- if (itr3->HasMember("head_tail")) {
- const Value &a4 = (*itr3)["head_tail"];
- int n = 0;
-
- for (Value::ConstValueIterator itr4 = a4.Begin(); itr4 != a4.End(); ++itr4, ++n) {
- if (n == 0)
- temp.start = mapPoints[(*itr4).GetInt()];
- else if (n == 1)
- temp.end = mapPoints[(*itr4).GetInt()];
- }
- }
- if (itr3->HasMember("guide")) {
- const Value &a4 = (*itr3)["guide"];
-
- for (Value::ConstValueIterator itr4 = a4.Begin(); itr4 != a4.End(); ++itr4) {
- temp.direct.push_back((*itr4).GetInt());
- }
- }
- DEBUG("\t寰楀埌涓�缁勫鍚戠嚎");
- sep.lane_direct.push_back(temp);
- }
- }
- if (itr2->HasMember("lane_line")) {
- const Value &a3 = (*itr2)["lane_line"];
- DEBUG("\t绾挎暟閲� %d", a3.Size());
- for (Value::ConstValueIterator itr3 = a3.Begin(); itr3 != a3.End(); ++itr3) {
- DEBUG("\t\t鑺傛暟閲� %d", (*itr3).Size());
- vector<segment_t> sline;
-
- for (Value::ConstValueIterator itr4 = (*itr3).Begin(); itr4 != (*itr3).End(); ++itr4) {
- const Value &type = (*itr4)["type"];
- const Value &line = (*itr4)["line"];
-
- segment_t seg;
-
- DEBUG("\t\t\t鑺傜被鍨� = %d", type.GetInt());
- seg.character = type.GetInt();
-
- for (Value::ConstValueIterator itr5 = line.Begin(); itr5 != line.End(); ++itr5) {
- DEBUG("\t\t\t鐐� = %d", (*itr5).GetInt());
-
- seg.points.push_back(mapPoints[(*itr5).GetInt()]);
- }
-
- sline.push_back(seg);
- }
- sep.lines.push_back(sline);
- }
- }
- road.separate.push_back(sep);
- }
- }
-
- map.roads.push_back(road);
- }
- }
- }
-
- if (doc.HasMember("special_area")) {
- const Value &a = doc["special_area"];
-
- for (Value::ConstValueIterator itr = a.Begin();
- itr != a.End(); ++itr) {
- special_area_t specialArea;
-
- if (itr->HasMember("type")) {
- const Value &s = (*itr)["type"];
- specialArea.type = s.GetInt();
- }
- if (itr->HasMember("id")) {
- const Value &s = (*itr)["id"];
- specialArea.id = s.GetInt();
- }
- if (itr->HasMember("road")) {
- const Value &s = (*itr)["road"];
- specialArea.road = s.GetInt();
- }
-
- if (itr->HasMember("area")) {
- const Value &a2 = (*itr)["area"];
-
- for (Value::ConstValueIterator itr2 = a2.Begin();
- itr2 != a2.End(); ++itr2) {
- specialArea.area.push_back(mapPoints[(*itr2).GetInt()]);
- }
- }
-
- map.specialAreas.push_back(specialArea);
- }
- }
- /*if (doc.HasMember("trigger_line")) {
- const Value &a = doc["trigger_line"];
-
- for (Value::ConstValueIterator itr = a.Begin();
- itr != a.End(); ++itr) {
- trigger_line_t trigger;
-
- if (itr->HasMember("type")) {
- const Value &s = (*itr)["type"];
- trigger.active = s.GetInt();
- }
- if (itr->HasMember("id")) {
- const Value &s = (*itr)["id"];
- trigger.id = s.GetInt();
- }
- if (itr->HasMember("road")) {
- const Value &s = (*itr)["road"];
- trigger.road = s.GetInt();
- }
- if (itr->HasMember("tts")) {
- const Value &s = (*itr)["tts"];
- trigger.tts = s.GetString();
- }
- if (itr->HasMember("time")) {
- const Value &s = (*itr)["time"];
- trigger.time = s.GetInt();
- } else {
- trigger.time = 0;
- }
- if (itr->HasMember("distance")) {
- const Value &s = (*itr)["distance"];
- trigger.distance = s.GetInt();
- } else {
- trigger.distance = 0;
- }
-
- if (itr->HasMember("line")) {
- const Value &a2 = (*itr)["line"];
-
- for (Value::ConstValueIterator itr2 = a2.Begin();
- itr2 != a2.End(); ++itr2) {
- trigger.points.push_back(mapPoints[(*itr2).GetInt()]);
- }
- }
-
- map.triggerLines.push_back(trigger);
- }
- }*/
- if (doc.HasMember("red_line")) {
- const Value &a = doc["red_line"];
-
- for (Value::ConstValueIterator itr = a.Begin();
- itr != a.End(); ++itr) {
- forbid_line_t forbid;
-
- if (itr->HasMember("type")) {
- const Value &s = (*itr)["type"];
- forbid.type = s.GetInt();
-
- DEBUG("绂佹绾� type %d", forbid.type);
- }
- if (itr->HasMember("id")) {
- const Value &s = (*itr)["id"];
- forbid.id = s.GetInt();
- }
- if (itr->HasMember("points")) {
- const Value &a2 = (*itr)["points"];
-
- for (Value::ConstValueIterator itr2 = a2.Begin();
- itr2 != a2.End(); ++itr2) {
- forbid.points.push_back(mapPoints[(*itr2).GetInt()]);
- }
- }
- map.forbidLines.push_back(forbid);
- }
- }
-
- 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("鍦板浘瑙f瀽瀹屾瘯");
-
- CleanRoadMap();
- SetRoadMap(map, schemes);
- } else {
- DEBUG("############## 鍦板浘瑙f瀽鍑洪敊###################");
- }
-
- break;
- }
- case ID_MS_SCHEME: {
- Document doc;
- doc.Parse(value);
-
- DEBUG("鏂规 %s", value);
-
- if (!doc.HasParseError()) {
- DEBUG("寮�濮嬭В鏋愯矾鑰冩柟妗�");
- 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);
- }
- }
- SetRoadExamScheme(schemes);
- }
- break;
- }
-
case ID_MS_EXAM_PARAM: {
Document doc;
doc.Parse(value);
- if (!doc.HasParseError()) {
+ /*if (!doc.HasParseError()) {
if (doc.HasMember("hold_start_key_limit_time")) {
const Value &a = doc["hold_start_key_limit_time"];
examParam.hold_start_key_limit_time = a.GetInt();
@@ -1682,7 +1009,7 @@
examParam.crossing_break_valid_distance = a.GetInt();
DEBUG("crossing_break_valid_distance = %d", examParam.crossing_break_valid_distance);
}
- }
+ }*/
break;
}
@@ -1698,29 +1025,23 @@
if (a.IsArray()) {
for (Value::ConstValueIterator itr = a.Begin(); itr != a.End(); ++itr) {
- // a Map
- string name;
- int id = -1, type = -1;
- //int id, type, pointNum = 0, point2Num = 0;
- //double (*map)[2] = NULL, (*map2)[2] = NULL;
-
if (itr->IsObject()) {
- if (itr->HasMember("id")) {
- const Value &s = (*itr)["id"];
- id = s.GetInt();
- }
- if (itr->HasMember("name")) {
- const Value &s = (*itr)["id"];
- name = s.GetString();
- }
+
if (itr->HasMember("item")) {
- const Value &s = (*itr)["item"];
- type = s.GetInt();
+ const Value &s = (*itr)["item"]; // 椤圭洰绫诲瀷锛氬�掑簱锛屼晶鏂瑰仠杞�...
+ int type = s.GetInt();
switch (type) {
case MAP_TYPE_CURVE: {
curve_map_t map;
- map.id = id;
+ if (itr->HasMember("id")) {
+ const Value &s2 = (*itr)["id"];
+ map.id = s2.GetInt();
+ }
+ if (itr->HasMember("name")) {
+ const Value &s2 = (*itr)["name"];
+ map.name = s2.GetString();
+ }
if (itr->HasMember("left_start_point")) {
const Value &s2 = (*itr)["left_start_point"];
LoadPoint(map.left_start_point, s2);
@@ -1737,46 +1058,117 @@
const Value &s2 = (*itr)["right_end_point"];
LoadPoint(map.right_end_point, s2);
}
- AddCurveMap(map);
+
+ if (itr->HasMember("front_half_big_circle_centre")) {
+ const Value &s2 = (*itr)["front_half_big_circle_centre"];
+ LoadPoint(map.right_end_point, s2);
+ }
+ if (itr->HasMember("front_half_big_circle_radius")) {
+ const Value &s2 = (*itr)["front_half_big_circle_radius"];
+ map.front_half_big_circle_radius = s2.GetDouble();
+ }
+ if (itr->HasMember("front_half_small_circle_centre")) {
+ const Value &s2 = (*itr)["front_half_small_circle_centre"];
+ LoadPoint(map.right_end_point, s2);
+ }
+ if (itr->HasMember("front_half_small_circle_radius")) {
+ const Value &s2 = (*itr)["front_half_small_circle_radius"];
+ map.front_half_small_circle_radius = s2.GetDouble();
+ }
+ if (itr->HasMember("back_half_big_circle_centre")) {
+ const Value &s2 = (*itr)["back_half_big_circle_centre"];
+ LoadPoint(map.right_end_point, s2);
+ }
+ if (itr->HasMember("back_half_big_circle_radius")) {
+ const Value &s2 = (*itr)["back_half_big_circle_radius"];
+ map.back_half_big_circle_radius = s2.GetDouble();
+ }
+ if (itr->HasMember("back_half_small_circle_centre")) {
+ const Value &s2 = (*itr)["back_half_small_circle_centre"];
+ LoadPoint(map.right_end_point, s2);
+ }
+ if (itr->HasMember("back_half_small_circle_radius")) {
+ const Value &s2 = (*itr)["back_half_small_circle_radius"];
+ map.back_half_small_circle_radius = s2.GetDouble();
+ }
+ //AddCurveMap(map);
break;
}
case MAP_TYPE_PARK_BUTTOM: {
park_button_map_t map;
-
- map.id = id;
+ if (itr->HasMember("id")) {
+ const Value &s2 = (*itr)["id"];
+ map.id = s2.GetInt();
+ }
+ if (itr->HasMember("name")) {
+ const Value &s2 = (*itr)["name"];
+ map.name = s2.GetString();
+ }
+ if (itr->HasMember("line_width")) {
+ const Value &s2 = (*itr)["line_width"];
+ map.line_width = s2.GetDouble();
+ }
if (itr->HasMember("point") && (*itr)["point"].IsArray()) {
- const Value &arr = (*itr)["point"];
- LoadPoints(map.map, arr);
+ const Value &arr = (*itr)["point"][0]["x-y"];
+
+ LoadPoints(map.points, arr);
}
AddParkButtonMap(map);
break;
}
case MAP_TYPE_PARK_EDGE: {
park_edge_map_t map;
- map.id = id;
+ if (itr->HasMember("id")) {
+ const Value &s2 = (*itr)["id"];
+ map.id = s2.GetInt();
+ }
+ if (itr->HasMember("name")) {
+ const Value &s2 = (*itr)["name"];
+ map.name = s2.GetString();
+ }
+ if (itr->HasMember("line_width")) {
+ const Value &s2 = (*itr)["line_width"];
+ map.line_width = s2.GetDouble();
+ }
if (itr->HasMember("point") && (*itr)["point"].IsArray()) {
- const Value &arr = (*itr)["point"];
- LoadPoints(map.map, arr);
+ const Value &arr = (*itr)["point"][0]["x-y"];
+ LoadPoints(map.points, arr);
}
AddParkEdgeMap(map);
break;
}
case MAP_TYPE_UPHILL: {
uphill_map_t map;
- map.id = id;
- if (itr->HasMember("point") && (*itr)["point"].IsArray()) {
- const Value &arr = (*itr)["point"];
- LoadPoints(map.map, arr);
+ if (itr->HasMember("id")) {
+ const Value &s2 = (*itr)["id"];
+ map.id = s2.GetInt();
}
+ if (itr->HasMember("name")) {
+ const Value &s2 = (*itr)["name"];
+ map.name = s2.GetString();
+ }
+ if (itr->HasMember("point") && (*itr)["point"].IsArray()) {
+ const Value &arr = (*itr)["point"][0]["x-y"];
+ LoadPoints(map.points, arr);
+ }
+ AddUphillMap(map);
break;
}
- case MAP_TYPE_TURN_90: {
+ case MAP_TYPE_RIGHT_CORNER: {
turn_a90_map_t map;
- map.id = id;
- if (itr->HasMember("point") && (*itr)["point"].IsArray()) {
- const Value &arr = (*itr)["point"];
- LoadPoints(map.map, arr);
+ if (itr->HasMember("id")) {
+ const Value &s2 = (*itr)["id"];
+ map.id = s2.GetInt();
}
+ if (itr->HasMember("name")) {
+ const Value &s2 = (*itr)["name"];
+ map.name = s2.GetString();
+ }
+ if (itr->HasMember("point") && (*itr)["point"].IsArray()) {
+ const Value &arr = (*itr)["point"][0]["x-y"];
+ LoadPoints(map.points, arr);
+ }
+ AddTurnA90Map(map);
break;
}
default:
--
Gitblit v1.8.0