diff --git a/src/opendrive_road.cpp b/src/opendrive_road.cpp index ae0ca2e3f69bdbd945d60157c36ebfe1acd522ef..b0c67e439912f492bd235f923816821d4ba93fb9 100644 --- a/src/opendrive_road.cpp +++ b/src/opendrive_road.cpp @@ -137,7 +137,6 @@ void COpendriveRoad::load(const std::string &filename) // link segments this->link_segments(*open_drive); // process junctions -/* for(OpenDRIVE::junction_iterator junction_it(open_drive->junction().begin());junction_it!=open_drive->junction().end();++junction_it) { for(junction::connection_iterator connection_it(junction_it->connection().begin()); connection_it!=junction_it->connection().end();++connection_it) @@ -182,7 +181,6 @@ void COpendriveRoad::load(const std::string &filename) } } } - */ }catch (const xml_schema::exception& e){ std::ostringstream os; os << e; diff --git a/src/opendrive_road_segment.cpp b/src/opendrive_road_segment.cpp index c0216140472ed0af1b27961dbf65318f45b1cb64..9fc73a2df8bb931543416a209f4e251940d3277d 100644 --- a/src/opendrive_road_segment.cpp +++ b/src/opendrive_road_segment.cpp @@ -274,7 +274,11 @@ void COpendriveRoadSegment::link_segment(COpendriveRoadSegment &segment) for(unsigned int i=0;i<this->next.size();i++) if(this->next[i]->get_id()==segment.get_id())// the segment is already included return; + for(unsigned int i=0;i<segment.prev.size();i++) + if(segment.prev[i]->get_id()==this->id) + return; this->next.push_back(&segment); + segment.prev.push_back(this); // link lanes for(int i=-this->num_right_lanes;i<0;i++) { @@ -313,7 +317,11 @@ void COpendriveRoadSegment::link_segment(COpendriveRoadSegment &segment,int from for(unsigned int i=0;i<this->next.size();i++) if(this->next[i]->get_id()==segment.get_id())// the segment is already included return; + for(unsigned int i=0;i<segment.prev.size();i++) + if(segment.prev[i]->get_id()==this->id) + return; this->next.push_back(&segment); + segment.prev.push_back(this); // link lanes if(this->lanes.find(from)!=this->lanes.end() && segment.lanes.find(to)!=segment.lanes.end()) this->lanes[from]->link_lane(segment.lanes[to],OD_MARK_NONE);