Zakladni vytvareni letu na zaklade planu

This commit is contained in:
Michal Kváček
2024-06-30 02:31:16 +02:00
parent 16650cc0cb
commit ba1089af3d
16 changed files with 240 additions and 23 deletions
+6 -5
View File
@@ -32,7 +32,8 @@ export const useFlightPlanCalculations = () => {
return Math.round(flightPlan.track.map(t => t.distance).reduce((a, b) => a + b));
}
const getTotalDuration = (flightPlan, plannedSpeed) => {
const getTotalDuration = (flightPlan, plannedSpeed = undefined) => {
if (!plannedSpeed) plannedSpeed = flightPlan.plannedSpeed;
if (!flightPlan.track.length) return null;
return flightPlan.track.map(t => getDuration(t.distance, plannedSpeed)).reduce((a, b) => a + b)
@@ -44,11 +45,11 @@ export const useFlightPlanCalculations = () => {
export const useFlightPlanObjects = () => {
const editableNameTypes = ["geocode", "mapPoint"];
const markerObject = ({name, type, gpsLatitude, gpsLongitude}) => ({
name, type, gpsLatitude, gpsLongitude
const markerObject = ({name, type, airportId, pointOfInterestId, gpsLatitude, gpsLongitude}) => ({
name, type, gpsLatitude, gpsLongitude, pointOfInterestId, airportId
});
const googleMapsCustomMarkerObject = (marker) => {
const googleMapsCustomMarkerObject = (marker, overrideAnchorPoint = undefined) => {
const anchorPoints = {
airport: "CENTER",
geocode: "BOTTOM_CENTER",
@@ -57,7 +58,7 @@ export const useFlightPlanObjects = () => {
}
return {
anchorPoint: anchorPoints[marker.type],
anchorPoint: overrideAnchorPoint || anchorPoints[marker.type],
position: {lat: marker.gpsLatitude, lng: marker.gpsLongitude}
}
}