From 682b17ff66dff23e03c6a57de276ea0c3e670c0e Mon Sep 17 00:00:00 2001 From: yy1717 <fctom1215@outlook.com> Date: 星期一, 23 三月 2020 18:44:47 +0800 Subject: [PATCH] 起步和直线 --- lib/src/main/cpp/driver_test.cpp | 29 ++++++++++++++++++++++++++++- 1 files changed, 28 insertions(+), 1 deletions(-) diff --git a/lib/src/main/cpp/driver_test.cpp b/lib/src/main/cpp/driver_test.cpp index fae8d3b..46e0c3d 100644 --- a/lib/src/main/cpp/driver_test.cpp +++ b/lib/src/main/cpp/driver_test.cpp @@ -257,6 +257,15 @@ if (map.area.point != NULL) { free(map.area.point); } + + if (map.roadEdgeLine != NULL) { + for (int j = 0; j < map.roadEdgeLineNum; ++j) { + if (map.roadEdgeLine[j].point != NULL) + free(map.roadEdgeLine[j].point); + } + + free(map.roadEdgeLine); + } } RoadMapList.clear(); @@ -282,6 +291,7 @@ vector<vector<int>> &redAreas, vector<vector<int>> &greenLines, vector<vector<int>> &triggerLines, + vector<vector<int>> &roadEdgeLines, vector<int> area, vector<int> stopLine) { @@ -371,7 +381,24 @@ } } else { newMap.triggerLine = NULL; - }; + } + + if ((newMap.roadEdgeLineNum = roadEdgeLines.size()) > 0) { + newMap.roadEdgeLine = (Polygon *) malloc(sizeof(Polygon) * newMap.roadEdgeLineNum); + + DEBUG("閬撹矾杈圭嚎 %d 鏍�", newMap.roadEdgeLineNum); + for (int i = 0; i < newMap.roadEdgeLineNum; ++i) { + newMap.roadEdgeLine[i].num = roadEdgeLines[i].size(); + newMap.roadEdgeLine[i].point = (PointF *) malloc(sizeof(PointF) * newMap.roadEdgeLine[i].num); + + DEBUG(" 缁撶偣 %d 涓�", newMap.roadEdgeLine[i].num); + for (int j = 0; j < newMap.roadEdgeLine[i].num; ++j) { + newMap.roadEdgeLine[i].point[j] = RoadMapPoints.point[roadEdgeLines[i][j]]; + } + } + } else { + newMap.roadEdgeLine = NULL; + } if (area.size() > 0) { newMap.area.num = area.size(); -- Gitblit v1.8.0