修复问题

This commit is contained in:
2026-08-09 15:30:12 +08:00
parent 6fe0bed78e
commit 4b9dd5c199
15 changed files with 616 additions and 278 deletions
+87 -15
View File
@@ -122,22 +122,22 @@ struct Mode_ACS_Config {
std::cout << " ~Mode_S_Config()" << std::endl;
}
Psc::JSON to_base_json() const {
auto ret = settings.snapshot().to_base_json();
auto ret = settings.read([](const auto& value) {
return value.to_base_json();
});
ret.append(Psc::JSON("data_feed", data_feed_config.to_json()));
ret.append(Psc::JSON("data_source", data_source_config.to_json()));
ret.append(Psc::JSON("source_feed_relation", source_feed_relation_config.to_json()));
return ret;
}
void from_json(const Psc::JSON* that_json, bool not_exist_use_default_value) {
auto value = settings.snapshot();
value.from_base_json(that_json, not_exist_use_default_value);
settings.write([&](auto& target) {
target = value;
settings.write([&](auto& value) {
value.from_base_json(that_json, not_exist_use_default_value);
SSR::Monitor_Mode_ACS_Message_Num = value.monitor_msg_live;
});
data_feed_config.init(that_json->get("data_feed"), not_exist_use_default_value);
data_source_config.init(that_json->get("data_source"), not_exist_use_default_value);
source_feed_relation_config.from_json(that_json->get("source_feed_relation"), not_exist_use_default_value);
SSR::Monitor_Mode_ACS_Message_Num = value.monitor_msg_live;
}
void server(Global* g);
};
@@ -215,6 +215,17 @@ struct Map_Resources_Config {
[[nodiscard]] bool is_imagery_key(std::string_view key) const;
[[nodiscard]] bool is_terrain_key(std::string_view key) const;
};
namespace adminive {
template <>
struct Type_Descriptor<Map_Resources_Config> {
static auto get() {
using T = Map_Resources_Config;
return object<T>("map_resources_config", "地图资源配置",
ADMINIVE_FIELD_LABEL(T, current_imagery_key, "当前影像源").read_write(),
ADMINIVE_FIELD_LABEL(T, tile_sources, "地图瓦片源").read_write());
}
};
}
struct Map_Camera_Config {
double longitude = 121.27;
double latitude = 37.41;
@@ -224,6 +235,21 @@ struct Map_Camera_Config {
double roll = 0.0;
PSC_USE_JSON
};
namespace adminive {
template <>
struct Type_Descriptor<Map_Camera_Config> {
static auto get() {
using T = Map_Camera_Config;
return object<T>("map_camera_config", "地图相机",
ADMINIVE_FIELD_LABEL(T, longitude, "经度").editable().number_input(),
ADMINIVE_FIELD_LABEL(T, latitude, "纬度").editable().number_input(),
ADMINIVE_FIELD_LABEL(T, height, "高度").editable().number_input(),
ADMINIVE_FIELD_LABEL(T, heading, "航向角").editable().number_input(),
ADMINIVE_FIELD_LABEL(T, pitch, "俯仰角").editable().number_input(),
ADMINIVE_FIELD_LABEL(T, roll, "横滚角").editable().number_input());
}
};
}
struct Map_Tile_View_Config {
std::string current_imagery_key = "imagery";
std::string current_terrain_key = "terrain";
@@ -232,6 +258,19 @@ struct Map_Tile_View_Config {
void from_base_json(const Psc::JSON* that_json, bool not_exist_use_default_value);
[[nodiscard]] Psc::JSON to_base_json() const;
};
namespace adminive {
template <>
struct Type_Descriptor<Map_Tile_View_Config> {
static auto get() {
using T = Map_Tile_View_Config;
return object<T>("map_tile_view_config", "地图瓦片视图",
ADMINIVE_FIELD_LABEL(T, current_imagery_key, "影像源").editable().text_input(),
ADMINIVE_FIELD_LABEL(T, current_terrain_key, "地形源").editable().text_input(),
ADMINIVE_FIELD_LABEL(T, tile_zoom_mode, "缩放模式").editable().select_input(),
ADMINIVE_FIELD_LABEL(T, tile_display_maximum_level, "显示最大层级").editable().number_input());
}
};
}
struct Map_View_Config {
std::string scene_mode = "3d";
Map_Tile_View_Config map2d;
@@ -242,6 +281,20 @@ struct Map_View_Config {
[[nodiscard]] Psc::JSON to_base_json() const;
[[nodiscard]] static bool is_scene_mode(std::string_view mode);
};
namespace adminive {
template <>
struct Type_Descriptor<Map_View_Config> {
static auto get() {
using T = Map_View_Config;
return object<T>("map_view_config", "地图视图配置",
ADMINIVE_FIELD_LABEL(T, scene_mode, "场景模式").editable().required().text_input(),
ADMINIVE_FIELD_LABEL(T, map2d, "2D 地图").editable(),
ADMINIVE_FIELD_LABEL(T, map3d, "3D 地图").editable(),
ADMINIVE_FIELD_LABEL(T, camera, "相机").editable(),
ADMINIVE_FIELD_LABEL(T, base_station_fly_to_height_offset_meters, "基站飞行高度偏移(米)").editable().number_input());
}
};
}
struct Cesium_Graphics_Config_Data {
bool debug_show_frames_per_second = true;
std::uint32_t target_frame_rate = 30;
@@ -356,6 +409,19 @@ struct Map_Model_Config {
void from_base_json(const Psc::JSON* that_json, bool not_exist_use_default_value);
[[nodiscard]] Psc::JSON to_base_json() const;
};
namespace adminive {
template <>
struct Type_Descriptor<Map_Model_Config> {
static auto get() {
using T = Map_Model_Config;
return object<T>("map_model_config", "Cesium 模型配置",
ADMINIVE_FIELD_LABEL(T, aircraft_model, "默认飞机模型").read_write(),
ADMINIVE_FIELD_LABEL(T, aircraft_models, "机型模型").read_write(),
ADMINIVE_FIELD_LABEL(T, base_station_model, "基站模型").read_write(),
ADMINIVE_FIELD_LABEL(T, device_model, "设备模型").read_write());
}
};
}
struct Net_Config {
std::string key{};
std::string ip{};
@@ -409,10 +475,10 @@ 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;
adminive::Managed_Value<Map_Resources_Config> map_resources_config;
adminive::Managed_Value<Map_View_Config> map_view_config;
Cesium_Graphics_Config cesium_graphics_config;
Map_Model_Config map_model_config;
adminive::Managed_Value<Map_Model_Config> map_model_config;
Mode_ACS_Config mode_acs;
Log_Config log_config;
Console_Config console_config{};
@@ -425,10 +491,16 @@ public:
void from_base_json(Psc::JSON* that_json, bool not_exist_use_default_value) {
Get_J(version) mlat.from_json(that_json->get("mlat"), not_exist_use_default_value);
web_server_config.from_base_json(that_json->get("web_server"), not_exist_use_default_value);
map_resources_config.from_base_json(that_json->get("map_resources"), not_exist_use_default_value);
map_view_config.from_base_json(that_json->get("map_view"), not_exist_use_default_value);
map_resources_config.write([&](auto& value) {
value.from_base_json(that_json->get("map_resources"), not_exist_use_default_value);
});
map_view_config.write([&](auto& value) {
value.from_base_json(that_json->get("map_view"), not_exist_use_default_value);
});
cesium_graphics_config.from_base_json(that_json->get("cesium_graphics"), not_exist_use_default_value);
map_model_config.from_base_json(that_json->get("map_models"), not_exist_use_default_value);
map_model_config.write([&](auto& value) {
value.from_base_json(that_json->get("map_models"), not_exist_use_default_value);
});
device_config.from_json(that_json->get("device"), not_exist_use_default_value);
mode_acs.from_json(that_json->get("mode_acs"), not_exist_use_default_value);
console_config.from_base_json(that_json->get("console"), not_exist_use_default_value);
@@ -445,9 +517,9 @@ 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()},
{"map_models", map_model_config.to_base_json()},
{"map_resources", map_resources_config.read([](const auto& value) { return value.to_base_json(); })},
{"map_view", map_view_config.read([](const auto& value) { return value.to_base_json(); })},
{"map_models", map_model_config.read([](const auto& value) { return value.to_base_json(); })},
{"device", device_config.to_base_json()},
{"mode_acs", mode_acs.to_base_json()},
//{"ais", ais.to_json()},