Skip to content
Snippets Groups Projects
Commit 5ace694e authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Added support to generate all the geometries of the imported map.

parent c0730e50
No related branches found
No related tags found
1 merge request!2Solved a bug when creating a new geometry object: the sale factor is...
......@@ -30,6 +30,7 @@ class COSMMap : public osmium::handler::Handler
void process_map(void);
void create_junctions(void);
void create_road_segments(void);
void generate_geometries(void);
void delete_way(COSMWay *way);
void add_way(COSMWay *way);
COSMWay *get_way_by_id(long int id);
......
......@@ -118,11 +118,18 @@ void COSMMap::create_road_segments(void)
for(unsigned int i=0;i<this->ways.size();i++)
{
new_segment=new COSMRoadSegment(this->ways[i]);
new_segment->generate_geometry();
this->segments.push_back(new_segment);
}
}
void COSMMap::generate_geometries(void)
{
for(unsigned int i=0;i<this->segments.size();i++)
this->segments[i]->generate_geometry();
for(unsigned int i=0;i<this->junctions.size();i++)
this->junctions[i]->generate_geometry();
}
void COSMMap::delete_way(COSMWay *way)
{
std::vector<COSMWay *>::iterator it;
......@@ -266,6 +273,7 @@ void COSMMap::load(const std::string &filename)
this->process_map();
this->create_road_segments();
this->create_junctions();
this->generate_geometries();
}
void COSMMap::node(const osmium::Node& node)
......@@ -336,6 +344,14 @@ void COSMMap::get_paths(std::vector<double> &x, std::vector<double> &y, std::vec
heading.insert(heading.end(),new_heading.begin(),new_heading.end());
curvature.insert(curvature.end(),new_curvature.begin(),new_curvature.end());
}
for(unsigned int i=0;i<this->junctions.size();i++)
{
this->junctions[i]->get_trajectory(new_x,new_y,new_heading,new_curvature);
x.insert(x.end(),new_x.begin(),new_x.end());
y.insert(y.end(),new_y.begin(),new_y.end());
heading.insert(heading.end(),new_heading.begin(),new_heading.end());
curvature.insert(curvature.end(),new_curvature.begin(),new_curvature.end());
}
}
std::ostream& operator<<(std::ostream& out, COSMMap &map)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment