From 4053e385bb8dc70ad8c8d12eeaec9c10ee87fcb9 Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期一, 16 三月 2020 18:06:07 +0800
Subject: [PATCH] 更新地图
---
lib/src/main/cpp/master/comm_if.cpp | 66 +++++++++++++++++++++++++++++++++
1 files changed, 66 insertions(+), 0 deletions(-)
diff --git a/lib/src/main/cpp/master/comm_if.cpp b/lib/src/main/cpp/master/comm_if.cpp
index b1ea6af..9c668ca 100644
--- a/lib/src/main/cpp/master/comm_if.cpp
+++ b/lib/src/main/cpp/master/comm_if.cpp
@@ -35,6 +35,8 @@
#define ID_SM_RTK_PLAT_LOGIN 0x0005
#define ID_SM_READ_MAP 0x0006
#define ID_MS_MAP 0x8006
+#define ID_MS_ROAD_MAP 0x8013
+
#define ID_SM_READ_CAR 0x0007
#define ID_MS_CAR 0x8007
#define ID_SM_MCU_BRIEF 0x0008
@@ -483,6 +485,70 @@
ConfigPlatform(&cfg);
break;
}
+ case ID_MS_ROAD_MAP: {
+ Document doc;
+ doc.Parse(value);
+
+ if (!doc.HasParseError()) {
+ const Value &a = doc.GetArray();
+ if (a.IsArray()) {
+ for (Value::ConstValueIterator itr = a.Begin(); itr != a.End(); ++itr) {
+ // a Map
+ int id, type, pointNum = 0;
+ double (*map)[2] = NULL;
+ int *line = NULL;
+
+ if (itr->IsObject()) {
+ 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("map")) {
+ const Value &s = (*itr)["map"];
+ int i = 0, j = 0;
+
+ pointNum = s.Size() / 2;
+ map = (double (*)[2]) new double[pointNum][2];
+
+ for (Value::ConstValueIterator itr2 = s.Begin();
+ itr2 != s.End(); ++itr2) {
+ map[i][j] = (*itr2).GetDouble();
+ if (++j == 2) {
+ j = 0;
+ i++;
+ }
+ }
+ }
+
+ AddMap(id, type, map, pointNum, redLineNum, redLine, greenLine, redArea, triggerLine);
+
+ if (itr->HasMember("red_line")) {
+ const Value &s = (*itr)["red_line"];
+ for (Value::ConstValueIterator itr2 = s.Begin();
+ itr2 != s.End(); ++itr2) {
+ // 鍙互杩炴帴涓轰竴鏉$嚎鐨勭偣
+ const Value &s2 = (*itr2)["line"];
+
+ lineNum = s2.Size() / 2;
+
+ for (Value::ConstValueIterator itr3 = s2.Begin();
+ itr3 != s2.End(); ++itr3) {
+ line[x++] = (*itr3).GetInt();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+ }
case ID_MS_MAP: {
Document doc;
doc.Parse(value);
--
Gitblit v1.8.0