Расчет средних ЗРВ

This commit is contained in:
emelianov
2026-05-28 16:47:43 +03:00
parent 2c65f412cf
commit 7dfa1163e9
5 changed files with 91 additions and 21 deletions
@@ -65,8 +65,11 @@ class RequestRestController {
@PostMapping("/station/{station_id}")
fun sat(@PathVariable("station_id") id : String, @RequestParam view : Boolean) =
czmlService.station(id, view)
fun sat(
@PathVariable("station_id") id : String,
@RequestParam view : Boolean,
@RequestParam(required = false) orbitHeightKm : Double?
) = czmlService.station(id, view, orbitHeightKm)
@@ -50,6 +50,7 @@ class CZMLService {
private val docStationName = "station_"
private val entityStationName = "station_"
private val docReqCovName ="req_cov_"
private val DEFAULT_STATION_ORBIT_HEIGHT_KM = 500.0
@Autowired
private lateinit var stationService: StationService
@@ -378,9 +379,10 @@ private val docReqCovName ="req_cov_"
}
fun station(id : String, view : Boolean) : Iterable<CZMLEntity>{
fun station(id : String, view : Boolean, orbitHeightKm: Double? = null) : Iterable<CZMLEntity>{
val req = stationService.station(id).block()?:return listOf()
val radius = ellipseAx( (500.0 * 1000.0), req.elevationMin * PI / 180)
val normalizedOrbitHeightKm = orbitHeightKm?.takeIf { it > 0 } ?: DEFAULT_STATION_ORBIT_HEIGHT_KM
val radius = ellipseAx((normalizedOrbitHeightKm * 1000.0), req.elevationMin * PI / 180)
val r: MutableList<CZMLEntity> = mutableListOf(CZMLEntity("document", docStationName+id , "1.1"))
r.add(
@@ -401,7 +403,7 @@ private val docReqCovName ="req_cov_"
extrudedHeight = 1000.0,
height = 1000.0
),
description = "Станция ${req.name}",
description = "Станция ${req.name}<br>Высота орбиты для зоны видимости: ${normalizedOrbitHeightKm} км",
model = CZMLModel(
gltf = "/model/station.glb",
show = !view
@@ -79,7 +79,8 @@
checkModels();
} else{
var sceneMode = (viewer.scene.mode == Cesium.SceneMode.SCENE2D);
var u = '/requests/station/'+req.id+'?view='+sceneMode
var u = '/requests/station/'+req.id+'?view='+sceneMode+
'&orbitHeightKm='+encodeURIComponent(selectedStationOrbitHeightKm())
fetch(u, {
method: "post",
headers: {
@@ -115,6 +116,16 @@
}
}
function selectedStationOrbitHeightKm() {
const input = document.getElementById('stationOrbitHeightKm');
const value = Number(input?.value || 500);
if (!Number.isFinite(value) || value <= 0) {
if (input) input.value = '500';
return 500;
}
return value;
}
function drawSat(show, req, startInput, endInput, runId){
if (req){
@@ -288,13 +288,23 @@
<input class="form-check-input" type="checkbox" id="toggleStations" checked>
<label class="form-check-label" for="toggleStations">Показать станции</label>
</div>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="toggleCoverage">
<label class="form-check-label" for="toggleCoverage">Показать зоны покрытия</label>
</div>
<select class="form-select form-select-sm mb-2">
<option selected>Все типы станций</option>
<option value="1">Наземные</option>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="toggleCoverage">
<label class="form-check-label" for="toggleCoverage">Показать зоны покрытия</label>
</div>
<div class="mb-2">
<label for="stationOrbitHeightKm" class="form-label form-label-sm mb-1">Высота орбиты, км</label>
<input type="number"
class="form-control form-control-sm"
id="stationOrbitHeightKm"
min="1"
step="1"
value="500"
onchange="handleStationOrbitHeightChange()">
</div>
<select class="form-select form-select-sm mb-2">
<option selected>Все типы станций</option>
<option value="1">Наземные</option>
<option value="2">Мобильные</option>
<option value="3">Контрольные</option>
</select>
@@ -1701,16 +1711,23 @@
}
function checkStation(show, st_id) {
const sts = [[${stations}]];
const req = sts.find(function(element) {
return element.id == st_id;
});
function checkStation(show, st_id) {
const sts = [[${stations}]];
const req = sts.find(function(element) {
return element.id == st_id;
});
if (req) {
console.log('изменить видимость станции ' + req.id)
drawSt(show, req);
}
}
drawSt(show, req);
}
}
function handleStationOrbitHeightChange() {
document.querySelectorAll('#stationsTableBody input[type="checkbox"]:checked').forEach(function(checkbox) {
checkStation(false, checkbox.value);
checkStation(true, checkbox.value);
});
}
// Функция для обработки запросов