Added support for the direction of the lane connection

This commit is contained in:
Marc 2018-10-17 14:30:37 +02:00
parent 90443b0152
commit e2378505cd
3 changed files with 21 additions and 10 deletions

View File

@ -64,27 +64,28 @@ namespace element {
}
std::vector<int> getLanesIDs(which_lane_e whichLanes = which_lane_e::Both) {
std::vector<int> lanesId;
std::vector<int> lanes_id;
for(lane_t::iterator it = _lanes.begin(); it != _lanes.end(); ++it) {
switch(whichLanes) {
case which_lane_e::Both: {
lanesId.push_back(it->first);
lanes_id.push_back(it->first);
} break;
case which_lane_e::Left: {
if(it->first > 0) {
lanesId.push_back(it->first);
lanes_id.push_back(it->first);
}
} break;
case which_lane_e::Right: {
if(it->first < 0) {
lanesId.push_back(it->first);
lanes_id.push_back(it->first);
}
} break;
}
}
return lanes_id;
}
const LaneInfo *getLane(int id) {

View File

@ -28,6 +28,8 @@ namespace element {
RoadSegment(RoadSegmentDefinition &&def)
: _id(def.GetId()),
_successors_is_start(std::move(def._successor_is_start)),
_predecessors_is_start(std::move(def._predecessors_is_start)),
_geom(std::move(def._geom)) {
for (auto &&a : def._info) {
_info.insert(std::move(a));
@ -159,6 +161,8 @@ namespace element {
id_type _id;
std::vector<RoadSegment *> _predecessors;
std::vector<RoadSegment *> _successors;
std::vector<bool> _successors_is_start;
std::vector<bool> _predecessors_is_start;
std::vector<std::unique_ptr<Geometry>> _geom;
std::multiset<std::unique_ptr<RoadInfo>, LessComp> _info;
double _length = -1.0;

View File

@ -23,8 +23,10 @@ namespace element {
RoadSegmentDefinition(RoadSegmentDefinition &&rsd)
: _id(rsd._id),
_predecessor_id(std::move(rsd._predecessor_id)),
_successor_id(std::move(rsd._successor_id)),
_predecessor_id(std::move(rsd._predecessor_id)),
_successor_is_start(std::move(rsd._successor_is_start)),
_predecessors_is_start(std::move(rsd._predecessors_is_start)),
_geom(std::move(rsd._geom)),
_info(std::move(rsd._info)) {}
@ -37,12 +39,14 @@ namespace element {
return _id;
}
void AddPredecessorID(const id_type &id) {
_predecessor_id.emplace_back(id);
void AddSuccessorID(const id_type &id, bool is_start = true) {
_successor_id.emplace_back(id);
_successor_is_start.emplace_back(is_start);
}
void AddSuccessorID(const id_type &id) {
_successor_id.emplace_back(id);
void AddPredecessorID(const id_type &id, bool is_start = true) {
_predecessor_id.emplace_back(id);
_predecessors_is_start.emplace_back(is_start);
}
// usage MakeGeometry<GeometryArc>(len, st_pos_offs, head, st_pos, curv)
@ -75,8 +79,10 @@ namespace element {
friend class RoadSegment;
id_type _id;
std::vector<id_type> _predecessor_id;
std::vector<id_type> _successor_id;
std::vector<id_type> _predecessor_id;
std::vector<bool> _successor_is_start;
std::vector<bool> _predecessors_is_start;
std::vector<std::unique_ptr<Geometry>> _geom;
std::vector<std::unique_ptr<RoadInfo>> _info;
};