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