#pragma once #include "cache.h" #include #include #include #include #include #include namespace bg = boost::geometry; class BoundingBox { private: Position a; Position b; public: inline bool within(Position p); BoundingBox(Position p1, Position p2); }; class ContourData { private: bg::model::polygon> contour; BoundingBox bbox; public: ContourData(BoundingBox bbox); bool within(Position p); void add_point(Position p); }; class Region { private: ContourData* contour; std::string name; std::vector subregions; std::map parse_geojson(const std::string& json_file); public: Region(ContourData* contour, std::string name) : contour(contour), name(name) {} Region(const std::filesystem::path& geojson, const std::filesystem::path& geojson_sub); ~Region(); bool within(Position p) { return contour->within(p); } std::string get_name() { return name; } std::string find_subregion(Position p); }; class Country { private: std::vector regions; public: Country(const std::vector& jsons); void locate(Cache& c); };