3#include "common/map/shapefile.h"
4#include "core/config.h"
5#include "core/resources.h"
7#include "handlers/vector/shapefile_handler.h"
15 inline void renderVectorOverlayMenu(handlers::Handler *h)
18 if (ImGui::BeginMenu(
"Add Overlay"))
20 if (ImGui::MenuItem(
"Shores"))
21 h->addSubHandler(std::make_shared<handlers::ShapefileHandler>(resources::getResourcePath(
"maps/ne_10m_coastline.shp")),
true);
23 if (ImGui::MenuItem(
"Borders"))
24 h->addSubHandler(std::make_shared<ShapefileHandler>(resources::getResourcePath(
"maps/ne_10m_admin_0_countries.shp")),
true);
26 if (ImGui::MenuItem(
"Cities"))
27 h->addSubHandler(std::make_shared<ShapefileHandler>(resources::getResourcePath(
"maps/ne_10m_populated_places_simple.shp")),
true);
29 if (ImGui::MenuItem(
"Lat/Lon Grid"))
31 auto h2 = std::make_shared<ShapefileHandler>();
32 h2->shapefile_name =
"Lat/Lon Grid";
34 shapefile::PolyLineRecord r;
36 for (
float lon = -180; lon < 180; lon += 10)
38 r.parts_points.push_back(std::vector<shapefile::point_t>());
39 auto &l = r.parts_points[r.parts_points.size() - 1];
41 for (
float lat = -90; lat < 90; lat += 0.05)
42 l.push_back({lon, lat});
45 for (
float lat = -90; lat < 90; lat += 10)
47 r.parts_points.push_back(std::vector<shapefile::point_t>());
48 auto &l = r.parts_points[r.parts_points.size() - 1];
50 for (
float lon = -180; lon < 180; lon += 0.05)
51 l.push_back({lon, lat});
54 h2->file = std::make_unique<shapefile::Shapefile>();
55 h2->file->polyline_records.push_back(r);
57 h->addSubHandler(h2,
true);
60 if (ImGui::MenuItem(
"QTH"))
62 auto h2 = std::make_shared<ShapefileHandler>();
63 h2->shapefile_name =
"QTH";
65 shapefile::PointRecord r;
67 r.point.y = satdump::satdump_cfg.getValueFromSatDumpGeneral<
double>(
"qth_lat");
68 r.point.x = satdump::satdump_cfg.getValueFromSatDumpGeneral<
double>(
"qth_lon");
70 h2->file = std::make_unique<shapefile::Shapefile>();
71 h2->file->point_records.push_back(r);
72 h2->dbf_file[0][
"name"] =
"QTH";
75 h->addSubHandler(h2,
true);