MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / parseLane

Method parseLane

common/map_sdk/transmission/src/json_parser.cpp:82–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82bool JsonParser::parseLane(const std::string& jsonStr, txLanes& lanes) {
83 neb::CJsonObject jP;
84 jP.Parse(jsonStr);
85
86 neb::CJsonObject& jLanes = jP["lane"];
87 size_t laneSize = jLanes.GetArraySize();
88 for (size_t i = 0; i < laneSize; ++i) {
89 uint32_t arrow;
90 jLanes[i].Get("arr", arrow);
91
92 std::string ridStr, sidStr, lidStr, lbidStr, rbidStr;
93 jLanes[i].Get("rid", ridStr);
94 jLanes[i].Get("sid", sidStr);
95 jLanes[i].Get("id", lidStr);
96 jLanes[i].Get("lbid", lbidStr);
97 jLanes[i].Get("rbid", rbidStr);
98 roadpkid rid = roadpkid(std::stoll(ridStr));
99 sectionpkid sid = sectionpkid(std::stoll(sidStr));
100 lanepkid lid = lanepkid(std::stoll(lidStr));
101 laneboundarypkid lbid = laneboundarypkid(std::stoll(lbidStr));
102 laneboundarypkid rbid = laneboundarypkid(std::stoll(rbidStr));
103
104 uint32_t splimit;
105 jLanes[i].Get("sl", splimit);
106
107 neb::CJsonObject& geoms = jLanes[i]["geom"];
108 PointVec curve;
109 size_t geomSize = geoms.GetArraySize();
110 for (size_t j = 0; j < geomSize; ++j) {
111 txPoint p;
112 geoms[j].Get("x", p.x);
113 geoms[j].Get("y", p.y);
114 geoms[j].Get("z", p.z);
115 curve.push_back(p);
116 }
117
118 txLanePtr lanePtr(new txLane);
119 lanePtr->setRoadId(rid)
120 .setSectionId(sid)
121 .setId(lid)
122 .setLeftBoundaryId(lbid)
123 .setRightBoundaryId(rbid)
124 .setSpeedLimit(splimit)
125 .setLaneArrow(LANE_ARROW(arrow))
126 .setGeometry(curve, COORD_WGS84);
127
128 lanes.push_back(lanePtr);
129 }
130 return true;
131}
132
133bool JsonParser::parseBoundary(const std::string& jsonStr, txLaneBoundaries& boundaries) {
134 neb::CJsonObject jP;

Callers

nothing calls this directly

Calls 7

LANE_ARROWEnum · 0.85
GetArraySizeMethod · 0.80
setIdMethod · 0.80
setRoadIdMethod · 0.80
ParseMethod · 0.45
GetMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected