diff --git a/Arrangement_on_surface_2/demo/earth/Aos.cpp b/Arrangement_on_surface_2/demo/earth/Aos.cpp index 6bcf9253f63..220eb0f35b5 100644 --- a/Arrangement_on_surface_2/demo/earth/Aos.cpp +++ b/Arrangement_on_surface_2/demo/earth/Aos.cpp @@ -334,6 +334,9 @@ std::vector Aos::ext_check(const Kml::Placemarks& placemarks) auto& d = vit->data(); if (vit->data().v == false) { + std::cout << "-------------------------------------\n"; + std::cout << vit->point() << std::endl; + if (2 == vit->degree()) ;//continue; @@ -341,8 +344,8 @@ std::vector Aos::ext_check(const Kml::Placemarks& placemarks) { auto p = vit->point(); auto p2 = p.location(); - std::cout << "deg-1 vertex = " << p << std::endl; - std::cout << "deg-1 vertex: " << std::boolalpha << vit->incident_halfedges()->target()->data().v << std::endl; + std::cout << " deg-1 vertex = " << p << std::endl; + std::cout << " deg-1 vertex: " << std::boolalpha << vit->incident_halfedges()->target()->data().v << std::endl; } @@ -362,9 +365,12 @@ std::vector Aos::ext_check(const Kml::Placemarks& placemarks) do { } while (++curr != first); - + + std::cout << "\n"; } } + Kml::Node n{ 180.0, -84.71338 }; + std::cout << "Node itself = " << n.get_coords_3d() << std::endl; std::cout << "*** num created vertices = " << num_created_vertices << std::endl; std::cout << "-------------------------------\n"; diff --git a/Arrangement_on_surface_2/demo/earth/Kml_reader.cpp b/Arrangement_on_surface_2/demo/earth/Kml_reader.cpp index 2ce959bf04c..89165c26ff9 100644 --- a/Arrangement_on_surface_2/demo/earth/Kml_reader.cpp +++ b/Arrangement_on_surface_2/demo/earth/Kml_reader.cpp @@ -16,14 +16,14 @@ bool Kml::Node::operator == (const Node& r) const } Kml::Vec3d Kml::Node::get_coords_3d(const double r) const { - const auto phi = qDegreesToRadians(lat); - const auto theta = qDegreesToRadians(lon); + const long double phi = qDegreesToRadians(lat); + const long double theta = qDegreesToRadians(lon); const auto z = r * std::sin(phi); const auto rxy = r * std::cos(phi); const auto x = rxy * std::cos(theta); const auto y = rxy * std::sin(theta); - return Vec3d{ x, y, z }; + return Vec3d{ (double)x, (double)y, (double)z }; } QVector3D Kml::Node::get_coords_3f(const double r) const { @@ -120,6 +120,7 @@ Kml::Placemarks Kml::read(const std::string& file_name) else if (name == "LinearRing") { // LinearRing is moved to the correct locations via other tags above + assert(*lring.nodes.begin() == *(--lring.nodes.end())); } else if (name == "coordinates") { diff --git a/Arrangement_on_surface_2/demo/earth/Kml_reader.h b/Arrangement_on_surface_2/demo/earth/Kml_reader.h index 76c74573ef7..d47c020152b 100644 --- a/Arrangement_on_surface_2/demo/earth/Kml_reader.h +++ b/Arrangement_on_surface_2/demo/earth/Kml_reader.h @@ -16,12 +16,21 @@ public: struct Vec3d { double x, y, z; + + friend std::ostream& operator << (std::ostream& os, const Vec3d& v) + { + os << v.x << ", " << v.y << ", " << v.z; + return os; + } }; struct Node { double lon, lat; + Node() : lon(-1111), lat(-1111) {}; + Node(double longitude, double latitude) : lon(longitude), lat(latitude) {}; + 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; diff --git a/Arrangement_on_surface_2/demo/earth/Main_widget.cpp b/Arrangement_on_surface_2/demo/earth/Main_widget.cpp index ea9fe8cf8c5..11193e7b9b1 100644 --- a/Arrangement_on_surface_2/demo/earth/Main_widget.cpp +++ b/Arrangement_on_surface_2/demo/earth/Main_widget.cpp @@ -227,8 +227,8 @@ void Main_widget::initializeGL() else { // check the arrangement constructed from the GIS data-set - //auto created_vertices = Aos::ext_check(m_countries); - auto created_vertices = Aos::ext_check_id_based(m_countries); + auto created_vertices = Aos::ext_check(m_countries); + //auto created_vertices = Aos::ext_check_id_based(m_countries); m_vertices = std::make_unique(created_vertices); }