Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
denizdiktas committed Jul 5, 2023
1 parent d5c4d3f commit 9f98df3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
12 changes: 12 additions & 0 deletions Arrangement_on_surface_2/demo/earth/Aos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,23 @@ std::vector<QVector3D> Aos::ext_check(const Kml::Placemarks& placemarks)
auto& d = vit->data();
if (vit->data().v == false)
{
if (2 == vit->degree())
;//continue;

if (1 == vit->degree())
{
std::cout << "1-deg vertex: " << std::boolalpha << vit->incident_halfedges()->target()->data().v << std::endl;
}


num_created_vertices++;
auto p = vit->point();
auto ap = approx(p);
QVector3D new_vertex(ap.dx(), ap.dy(), ap.dz());
new_vertex.normalize();
std::cout << new_vertex << std::endl;
std::cout << "degree = " << vit->degree() << std::endl;

created_vertices.push_back(new_vertex);

// find the arcs that are adjacent to this vertex
Expand Down
5 changes: 5 additions & 0 deletions Arrangement_on_surface_2/demo/earth/Kml_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ QVector3D Kml::Node::get_coords_3f(const double r) const
const auto v = get_coords_3d(r);
return QVector3D(v.x, v.y, v.z);
}
std::ostream& operator << (std::ostream& os, const Kml::Node& n)
{
os << n.lon << ", " << n.lat;
return os;
}


Kml::Placemarks Kml::read(const std::string& file_name)
Expand Down
6 changes: 1 addition & 5 deletions Arrangement_on_surface_2/demo/earth/Kml_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ class Kml
bool operator == (const Node& r) const;
Vec3d get_coords_3d(const double r = 1.0) const;
QVector3D get_coords_3f(const double r=1.0) const;
friend std::ostream& operator << (std::ostream& os, const Node& n)
{
os << n.lon << ", " << n.lat;
return os;
}
friend std::ostream& operator << (std::ostream& os, const Node& n);
};
using Nodes = std::vector<Node>;

Expand Down
6 changes: 3 additions & 3 deletions Arrangement_on_surface_2/demo/earth/Main_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ void readShapefile(const std::string& filename) {

void Main_widget::initializeGL()
{
readShapefile("C:/work/gsoc2023/data/ne_110m_admin_0_countries/ne_110m_admin_0_countries.shp");
//readShapefile("C:/work/gsoc2023/data/ne_110m_admin_0_countries/ne_110m_admin_0_countries.shp");

//const auto file_name = "C:/work/gsoc2023/data/world_countries.kml";
const auto file_name = "C:/work/gsoc2023/data/ne_110m_admin_0_countries.kml";
m_countries = Kml::read(file_name);
auto dup_nodes = Kml::get_duplicates(m_countries);

// initialize rendering of DUPLICATE VERTICES
if(1)
if(0)
{
std::vector<QVector3D> vertices;
for (const auto& node : dup_nodes)
Expand Down Expand Up @@ -493,7 +493,7 @@ void Main_widget::paintGL()
const QVector4D vertex_color(1, 0, 0, 1);
sp.set_uniform("u_color", vertex_color);
glPointSize(5);
//m_vertices->draw();
m_vertices->draw();

sp.unuse();
}
Expand Down

0 comments on commit 9f98df3

Please sign in to comment.