diff --git a/server/static/index.html b/server/static/index.html index 49ac2b2..d2ca561 100644 --- a/server/static/index.html +++ b/server/static/index.html @@ -547,6 +547,7 @@ let apiDebugTxMarker = null; let apiDebugRxMarker = null; let apiDebugLineLayer = null; + let apiDebugBeamLayer = null; let apiDebugCursorDist = null; let apiDebugCursorMarker = null; let apiDebugGroundProfile = null; @@ -2201,6 +2202,41 @@ } } + function clearApiDebugBeam() { + if (apiDebugBeamLayer) { + map.removeLayer(apiDebugBeamLayer); + apiDebugBeamLayer = null; + } + } + + function renderApiDebugBeam(data) { + const feature = data?.geojson || data; + if (!feature?.geometry) { + apiDebugSetSummary('Ответ antenna/beam не содержит GeoJSON geometry.'); + return; + } + clearApiDebugBeam(); + apiDebugBeamLayer = L.geoJSON(feature, { + style: { + color: '#ff9800', + weight: 2, + opacity: 0.95, + fillColor: '#ff9800', + fillOpacity: 0.22 + } + }).addTo(map); + const props = feature.properties || {}; + const bounds = apiDebugBeamLayer.getBounds(); + if (bounds.isValid()) { + setMapViewProgrammatically(() => map.fitBounds(bounds, { padding: [40, 40], maxZoom: 15 })); + } + apiDebugSetSummary( + `Сектор антенны: ${escapeHtml(props.pattern || 'sector')} · ` + + `azimuth ${fmtNum(props.azimuth_deg, 0, '°')} · radius ${fmtNum(props.radius_m, 0, ' m')}
` + + `Оранжевая заливка на карте — зона сектора из GeoJSON ответа.` + ); + } + function clearApiDebugCursorMarker() { if (apiDebugCursorMarker) { map.removeLayer(apiDebugCursorMarker); @@ -2318,6 +2354,7 @@ if (el) el.value = ''; }); refreshApiDebugOverlay(); + clearApiDebugBeam(); clearApiDebugCursorMarker(); apiDebugGroundProfile = null; apiDebugSurfaceProfile = null; @@ -2514,6 +2551,7 @@ else if (kind === 'los') apiDebugSetSummary(formatApiDebugLosSummary(data)); else if (kind === 'budget') apiDebugSetSummary(formatApiDebugBudgetSummary(data)); else if (kind === 'elevation') apiDebugSetSummary(formatApiDebugPointSummary(data)); + else if (kind === 'beam') renderApiDebugBeam(data); else apiDebugSetSummary('Ответ получен.'); } catch (e) { apiDebugSetStatus(`Ошибка запроса: ${e.message || e}`, true);