This commit is contained in:
2026-07-28 14:51:38 +08:00
parent 259b7b54a4
commit 35b18c3e98
7 changed files with 49 additions and 24 deletions
+15 -7
View File
@@ -94,13 +94,14 @@
"tile_display_maximum_level": 19 "tile_display_maximum_level": 19
}, },
"camera": { "camera": {
"longitude": 121.599586, "longitude": 122.014707,
"latitude": 37.221651, "latitude": 35.714108,
"height": 298108.121570, "height": 241660.031820,
"heading": 360.000000, "heading": 347.582854,
"pitch": -90.000000, "pitch": -54.917211,
"roll": 0.000000 "roll": 359.999884
} },
"baseStationFlyToHeightOffsetMeters": 8000.000000
}, },
"map_models": { "map_models": {
"aircraft_model": { "aircraft_model": {
@@ -611,6 +612,13 @@
"terrain_maximum_level": 15, "terrain_maximum_level": 15,
"terrain_cache_tiles": 128, "terrain_cache_tiles": 128,
"terrain_occlusion_enabled": false, "terrain_occlusion_enabled": false,
"surface_navigation_reference_visible": true,
"view_axes_visible": true,
"performance_panel_x": 12.000000,
"performance_panel_y": 92.000000,
"view_axes_panel_x": 3.000000,
"view_axes_panel_y": 337.000000,
"view_axes_panel_size": 184.000000,
"occlusion_sample_spacing_meters": 250.000000, "occlusion_sample_spacing_meters": 250.000000,
"occlusion_clearance_margin_meters": 10.000000 "occlusion_clearance_margin_meters": 10.000000
} }
@@ -1,38 +1,38 @@
#include "BaseStation.h" #include "Base_Station.h"
namespace SSR { namespace SSR {
struct HULC_Status_Message; struct HULC_Status_Message;
} }
double BaseStation::theoretical_detection_range_meters(double base_height_meters, double Base_Station::theoretical_detection_range_meters(double base_height_meters,
double target_height_meters) { double target_height_meters) {
return static_cast<double>(SSR::CPR::radio_line_of_sight_range_meters(base_height_meters, target_height_meters)); return static_cast<double>(SSR::CPR::radio_line_of_sight_range_meters(base_height_meters, target_height_meters));
} }
std::optional<SSR::Position_3D> BaseStation::get_pos() { std::optional<SSR::Position_3D> Base_Station::get_pos() {
std::lock_guard g(mtx); std::lock_guard g(mtx);
if (!hulc.GPS_has_valid_fix()) { if (!hulc.GPS_has_valid_fix()) {
return std::nullopt; return std::nullopt;
} }
return SSR::Position_3D{hulc.get_latitude(), hulc.get_longitude(), static_cast<SSR::CPR::D>(hulc.Alt)}; return SSR::Position_3D{hulc.get_latitude(), hulc.get_longitude(), static_cast<SSR::CPR::D>(hulc.Alt)};
} }
double BaseStation::get_height() { double Base_Station::get_height() {
std::lock_guard g(mtx); std::lock_guard g(mtx);
return hulc.Alt; return hulc.Alt;
} }
bool BaseStation::has_valid_position() { bool Base_Station::has_valid_position() {
std::lock_guard g(mtx); std::lock_guard g(mtx);
return hulc.GPS_has_valid_fix(); return hulc.GPS_has_valid_fix();
} }
void BaseStation::set_msg(const SSR::HULC_Status_Message &msg) { void Base_Station::set_msg(const SSR::HULC_Status_Message &msg) {
std::lock_guard g(mtx); std::lock_guard g(mtx);
hulc = msg; hulc = msg;
if (handle_when_updated) if (handle_when_updated)
handle_when_updated(msg); handle_when_updated(msg);
} }
std::string BaseStation::to_string() { std::string Base_Station::to_string() {
std::lock_guard g(mtx); std::lock_guard g(mtx);
return "BaseStation:[" + std::to_string(hulc.get_latitude()) + ", " + return "BaseStation:[" + std::to_string(hulc.get_latitude()) + ", " +
std::to_string(hulc.get_longitude()) + "]"; std::to_string(hulc.get_longitude()) + "]";
} }
Psc::JSON BaseStation::to_Json() { Psc::JSON Base_Station::to_Json() {
std::lock_guard g(mtx); std::lock_guard g(mtx);
auto ret = Psc::JSON::object(); auto ret = Psc::JSON::object();
ret.append({"序列号", hulc.SerNum}); ret.append({"序列号", hulc.SerNum});
@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "global.h" #include "global.h"
class BaseStation { class Base_Station {
public: public:
std::string to_string(); std::string to_string();
Psc::JSON to_Json(); Psc::JSON to_Json();
+1 -1
View File
@@ -541,7 +541,7 @@ void database_server(Global *g) {
ret = db->base_station.to_Json(); ret = db->base_station.to_Json();
auto target_height = auto target_height =
g->mode_acs.adsb_theoretical_target_altitude_meters.load(); g->mode_acs.adsb_theoretical_target_altitude_meters.load();
auto range = BaseStation::theoretical_detection_range_meters(db->alt, auto range = Base_Station::theoretical_detection_range_meters(db->alt,
target_height); target_height);
ret.append({"latitude", db->lat}); ret.append({"latitude", db->lat});
ret.append({"longitude", db->lon}); ret.append({"longitude", db->lon});
+7 -7
View File
@@ -1,15 +1,15 @@
#pragma once #pragma once
#include <string_view>
#include "../Aircraft/Aircraft.h"
#include "../Aircraft/Flight_VTO.h"
#include "../External_Database/export.h"
#include "BaseStation.h"
#include "Local_Server/server/With_Loop_Coro.h"
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <shared_mutex> #include <shared_mutex>
#include <string_view>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "../Aircraft/Aircraft.h"
#include "../Aircraft/Flight_VTO.h"
#include "../External_Database/export.h"
#include "Base_Station.h"
#include "Local_Server/server/With_Loop_Coro.h"
template < template <
typename Key_Type, typename Key_Type,
typename Value_Type, typename Value_Type,
@@ -153,7 +153,7 @@ public:
std::shared_ptr<SSR::Aircraft_Info> create_aircraft(std::string_view icao) override; std::shared_ptr<SSR::Aircraft_Info> create_aircraft(std::string_view icao) override;
Psc::JSON get_aircraftlist(); Psc::JSON get_aircraftlist();
Psc::JSON get_aircraftlist(int limit_msg_num); Psc::JSON get_aircraftlist(int limit_msg_num);
BaseStation base_station; Base_Station base_station;
void delete_timeout_aircraft(); void delete_timeout_aircraft();
std::string get_key() override { std::string get_key() override {
return key; return key;
+12
View File
@@ -373,6 +373,11 @@ void Cesium_Graphics_Config::from_base_json(const Psc::JSON* that_json) {
terrain_occlusion_enabled = read_optional_bool_field(that_json, "terrain_occlusion_enabled", terrain_occlusion_enabled); terrain_occlusion_enabled = read_optional_bool_field(that_json, "terrain_occlusion_enabled", terrain_occlusion_enabled);
surface_navigation_reference_visible = read_optional_bool_field(that_json, "surface_navigation_reference_visible", surface_navigation_reference_visible); surface_navigation_reference_visible = read_optional_bool_field(that_json, "surface_navigation_reference_visible", surface_navigation_reference_visible);
view_axes_visible = read_optional_bool_field(that_json, "view_axes_visible", view_axes_visible); view_axes_visible = read_optional_bool_field(that_json, "view_axes_visible", view_axes_visible);
performance_panel_x = std::max(0.0, read_optional_double_field(that_json, "performance_panel_x", performance_panel_x));
performance_panel_y = std::max(0.0, read_optional_double_field(that_json, "performance_panel_y", performance_panel_y));
view_axes_panel_x = read_optional_double_field(that_json, "view_axes_panel_x", view_axes_panel_x);
view_axes_panel_y = std::max(0.0, read_optional_double_field(that_json, "view_axes_panel_y", view_axes_panel_y));
view_axes_panel_size = std::clamp(read_optional_double_field(that_json, "view_axes_panel_size", view_axes_panel_size), 48.0, 240.0);
occlusion_sample_spacing_meters = std::clamp(read_optional_double_field(that_json, "occlusion_sample_spacing_meters", occlusion_sample_spacing_meters), 10.0, 5000.0); occlusion_sample_spacing_meters = std::clamp(read_optional_double_field(that_json, "occlusion_sample_spacing_meters", occlusion_sample_spacing_meters), 10.0, 5000.0);
occlusion_clearance_margin_meters = read_optional_double_field(that_json, "occlusion_clearance_margin_meters", occlusion_clearance_margin_meters); occlusion_clearance_margin_meters = read_optional_double_field(that_json, "occlusion_clearance_margin_meters", occlusion_clearance_margin_meters);
} }
@@ -397,6 +402,13 @@ Psc::JSON Cesium_Graphics_Config::to_base_json() const {
ret.append({"terrain_occlusion_enabled", terrain_occlusion_enabled}); ret.append({"terrain_occlusion_enabled", terrain_occlusion_enabled});
ret.append({"surface_navigation_reference_visible", surface_navigation_reference_visible}); ret.append({"surface_navigation_reference_visible", surface_navigation_reference_visible});
ret.append({"view_axes_visible", view_axes_visible}); ret.append({"view_axes_visible", view_axes_visible});
ret.append({"performance_panel_x", performance_panel_x});
ret.append({"performance_panel_y", performance_panel_y});
if (view_axes_panel_x >= 0.0) {
ret.append({"view_axes_panel_x", view_axes_panel_x});
}
ret.append({"view_axes_panel_y", view_axes_panel_y});
ret.append({"view_axes_panel_size", view_axes_panel_size});
ret.append({"occlusion_sample_spacing_meters", occlusion_sample_spacing_meters}); ret.append({"occlusion_sample_spacing_meters", occlusion_sample_spacing_meters});
ret.append({"occlusion_clearance_margin_meters", occlusion_clearance_margin_meters}); ret.append({"occlusion_clearance_margin_meters", occlusion_clearance_margin_meters});
return ret; return ret;
+5
View File
@@ -191,6 +191,11 @@ struct Cesium_Graphics_Config {
bool terrain_occlusion_enabled = false; bool terrain_occlusion_enabled = false;
bool surface_navigation_reference_visible = false; bool surface_navigation_reference_visible = false;
bool view_axes_visible = false; bool view_axes_visible = false;
double performance_panel_x = 12.0;
double performance_panel_y = 92.0;
double view_axes_panel_x = -1.0;
double view_axes_panel_y = 76.0;
double view_axes_panel_size = 84.0;
double occlusion_sample_spacing_meters = 250.0; double occlusion_sample_spacing_meters = 250.0;
double occlusion_clearance_margin_meters = 10.0; double occlusion_clearance_margin_meters = 10.0;
void from_base_json(const Psc::JSON* that_json); void from_base_json(const Psc::JSON* that_json);