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

Method parseBoundary

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

Source from the content-addressed store, hash-verified

131}
132
133bool JsonParser::parseBoundary(const std::string& jsonStr, txLaneBoundaries& boundaries) {
134 neb::CJsonObject jP;
135 jP.Parse(jsonStr);
136
137 neb::CJsonObject& jBoundaries = jP["boundary"];
138 size_t boundarySize = jBoundaries.GetArraySize();
139 for (size_t i = 0; i < boundarySize; ++i) {
140 std::string id;
141 jBoundaries[i].Get("id", id);
142 laneboundarypkid boundaryId = laneboundarypkid(std::stoll(id));
143
144 uint32_t mrk;
145 jBoundaries[i].Get("mark", mrk);
146
147 neb::CJsonObject& geoms = jBoundaries[i]["geom"];
148 PointVec curve;
149 size_t geomSize = geoms.GetArraySize();
150 for (size_t j = 0; j < geomSize; ++j) {
151 txPoint p;
152 geoms[j].Get("x", p.x);
153 geoms[j].Get("y", p.y);
154 geoms[j].Get("z", p.z);
155 curve.push_back(p);
156 }
157
158 txLaneBoundaryPtr boundaryPtr(new txLaneBoundary);
159 boundaryPtr->setId(boundaryId).setLaneMark(LANE_MARK(mrk)).setGeometry(curve, COORD_WGS84);
160
161 boundaries.push_back(boundaryPtr);
162 }
163 return true;
164}
165
166bool JsonParser::parseLink(const std::string& jsonStr, txLaneLinks& links) {
167 neb::CJsonObject jP;

Callers

nothing calls this directly

Calls 6

LANE_MARKEnum · 0.85
GetArraySizeMethod · 0.80
setIdMethod · 0.80
ParseMethod · 0.45
GetMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected