refactoring
This commit is contained in:
parent
04e87c1d9c
commit
64b83f569c
24 changed files with 186 additions and 310 deletions
|
|
@ -76,24 +76,27 @@ void EdgePL::setCost(const router::EdgeCost& c) { _cost = c; }
|
|||
|
||||
|
||||
// _____________________________________________________________________________
|
||||
void EdgePL::getAttrs(std::map<std::string, std::string>* obj) const {
|
||||
(*obj)["cost"] = std::to_string(_cost.getValue());
|
||||
(*obj)["from_edge"] = util::toString(_startE);
|
||||
(*obj)["to_edge"] = util::toString(_endE);
|
||||
(*obj)["cost_m_lvl1"] = std::to_string(_cost.meterDistLvl1);
|
||||
(*obj)["cost_m_lvl0"] = std::to_string(_cost.meterDist);
|
||||
(*obj)["cost_m_lvl1"] = std::to_string(_cost.meterDistLvl1);
|
||||
(*obj)["cost_m_lvl2"] = std::to_string(_cost.meterDistLvl2);
|
||||
(*obj)["cost_m_lvl3"] = std::to_string(_cost.meterDistLvl3);
|
||||
(*obj)["cost_m_lvl4"] = std::to_string(_cost.meterDistLvl4);
|
||||
(*obj)["cost_m_lvl5"] = std::to_string(_cost.meterDistLvl5);
|
||||
(*obj)["cost_m_lvl6"] = std::to_string(_cost.meterDistLvl6);
|
||||
(*obj)["cost_m_lvl7"] = std::to_string(_cost.meterDistLvl7);
|
||||
(*obj)["cost_fullturn"] = std::to_string(_cost.fullTurns);
|
||||
(*obj)["cost_st_passthru"] = std::to_string(_cost.passThruStations);
|
||||
(*obj)["cost_m_oneway"] = std::to_string(_cost.oneWayMeters);
|
||||
(*obj)["cost_m_lineunmatch"] = std::to_string(_cost.lineUnmatchedMeters);
|
||||
(*obj)["cost_reach_node_pen"] = std::to_string(_cost.reachPen);
|
||||
(*obj)["cost_oneway_event"] = std::to_string(_cost.oneWayEdges);
|
||||
(*obj)["dummy"] = _edges.size() ? "no" : "yes";
|
||||
util::json::Dict EdgePL::getAttrs() const {
|
||||
util::json::Dict obj;
|
||||
obj["cost"] = std::to_string(_cost.getValue());
|
||||
obj["from_edge"] = util::toString(_startE);
|
||||
obj["to_edge"] = util::toString(_endE);
|
||||
obj["cost_m_lvl1"] = std::to_string(_cost.meterDistLvl1);
|
||||
obj["cost_m_lvl0"] = std::to_string(_cost.meterDist);
|
||||
obj["cost_m_lvl1"] = std::to_string(_cost.meterDistLvl1);
|
||||
obj["cost_m_lvl2"] = std::to_string(_cost.meterDistLvl2);
|
||||
obj["cost_m_lvl3"] = std::to_string(_cost.meterDistLvl3);
|
||||
obj["cost_m_lvl4"] = std::to_string(_cost.meterDistLvl4);
|
||||
obj["cost_m_lvl5"] = std::to_string(_cost.meterDistLvl5);
|
||||
obj["cost_m_lvl6"] = std::to_string(_cost.meterDistLvl6);
|
||||
obj["cost_m_lvl7"] = std::to_string(_cost.meterDistLvl7);
|
||||
obj["cost_fullturn"] = std::to_string(_cost.fullTurns);
|
||||
obj["cost_st_passthru"] = std::to_string(_cost.passThruStations);
|
||||
obj["cost_m_oneway"] = std::to_string(_cost.oneWayMeters);
|
||||
obj["cost_m_lineunmatch"] = std::to_string(_cost.lineUnmatchedMeters);
|
||||
obj["cost_reach_node_pen"] = std::to_string(_cost.reachPen);
|
||||
obj["cost_oneway_event"] = std::to_string(_cost.oneWayEdges);
|
||||
obj["dummy"] = _edges.size() ? "no" : "yes";
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class EdgePL : public GeoEdgePL<float> {
|
|||
public:
|
||||
EdgePL() : _cost(), _start(0), _end(0), _startE(0), _endE(0) {}
|
||||
const util::geo::FLine* getGeom() const;
|
||||
void getAttrs(std::map<std::string, std::string>* attrs) const;
|
||||
util::json::Dict getAttrs() const;
|
||||
router::EdgeList* getEdges();
|
||||
const router::EdgeList& getEdges() const;
|
||||
void setStartNode(const trgraph::Node* s);
|
||||
|
|
|
|||
|
|
@ -23,8 +23,9 @@ class NodePL : public GeoNodePL<float> {
|
|||
const util::geo::FPoint* getGeom() const {
|
||||
return !_n ? 0 : _n->pl().getGeom();
|
||||
}
|
||||
void getAttrs(std::map<std::string, std::string>* attrs) const {
|
||||
if (_n) _n->pl().getAttrs(attrs);
|
||||
util::json::Dict getAttrs() const {
|
||||
if (_n) return _n->pl().getAttrs();
|
||||
return util::json::Dict();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue