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

Method initNode

common/map_sdk/route_plan/src/node_opt.cpp:24–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22void NodeOpt::setMapHandle(hadmap::txMapHandle* pH) { pHandle = pH; }
23
24bool NodeOpt::initNode(NodePtr& nodePtr) {
25 if (!nodePtr) throw std::runtime_error("initNode Error, nodePtr Empty");
26
27 hadmap::txRoadPtr roadPtr;
28 if (TX_HADMAP_DATA_OK == hadmap::getRoad(pHandle, nodePtr->nodeId.roadId, false, roadPtr)) {
29 nodePtr->roadLen = roadPtr->getGeometry()->getLength();
30 nodePtr->startPt = roadPtr->getGeometry()->getStart();
31 nodePtr->endPt = roadPtr->getGeometry()->getEnd();
32 return true;
33 } else {
34 char info[128];
35 sprintf(info, "initNode Error, get road %s info error", std::to_string(nodePtr->nodeId.roadId).c_str());
36 txlog::error(info);
37 return false;
38 }
39}
40
41bool NodeOpt::getNodeByLoc(const hadmap::txPoint& loc, NodePtr& nodePtr) {
42 if (!nodePtr) nodePtr.reset(new Node);

Callers

nothing calls this directly

Calls 7

to_stringFunction · 0.85
errorFunction · 0.85
getStartMethod · 0.80
getEndMethod · 0.80
getRoadFunction · 0.50
getLengthMethod · 0.45
getGeometryMethod · 0.45

Tested by

no test coverage detected