diff --git a/server/static/index.html b/server/static/index.html index 24744f1..49ac2b2 100644 --- a/server/static/index.html +++ b/server/static/index.html @@ -226,6 +226,12 @@ color: #d7f7ff; font-size: 0.72rem; white-space: pre-wrap; } #apiDebugChart { width: 100%; height: 140px; display: block; margin-top: 8px; background: #0a0a14; border-radius: 4px; } + .api-debug-legend { + display: flex; gap: 10px; flex-wrap: wrap; align-items: center; + margin-top: 5px; color: #aaa; font-size: 0.7rem; + } + .api-debug-legend span { display: inline-flex; align-items: center; gap: 4px; } + .api-debug-swatch { width: 16px; height: 3px; border-radius: 2px; display: inline-block; } #apiDebugSummary { margin-top: 8px; padding: 8px; background: #0a0a14; border: 1px solid #333; border-radius: 4px; font-size: 0.75rem; line-height: 1.45; @@ -304,6 +310,11 @@
Выберите запрос для проверки RF API.@@ -536,6 +547,12 @@ let apiDebugTxMarker = null; let apiDebugRxMarker = null; let apiDebugLineLayer = null; + let apiDebugCursorDist = null; + let apiDebugCursorMarker = null; + let apiDebugGroundProfile = null; + let apiDebugSurfaceProfile = null; + let apiDebugLosLine = null; + let apiDebugBaseSummaryHtml = 'Нет расчёта.'; let mapRulerMode = 'pick'; let mapRulerPtA = null; let mapRulerPtB = null; @@ -2184,6 +2201,80 @@ } } + function clearApiDebugCursorMarker() { + if (apiDebugCursorMarker) { + map.removeLayer(apiDebugCursorMarker); + apiDebugCursorMarker = null; + } + } + + function clearApiDebugCursor() { + apiDebugCursorDist = null; + clearApiDebugCursorMarker(); + apiDebugSetStatus('RF расчёт линии готов'); + apiDebugSetSummary(apiDebugBaseSummaryHtml); + drawApiDebugChart(); + } + + function drawApiDebugChart() { + const series = []; + if (apiDebugGroundProfile) { + series.push({ + color: '#4fc3f7', + profile: apiDebugGroundProfile, + label: 'земля DEM' + }); + } + if (apiDebugSurfaceProfile) { + series.push({ + color: '#00ff88', + profile: apiDebugSurfaceProfile, + label: 'поверхность', + losLine: apiDebugLosLine, + cursor: apiDebugCursorDist + }); + } + renderElevationCanvas( + document.getElementById('apiDebugChart'), + series, + 'done', + 'Запустите расчёт линии' + ); + } + + function setApiDebugChartCursor(distM) { + if (!apiDebugSurfaceProfile || !apiDebugGroundProfile) return; + const tx = apiDebugLatLon('tx'); + const rx = apiDebugLatLon('rx'); + if (!tx || !rx) return; + const total = apiDebugSurfaceProfile.total_m || lineLengthM(tx, rx); + apiDebugCursorDist = Math.max(0, Math.min(distM, total)); + const pt = latLonAtLineDist(tx, rx, apiDebugCursorDist); + clearApiDebugCursorMarker(); + apiDebugCursorMarker = L.circleMarker([pt.lat, pt.lon], { + radius: 8, + color: '#fff', + weight: 2, + fillColor: '#ff9800', + fillOpacity: 0.95, + interactive: false + }).addTo(map); + const ground = elevationAtDist(apiDebugGroundProfile, apiDebugCursorDist); + const surface = elevationAtDist(apiDebugSurfaceProfile, apiDebugCursorDist); + const delta = ground != null && surface != null ? surface - ground : null; + apiDebugSetStatus( + `${apiDebugCursorDist.toFixed(0)} m · земля ${fmtNum(ground, 1, ' m')} · поверхность ${fmtNum(surface, 1, ' m')}` + ); + apiDebugSetSummary( + `${apiDebugBaseSummaryHtml}