This commit is contained in:
2026-07-24 18:09:37 +08:00
parent 908c8b5a36
commit 8370ff9e79
13 changed files with 1028 additions and 158 deletions
+77 -4
View File
@@ -7,6 +7,7 @@
#include "MLAT.h"
#include "Source_Feed_Relation.h"
#include <fstream>
#include <vector>
inline bool delete_log = false;
extern std::string default_config_path;
std::string get_config_path();
@@ -102,12 +103,75 @@ struct Web_Server_Config {
[[nodiscard]] std::string get_true_webapp() const {
return Psc::get_abs_path(webapp);
}
[[nodiscard]] std::string get_true_tiles() const {
return Psc::get_abs_path(tiles);
}
PSC_USE_JSON
std::string webapp;
std::string tiles;
};
struct Map_Tile_Config {
std::vector<std::string> directories;
std::string path_layout;
std::string y_axis;
std::string projection;
std::string extension;
std::uint32_t tile_size{};
std::uint32_t minimum_level{};
std::uint32_t maximum_level{};
std::string encoding;
[[nodiscard]] std::vector<std::string> get_true_directories() const {
std::vector<std::string> ret;
ret.reserve(directories.size());
for (const auto& path : directories) {
ret.emplace_back(Psc::get_abs_path(path));
}
return ret;
}
void from_base_json(const Psc::JSON* that_json);
[[nodiscard]] Psc::JSON to_base_json() const;
[[nodiscard]] Psc::JSON to_public_json(std::string_view url) const;
};
struct Map_Resources_Config {
std::string current_imagery_key = "imagery";
Map_Tile_Config imagery;
Map_Tile_Config google_imagery;
Map_Tile_Config terrain;
void from_base_json(const Psc::JSON* that_json);
[[nodiscard]] Psc::JSON to_base_json() const;
[[nodiscard]] Psc::JSON to_public_json() const;
[[nodiscard]] bool is_imagery_key(std::string_view key) const;
};
struct Map_Camera_Config {
double longitude = 121.27;
double latitude = 37.41;
double height = 300000.0;
double heading = 0.0;
double pitch = -90.0;
double roll = 0.0;
void from_base_json(const Psc::JSON* that_json);
[[nodiscard]] Psc::JSON to_base_json() const;
};
struct Map_View_Config {
std::string scene_mode = "3d";
Map_Camera_Config camera;
void from_base_json(const Psc::JSON* that_json);
[[nodiscard]] Psc::JSON to_base_json() const;
[[nodiscard]] static bool is_scene_mode(std::string_view mode);
};
struct Cesium_Graphics_Config {
bool debug_show_frames_per_second = true;
std::uint32_t target_frame_rate = 30;
bool use_browser_recommended_resolution = true;
double resolution_scale = 0.7;
std::uint32_t msaa_samples = 1;
bool fxaa = false;
bool shadows = false;
bool enable_lighting = false;
std::uint32_t maximum_screen_space_error = 4;
bool terrain_enabled_in_3d = false;
double terrain_exaggeration = 1.0;
bool terrain_limit_maximum_level = true;
std::uint32_t terrain_maximum_level = 15;
std::uint32_t terrain_cache_tiles = 128;
void from_base_json(const Psc::JSON* that_json);
[[nodiscard]] Psc::JSON to_base_json() const;
};
struct Net_Config {
std::string key{};
@@ -162,6 +226,9 @@ public:
MLAT_Config mlat;
Device_Config device_config;
Web_Server_Config web_server_config;
Map_Resources_Config map_resources_config;
Map_View_Config map_view_config;
Cesium_Graphics_Config cesium_graphics_config;
Mode_ACS_Config mode_acs;
Log_Config log_config;
Console_Config console_config{};
@@ -191,6 +258,9 @@ public:
Get_J(version)
mlat.init(that_json->get("mlat"));
web_server_config.from_base_json(that_json->get("web_server"));
map_resources_config.from_base_json(that_json->get("map_resources"));
map_view_config.from_base_json(that_json->get("map_view"));
cesium_graphics_config.from_base_json(that_json->get("cesium_graphics"));
device_config.init(that_json->get("device"));
mode_acs.init(that_json->get("mode_acs"));
console_config.from_base_json(that_json->get("console"));
@@ -207,12 +277,15 @@ public:
{"http_monitor", http_monitor_config.to_base_json()},
{"mlat", mlat.to_base_json()},
{"web_server", web_server_config.to_base_json()},
{"map_resources", map_resources_config.to_base_json()},
{"map_view", map_view_config.to_base_json()},
{"device", device_config.to_base_json()},
{"mode_acs", mode_acs.to_base_json()},
//{"ais", ais.to_json()},
{"log", log_config.to_base_json()},
{"console", console_config.to_base_json()},
{"external_database", external_resources_manager.to_base_json()},
{"cesium_graphics", cesium_graphics_config.to_base_json()},
});
return ret;
}