| | |
| | | |
| | | static LIST_AREA_MAP AreaMapList; |
| | | |
| | | static Polygon RoadMapPoints; |
| | | static road_exam_map RoadMap; |
| | | |
| | | static LIST_ROAD_MAP RoadMapList; |
| | | |
| | | |
| | | static int exam_dummy_light; |
| | | |
| | |
| | | |
| | | AreaMapList.clear(); |
| | | |
| | | RoadMapPoints.num = 0; |
| | | RoadMapPoints.point = NULL; |
| | | |
| | | // RoadMapList.clear(); |
| | | RoadMap.roads.clear(); |
| | | RoadMap.specialAreas.clear(); |
| | | RoadMap.triggerLines.clear(); |
| | |
| | | RoadMap.triggerLines.assign(map.triggerLines.begin(), map.triggerLines.end()); |
| | | |
| | | DEBUG("得到新的路考地图 路数量 %d 特殊区域数量 %d 触发线数量 %d", RoadMap.roads.size(), RoadMap.specialAreas.size(), RoadMap.triggerLines.size()); |
| | | } |
| | | |
| | | void SetRoadMapPoints(vector<double> &mapPoints) |
| | | { |
| | | DEBUG("加入路考地图点集合 num = %d", mapPoints.size()/2); |
| | | |
| | | RoadMapPoints.num = mapPoints.size()/2; |
| | | |
| | | if (RoadMapPoints.num > 0) { |
| | | RoadMapPoints.point = (PointF *)malloc(sizeof(PointF) * RoadMapPoints.num); |
| | | for (int i = 0; i < RoadMapPoints.num; ++i) { |
| | | RoadMapPoints.point[i].X = mapPoints[i*2]; |
| | | RoadMapPoints.point[i].Y = mapPoints[i*2+1]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | void AddRoadMapParent(int id, int type, string tts, int stopFlag, |
| | | vector<vector<int>> &redLines, |
| | | vector<vector<int>> &redAreas, |
| | | vector<vector<int>> &greenLines, |
| | | vector<vector<int>> &triggerLines, |
| | | vector<vector<int>> &roadEdgeLines, |
| | | vector<int> area, |
| | | vector<int> stopLine) |
| | | { |
| | | /* struct road_exam_map newMap; |
| | | |
| | | newMap.id = id; |
| | | newMap.type = type; |
| | | newMap.tts = tts; |
| | | newMap.flagStop = stopFlag; |
| | | |
| | | DEBUG("加入路考地图信息 id = %d type = %d", id, type); |
| | | |
| | | if (!tts.empty()) { |
| | | DEBUG("TTS 信息 = %s", tts.c_str()); |
| | | } |
| | | |
| | | if ((newMap.redLineNum = redLines.size()) > 0) { |
| | | newMap.redLine = (Polygon *) malloc(sizeof(Polygon) * newMap.redLineNum); |
| | | |
| | | DEBUG("红线 %d 根", newMap.redLineNum); |
| | | |
| | | for (int i = 0; i < newMap.redLineNum; ++i) { |
| | | newMap.redLine[i].num = redLines[i].size(); |
| | | newMap.redLine[i].point = (PointF *) malloc(sizeof(PointF) * newMap.redLine[i].num); |
| | | |
| | | DEBUG(" 结点 %d 个", newMap.redLine[i].num); |
| | | |
| | | for (int j = 0; j < newMap.redLine[i].num; ++j) { |
| | | newMap.redLine[i].point[j] = RoadMapPoints.point[redLines[i][j]]; |
| | | } |
| | | } |
| | | } else { |
| | | newMap.redLine = NULL; |
| | | } |
| | | |
| | | if ((newMap.redAreaNum = redAreas.size()) > 0) { |
| | | newMap.redArea = (Polygon *) malloc(sizeof(Polygon) * newMap.redAreaNum); |
| | | |
| | | DEBUG("红区 %d 个", newMap.redAreaNum); |
| | | |
| | | for (int i = 0; i < newMap.redAreaNum; ++i) { |
| | | newMap.redArea[i].num = redAreas[i].size(); |
| | | newMap.redArea[i].point = (PointF *) malloc(sizeof(PointF) * newMap.redLine[i].num); |
| | | |
| | | DEBUG(" 结点 %d 个", newMap.redArea[i].num); |
| | | |
| | | for (int j = 0; j < newMap.redArea[i].num; ++j) { |
| | | newMap.redArea[i].point[j] = RoadMapPoints.point[redAreas[i][j]]; |
| | | } |
| | | } |
| | | } else { |
| | | newMap.redArea = NULL; |
| | | } |
| | | |
| | | if ((newMap.greenLineNum = greenLines.size()) > 0) { |
| | | newMap.greenLine = (Polygon *) malloc(sizeof(Polygon) * newMap.greenLineNum); |
| | | |
| | | DEBUG("绿线 %d 根", newMap.greenLineNum); |
| | | for (int i = 0; i < newMap.greenLineNum; ++i) { |
| | | newMap.greenLine[i].num = greenLines[i].size(); |
| | | newMap.greenLine[i].point = (PointF *) malloc(sizeof(PointF) * newMap.greenLine[i].num); |
| | | |
| | | DEBUG(" 结点 %d 个", newMap.greenLine[i].num); |
| | | for (int j = 0; j < newMap.greenLine[i].num; ++j) { |
| | | newMap.greenLine[i].point[j] = RoadMapPoints.point[greenLines[i][j]]; |
| | | } |
| | | } |
| | | } else { |
| | | newMap.greenLine = NULL; |
| | | } |
| | | |
| | | if ((newMap.triggerLineNum = triggerLines.size()) > 0) { |
| | | newMap.triggerLine = (struct trigger_line_t *) malloc(sizeof(struct trigger_line_t) * newMap.triggerLineNum); |
| | | |
| | | DEBUG("触发线 %d 根", newMap.triggerLineNum); |
| | | |
| | | for (int i = 0; i < newMap.triggerLineNum; ++i) { |
| | | newMap.triggerLine[i].line.num = triggerLines[i].size() - 1; |
| | | newMap.triggerLine[i].line.point = (PointF *) malloc(sizeof(PointF) * newMap.triggerLine[i].line.num); |
| | | |
| | | DEBUG(" 结点 %d 个, 触发 id = %d", newMap.triggerLine[i].line.num, triggerLines[i][0]); |
| | | |
| | | newMap.triggerLine[i].triggerMapId = triggerLines[i][0]; |
| | | for (int j = 0; j < newMap.triggerLine[i].line.num; ++j) { |
| | | newMap.triggerLine[i].line.point[j] = RoadMapPoints.point[triggerLines[i][j+1]]; |
| | | } |
| | | } |
| | | } 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(); |
| | | newMap.area.point = (PointF *) malloc(sizeof(PointF) * newMap.area.num); |
| | | |
| | | DEBUG("子项目区域点 %d 个", newMap.area.num); |
| | | for (int i = 0; i < newMap.area.num; ++i) { |
| | | newMap.area.point[i] = RoadMapPoints.point[area[i]]; |
| | | } |
| | | } else { |
| | | newMap.area.point = NULL; |
| | | newMap.area.num = 0; |
| | | } |
| | | |
| | | if (stopLine.size() == 2) { |
| | | newMap.stopLine.X1 = RoadMapPoints.point[stopLine[0]].X; |
| | | newMap.stopLine.Y1 = RoadMapPoints.point[stopLine[0]].Y; |
| | | newMap.stopLine.X2 = RoadMapPoints.point[stopLine[1]].X; |
| | | newMap.stopLine.Y2 = RoadMapPoints.point[stopLine[1]].Y; |
| | | DEBUG("得到停止线 (%f,% f) --- (%f, %f)", newMap.stopLine.X1, |
| | | newMap.stopLine.Y1, |
| | | newMap.stopLine.X2, |
| | | newMap.stopLine.Y2); |
| | | } |
| | | |
| | | RoadMapList.push_back(newMap);*/ |
| | | } |
| | | |
| | | void SetCarMeasurePoint(double *basePoint, int *axial, int *left_front_tire, |
| | |
| | | |
| | | if (ExamType != TEST_TYPE_AREA) { |
| | | if (exam_dummy_light == 2) { |
| | | // TestRoadGeneral(RoadMapList, CarModel, CarModelList, speed, move, rtkTime); |
| | | TestRoadGeneral(RoadMap, CarModel, CarModelList, speed, move, rtkTime); |
| | | } |
| | | } else { |