Skip to content

Commit

Permalink
minor refactor: Aos::get_approx_arcs & added rendering of country bor…
Browse files Browse the repository at this point in the history
…ders (but still need to load the KML file)
  • Loading branch information
denizdiktas committed Aug 17, 2023
1 parent 706e7ea commit cec57f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
18 changes: 1 addition & 17 deletions Arrangement_on_surface_2/demo/earth/Aos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,23 +338,7 @@ Aos::Approx_arcs Aos::get_approx_arcs(const Kml::Placemark& placemark, double er
auto ctr_cv = s_traits.construct_curve_2_object();

auto xcvs = get_arcs(placemark);

auto approx = s_traits.approximate_2_object();
std::vector<std::vector<QVector3D>> arcs;
for (const auto& xcv : xcvs)
{
std::vector<Approximate_point_2> v;
auto oi2 = approx(xcv, error, std::back_insert_iterator(v));

std::vector<QVector3D> arc_points;
for (const auto& p : v)
{
const QVector3D arc_point(p.dx(), p.dy(), p.dz());
arc_points.push_back(arc_point);
}
arcs.push_back(std::move(arc_points));
}
//std::cout << "offset count = " << m_arc_offsets.size() << std::endl;
auto arcs = ::get_approx_curves(xcvs, error);

return arcs;
}
Expand Down
16 changes: 8 additions & 8 deletions Arrangement_on_surface_2/demo/earth/Main_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ void Main_widget::initializeGL()
//Shapefile::read(shape_file_name);

//const auto file_name = data_path + "world_countries.kml";
//const auto file_name = data_path + "ne_110m_admin_0_countries.kml";
const auto file_name = data_path + "ne_110m_admin_0_countries_africa.kml";
const auto file_name = data_path + "ne_110m_admin_0_countries.kml";
//const auto file_name = data_path + "ne_110m_admin_0_countries_africa.kml";
//const auto file_name = data_path + "ne_110m_admin_0_countries_equatorial_guinea.kml";
m_countries = Kml::read(file_name);

Expand Down Expand Up @@ -370,7 +370,7 @@ void Main_widget::initializeGL()


// initialize rendering of DUPLICATE VERTICES
if(1)
if(0)
{
qDebug() << "identifying duplicate nodes";
std::vector<QVector3D> vertices;
Expand All @@ -379,7 +379,7 @@ void Main_widget::initializeGL()

m_vertices = std::make_unique<Vertices>(vertices);
}
else
if(0)
{
// check the arrangement constructed from the GIS data-set
auto created_vertices = Aos::ext_check(m_countries);
Expand Down Expand Up @@ -635,10 +635,10 @@ void Main_widget::paintGL()
m_identification_curve->draw(m_selected_arc_index);

// draw all countries
//float a = 0.0;
//sp.set_uniform("u_color", QVector4D(a, a, a, 1));
//for(auto& country_border : m_country_borders)
// country_border->draw();
float a = 0.0;
sp.set_uniform("u_color", QVector4D(a, a, a, 1));
for(auto& country_border : m_country_borders)
country_border->draw();

//// draw the SELECTED COUNTRY in BLUE
//auto& selected_country = m_country_borders[m_selected_country_index];
Expand Down

0 comments on commit cec57f2

Please sign in to comment.