yy1717
2024-02-28 27fc91fbe8f88b6885356e68828cfe1ce1db7601
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("############## 地图解析出错###################");
            }
            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("路id %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("地图解析完毕");
                CleanRoadMap();
                SetRoadMap(map, schemes);
            } else {
                DEBUG("############## 地图解析出错###################");
            }
            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: