|
| 1 | +// Copyright(c) 2023, 2024 Tel-Aviv University (Israel). |
| 2 | +// All rights reserved. |
| 3 | +// |
| 4 | +// This file is part of CGAL (www.cgal.org). |
| 5 | +// |
| 6 | +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial |
| 7 | +// |
| 8 | +// Author(s): Engin Deniz Diktas <[email protected]> |
| 9 | + |
| 10 | +#ifndef AOS_H |
| 11 | +#define AOS_H |
| 12 | + |
| 13 | +#include <map> |
| 14 | +#include <memory> |
| 15 | +#include <vector> |
| 16 | +#include <qvector3d.h> |
| 17 | + |
| 18 | +#include "Kml_reader.h" |
| 19 | + |
| 20 | +class Aos { |
| 21 | +public: |
| 22 | + using Approx_arc = std::vector<QVector3D>; |
| 23 | + using Approx_arcs = std::vector<Approx_arc>; |
| 24 | + //using Arr_handle = void*; |
| 25 | + using Arr_handle = std::shared_ptr<void>; |
| 26 | + |
| 27 | + static Approx_arc get_approx_identification_curve(double error); |
| 28 | + |
| 29 | + // this constructs some sample arcs manually (used to check the visual output) |
| 30 | + static Approx_arcs get_approx_arcs(double error); |
| 31 | + |
| 32 | + // this is used to construct approximate arcs from KML-Placemark data |
| 33 | + static Approx_arcs get_approx_arcs(const Kml::Placemark& placemark, |
| 34 | + double error); |
| 35 | + |
| 36 | + static void get_curves(); |
| 37 | + |
| 38 | + static void check(const Kml::Placemarks& placemarks); |
| 39 | + |
| 40 | + // Extended check: here we use the extended version of the DCEL to understand |
| 41 | + // what is going on with the additional vertices and faces. |
| 42 | + // INPUT: GIS data |
| 43 | + // OUTPUT: vertices created during arrangement construction |
| 44 | + static std::vector<QVector3D> ext_check(const Kml::Placemarks& placemarks); |
| 45 | + |
| 46 | + // Same as above function but works by identifying the duplicate nodes |
| 47 | + static std::vector<QVector3D> ext_check_id_based(Kml::Placemarks& placemarks); |
| 48 | + |
| 49 | + // This function is used to find the newly-created faces during arrangement |
| 50 | + // construction. It uses the extended DCEL structure (see: above 2 functions). |
| 51 | + // NOTE: The need for this function arises due to the following observation: |
| 52 | + // when constructing the arrangement from our data-set I observed a newly |
| 53 | + // created face which is not defined explicitly in the data-set. My intiution |
| 54 | + // tells me that this is the Caspian sea, because it is the only land-locked |
| 55 | + // polygon whose boundaries are not defined in the data-set and its boundaries |
| 56 | + // are defined indirecly by its surrounding countries. |
| 57 | + static Approx_arcs find_new_faces(Kml::Placemarks& placemarks); |
| 58 | + |
| 59 | + // save the arrangement created with EPEC |
| 60 | + static void save_arr(Kml::Placemarks& placemarks, |
| 61 | + const std::string& file_name); |
| 62 | + |
| 63 | + // loads the arrangement created by the save_arr function |
| 64 | + // NOTE: This one loads the arrangement as "Country_arr" type |
| 65 | + static Arr_handle load_arr(const std::string& file_name); |
| 66 | + |
| 67 | + static Arr_handle construct(Kml::Placemarks& placemarks); |
| 68 | + //static std::vector<QVector3D> get_triangles(Arr_handle arrh); |
| 69 | + |
| 70 | + //using Country_triangles_map = std::map<std::string, std::vector<QVector3D>>; |
| 71 | + //static Country_triangles_map get_triangles_by_country(Arr_handle arrh); |
| 72 | + |
| 73 | + using Country_color_map = std::map<std::string, std::size_t>; |
| 74 | + static Country_color_map get_color_mapping(Arr_handle arrh); |
| 75 | + |
| 76 | + static std::string locate_country(Arr_handle arrh, const QVector3D& point); |
| 77 | + |
| 78 | + // this will get the approximate arcs of face-edges from the arrangement |
| 79 | + // NOTE: this is similar to "get_approx_arcs(KML::Placemarks&, double)" above! |
| 80 | + static Approx_arcs get_approx_arcs_from_faces_edges(Arr_handle arrh, |
| 81 | + double error); |
| 82 | +}; |
| 83 | + |
| 84 | +#endif |
0 commit comments