Review fixes.

This commit is contained in:
Maxim Pimenov 2016-12-12 17:02:24 +03:00
parent 9bfa0ab864
commit d1a0063156
2 changed files with 8 additions and 12 deletions

View file

@ -34,10 +34,6 @@ struct SegmentSpeeds
{
}
double GetWeightedSpeed() const { return m_weightedSpeed; }
double GetWeightedRefSpeed() const { return m_weightedRefSpeed; }
double GetWeight() const { return m_weight; }
double m_weightedSpeed = 0;
double m_weightedRefSpeed = 0;
double m_weight = 0;
@ -158,16 +154,16 @@ BOOST_PYTHON_MODULE(pytraffic)
class_<SegmentSpeeds>("SegmentSpeeds", init<double, double, double>())
.def("__repr__", &SegmentSpeedsRepr)
.def("get_weighted_speed", &SegmentSpeeds::GetWeightedSpeed)
.def("get_weighted_ref_speed", &SegmentSpeeds::GetWeightedRefSpeed)
.def("get_weight", &SegmentSpeeds::GetWeight)
.def_readwrite("weighted_speed", &SegmentSpeeds::m_weightedSpeed)
.def_readwrite("weighted_ref_speed", &SegmentSpeeds::m_weightedRefSpeed)
.def_readwrite("weight", &SegmentSpeeds::m_weight)
;
class_<traffic::TrafficInfo::RoadSegmentId>("RoadSegmentId", init<uint32_t, uint16_t, uint8_t>())
.def("__repr__", &RoadSegmentIdRepr)
.def("get_fid", &traffic::TrafficInfo::RoadSegmentId::GetFid)
.def("get_idx", &traffic::TrafficInfo::RoadSegmentId::GetIdx)
.def("get_dir", &traffic::TrafficInfo::RoadSegmentId::GetDir)
.add_property("fid", &traffic::TrafficInfo::RoadSegmentId::GetFid)
.add_property("idx", &traffic::TrafficInfo::RoadSegmentId::GetIdx)
.add_property("dir", &traffic::TrafficInfo::RoadSegmentId::GetDir)
;
class_<std::vector<traffic::TrafficInfo::RoadSegmentId>>("RoadSegmentIdVec")

View file

@ -18,13 +18,13 @@ keys = [
RoadSegmentId(1, 0, 1),
]
fid, idx, dir = keys[2].get_fid(), keys[2].get_idx(), keys[2].get_dir()
fid, idx, dir = keys[2].fid, keys[2].idx, keys[2].dir
print fid, idx, dir
keys_from_mwm = generate_traffic_keys(options.path_to_mwm)
seg_speeds = SegmentSpeeds(1.0, 2.0, 3.0)
ws, wrs, w = seg_speeds.get_weighted_speed(), seg_speeds.get_weighted_ref_speed(), seg_speeds.get_weight()
ws, wrs, w = seg_speeds.weighted_speed, seg_speeds.weighted_ref_speed, seg_speeds.weight
print ws, wrs, w
mapping = {