Added support for the direction of the lane connection
This commit is contained in:
parent
90443b0152
commit
e2378505cd
|
@ -64,27 +64,28 @@ namespace element {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> getLanesIDs(which_lane_e whichLanes = which_lane_e::Both) {
|
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) {
|
for(lane_t::iterator it = _lanes.begin(); it != _lanes.end(); ++it) {
|
||||||
switch(whichLanes) {
|
switch(whichLanes) {
|
||||||
case which_lane_e::Both: {
|
case which_lane_e::Both: {
|
||||||
lanesId.push_back(it->first);
|
lanes_id.push_back(it->first);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case which_lane_e::Left: {
|
case which_lane_e::Left: {
|
||||||
if(it->first > 0) {
|
if(it->first > 0) {
|
||||||
lanesId.push_back(it->first);
|
lanes_id.push_back(it->first);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case which_lane_e::Right: {
|
case which_lane_e::Right: {
|
||||||
if(it->first < 0) {
|
if(it->first < 0) {
|
||||||
lanesId.push_back(it->first);
|
lanes_id.push_back(it->first);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return lanes_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const LaneInfo *getLane(int id) {
|
const LaneInfo *getLane(int id) {
|
||||||
|
|
|
@ -28,6 +28,8 @@ namespace element {
|
||||||
|
|
||||||
RoadSegment(RoadSegmentDefinition &&def)
|
RoadSegment(RoadSegmentDefinition &&def)
|
||||||
: _id(def.GetId()),
|
: _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)) {
|
_geom(std::move(def._geom)) {
|
||||||
for (auto &&a : def._info) {
|
for (auto &&a : def._info) {
|
||||||
_info.insert(std::move(a));
|
_info.insert(std::move(a));
|
||||||
|
@ -159,6 +161,8 @@ namespace element {
|
||||||
id_type _id;
|
id_type _id;
|
||||||
std::vector<RoadSegment *> _predecessors;
|
std::vector<RoadSegment *> _predecessors;
|
||||||
std::vector<RoadSegment *> _successors;
|
std::vector<RoadSegment *> _successors;
|
||||||
|
std::vector<bool> _successors_is_start;
|
||||||
|
std::vector<bool> _predecessors_is_start;
|
||||||
std::vector<std::unique_ptr<Geometry>> _geom;
|
std::vector<std::unique_ptr<Geometry>> _geom;
|
||||||
std::multiset<std::unique_ptr<RoadInfo>, LessComp> _info;
|
std::multiset<std::unique_ptr<RoadInfo>, LessComp> _info;
|
||||||
double _length = -1.0;
|
double _length = -1.0;
|
||||||
|
|
|
@ -23,8 +23,10 @@ namespace element {
|
||||||
|
|
||||||
RoadSegmentDefinition(RoadSegmentDefinition &&rsd)
|
RoadSegmentDefinition(RoadSegmentDefinition &&rsd)
|
||||||
: _id(rsd._id),
|
: _id(rsd._id),
|
||||||
_predecessor_id(std::move(rsd._predecessor_id)),
|
|
||||||
_successor_id(std::move(rsd._successor_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)),
|
_geom(std::move(rsd._geom)),
|
||||||
_info(std::move(rsd._info)) {}
|
_info(std::move(rsd._info)) {}
|
||||||
|
|
||||||
|
@ -37,12 +39,14 @@ namespace element {
|
||||||
return _id;
|
return _id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddPredecessorID(const id_type &id) {
|
void AddSuccessorID(const id_type &id, bool is_start = true) {
|
||||||
_predecessor_id.emplace_back(id);
|
_successor_id.emplace_back(id);
|
||||||
|
_successor_is_start.emplace_back(is_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddSuccessorID(const id_type &id) {
|
void AddPredecessorID(const id_type &id, bool is_start = true) {
|
||||||
_successor_id.emplace_back(id);
|
_predecessor_id.emplace_back(id);
|
||||||
|
_predecessors_is_start.emplace_back(is_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
// usage MakeGeometry<GeometryArc>(len, st_pos_offs, head, st_pos, curv)
|
// usage MakeGeometry<GeometryArc>(len, st_pos_offs, head, st_pos, curv)
|
||||||
|
@ -75,8 +79,10 @@ namespace element {
|
||||||
|
|
||||||
friend class RoadSegment;
|
friend class RoadSegment;
|
||||||
id_type _id;
|
id_type _id;
|
||||||
std::vector<id_type> _predecessor_id;
|
|
||||||
std::vector<id_type> _successor_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<Geometry>> _geom;
|
||||||
std::vector<std::unique_ptr<RoadInfo>> _info;
|
std::vector<std::unique_ptr<RoadInfo>> _info;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue