центрирование каты при тестовом расчете ПУУД
This commit is contained in:
+32
-20
@@ -144,7 +144,7 @@
|
||||
el('angular-motion-map-meta').textContent = state.flightLine.length > 0
|
||||
? `Трасса и полосы обзора на интервале ${formatDateTime(time)} ± 5 минут.`
|
||||
: 'Нет данных трассы полета для выбранного КА и времени.';
|
||||
drawMap(true);
|
||||
drawMap('flight-line');
|
||||
}
|
||||
|
||||
function initMap() {
|
||||
@@ -182,9 +182,9 @@
|
||||
el('angular-motion-lat').value = Cesium.Math.toDegrees(cartographic.latitude).toFixed(6);
|
||||
el('angular-motion-lon').value = Cesium.Math.toDegrees(cartographic.longitude).toFixed(6);
|
||||
setPicking(false);
|
||||
drawMap(false);
|
||||
drawMap();
|
||||
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
||||
drawMap(false);
|
||||
drawMap();
|
||||
}
|
||||
|
||||
function initCursorCoordinates() {
|
||||
@@ -295,14 +295,6 @@
|
||||
.map(pair => ({ lon: pair[0], lat: pair[1] }));
|
||||
}
|
||||
|
||||
function surveyContourBounds() {
|
||||
const coordinates = polygonCoordinatesFromWkt(state.result?.contourWkt);
|
||||
return {
|
||||
lats: coordinates.map(point => point.lat),
|
||||
lons: coordinates.map(point => point.lon),
|
||||
};
|
||||
}
|
||||
|
||||
function addSurveyContour() {
|
||||
if (!state.mapDataSource || !state.result?.contourWkt) return;
|
||||
const coordinates = polygonCoordinatesFromWkt(state.result.contourWkt);
|
||||
@@ -360,8 +352,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
function fitMapToData() {
|
||||
if (!state.viewer) return;
|
||||
function flightLineBounds() {
|
||||
const points = Array.isArray(state.flightLine) ? state.flightLine : [];
|
||||
const lats = [];
|
||||
const lons = [];
|
||||
@@ -375,9 +366,12 @@
|
||||
if (Number.isFinite(value)) lons.push(value);
|
||||
});
|
||||
});
|
||||
const contourBounds = surveyContourBounds();
|
||||
lats.push(...contourBounds.lats);
|
||||
lons.push(...contourBounds.lons);
|
||||
return { lats, lons };
|
||||
}
|
||||
|
||||
function fitMapToFlightLine() {
|
||||
if (!state.viewer) return;
|
||||
const { lats, lons } = flightLineBounds();
|
||||
if (lats.length === 0 || lons.length === 0) return;
|
||||
const minLat = Math.max(-89.0, Math.min(...lats) - 1.0);
|
||||
const maxLat = Math.min(89.0, Math.max(...lats) + 1.0);
|
||||
@@ -390,7 +384,21 @@
|
||||
});
|
||||
}
|
||||
|
||||
function drawMap(fit = false) {
|
||||
function centerMapOnTarget() {
|
||||
if (!state.viewer) return;
|
||||
const lat = Number(el('angular-motion-lat').value);
|
||||
const lon = Number(el('angular-motion-lon').value);
|
||||
if (!Number.isFinite(lat) || !Number.isFinite(lon)) return;
|
||||
|
||||
const currentHeight = state.viewer.camera.positionCartographic?.height;
|
||||
const height = Number.isFinite(currentHeight) ? currentHeight : 3_000_000;
|
||||
state.viewer.camera.flyTo({
|
||||
destination: Cesium.Cartesian3.fromDegrees(lon, lat, height),
|
||||
duration: 0.4,
|
||||
});
|
||||
}
|
||||
|
||||
function drawMap(centerMode = null) {
|
||||
if (!state.mapDataSource || typeof Cesium === 'undefined') return;
|
||||
state.mapDataSource.entities.removeAll();
|
||||
const points = Array.isArray(state.flightLine) ? state.flightLine : [];
|
||||
@@ -399,7 +407,11 @@
|
||||
addPolyline(points, 'latitudeDeg', 'longitudeDeg', Cesium.Color.YELLOW, 3, 'Трасса полета');
|
||||
addSurveyContour();
|
||||
addTarget();
|
||||
if (fit) fitMapToData();
|
||||
if (centerMode === 'flight-line') {
|
||||
fitMapToFlightLine();
|
||||
} else if (centerMode === 'target') {
|
||||
centerMapOnTarget();
|
||||
}
|
||||
state.viewer.scene.requestRender();
|
||||
}
|
||||
|
||||
@@ -475,7 +487,7 @@
|
||||
<td>${escapeHtml(formatNumber(point.sdiSpread, 4))}</td>
|
||||
</tr>
|
||||
`).join('');
|
||||
drawMap(true);
|
||||
drawMap('target');
|
||||
}
|
||||
|
||||
async function calculate(event) {
|
||||
@@ -531,7 +543,7 @@
|
||||
});
|
||||
el('angular-motion-mode').addEventListener('change', modeChanged);
|
||||
el('angular-motion-pick-from-map').addEventListener('click', () => setPicking(!state.picking));
|
||||
['angular-motion-lat', 'angular-motion-lon'].forEach(id => el(id).addEventListener('input', () => drawMap(false)));
|
||||
['angular-motion-lat', 'angular-motion-lon'].forEach(id => el(id).addEventListener('input', () => drawMap()));
|
||||
el('angular-motion-export-csv').addEventListener('click', exportCsv);
|
||||
modeChanged();
|
||||
loadSatellites().catch(error => showAlert(error.message || String(error)));
|
||||
|
||||
Reference in New Issue
Block a user