yy1717
2020-08-11 03ca970f73af542456326b2fa277090ce0ea532f
lib/src/main/cpp/master/comm_if.cpp
@@ -808,23 +808,6 @@
                                MakeLine(&road.startLine, &p1, &p2);
                            }
                            /*if (itr->HasMember("stop_line")) {
                                const Value &a2 = (*itr)["stop_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.stopLine, &p1, &p2);
                            }*/
                            if (itr->HasMember("crossing") && itr->IsArray()) {
                                const Value &a2 = (*itr)["crossing"];
@@ -838,14 +821,17 @@
                                    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());
                                    }
                                    if (itr2->HasMember("line")) {
                                        const Value &s = (*itr2)["line"];
@@ -870,20 +856,6 @@
                                road.stopLine.assign(crossing.begin(), crossing.end());
                            }
                            if (itr->HasMember("active")) {
                                const Value &s = (*itr)["active"];
                                DEBUG("路口动作 %d", s.GetInt());
                                road.active = s.GetInt();
                            }
                            if (itr->HasMember("tts")) {
                                const Value &s = (*itr)["tts"];
                                road.tts = s.GetString();
                            }
                            if (itr->HasMember("stop_flag")) {
                                const Value &s = (*itr)["stop_flag"];
                                road.stopFlag = s.GetInt();
                            }
                            if (itr->HasMember("next_road")) {
                                const Value &s = (*itr)["next_road"];
                                road.targetRoad  = s.GetInt();
@@ -947,49 +919,64 @@
                                DEBUG("段数量 %d", a2.Size());
                                for (Value::ConstValueIterator itr2 = a2.Begin(); itr2 != a2.End(); ++itr2) {
                                    DEBUG("\t线数量 %d", (*itr2).Size());
                                    separate_t sep;
                                    if (!itr2->IsObject())
                                        break;
                                    if (itr2->HasMember("lane_guide") && itr2->IsArray()) {
                                        const Value &a3 = (*itr2)["lane_guide"];
                                    for (Value::ConstValueIterator itr3 = (*itr2).Begin(); itr3 != (*itr2).End(); ++itr3) {
                                        DEBUG("\t\t节数量 %d", (*itr3).Size());
                                        vector<segment_t> sline;
                                        for (Value::ConstValueIterator itr3 = a3.Begin(); itr3 != a3.End(); ++itr3) {
                                            lane_direct_t temp;
                                        for (Value::ConstValueIterator itr4 = (*itr3).Begin(); itr4 != (*itr3).End(); ++itr4) {
                                            const Value &type = (*itr4)["type"];
                                            const Value &line = (*itr4)["line"];
                                            if (itr3->HasMember("head_tail")) {
                                                const Value &a4 = (*itr3)["head_tail"];
                                                int n = 0;
                                            segment_t seg;
                                                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"];
                                            DEBUG("\t\t\t节类型 = %d", type.GetInt());
                                            seg.character = type.GetInt();
                                            if ((*itr4).HasMember("left_lane_direct")) {
                                                const Value &dir = (*itr4)["left_lane_direct"];
                                                DEBUG("\t\t\t左车道方向 %d", dir.GetInt());
                                                seg.left_lane_direct = dir.GetInt();
                                            } else {
                                                seg.left_lane_direct = 0;
                                                for (Value::ConstValueIterator itr4 = a4.Begin(); itr4 != a4.End(); ++itr4) {
                                                    temp.direct.push_back((*itr4).GetInt());
                                                }
                                            }
                                            if ((*itr4).HasMember("right_lane_direct")) {
                                                const Value &dir = (*itr4)["right_lane_direct"];
                                                DEBUG("\t\t\t右车道方向 %d", dir.GetInt());
                                                seg.right_lane_direct = dir.GetInt();
                                            } else {
                                                seg.right_lane_direct = 0;
                                            }
                                            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.lane_direct.push_back(temp);
                                        }
                                        sep.lines.push_back(sline);
                                    }
                                    if (itr2->HasMember("lane_line") && itr2->IsArray() ) {
                                        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);
                                }
                            }